Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upipe_avcodec_encode: allow more input hardware formats #1055

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions lib/upipe-av/upipe_avcodec_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1746,10 +1746,18 @@ static int _upipe_avcenc_provide_flow_format(struct upipe *upipe,

enum AVPixelFormat hw_pix_fmt = upipe_avcenc_get_hw_pix_fmt(codec);
if (hw_pix_fmt != AV_PIX_FMT_NONE) {
uref_pic_flow_clear_format(flow_format);
if (unlikely(!ubase_check(upipe_av_pixfmt_to_flow_def(
AV_PIX_FMT_NV12, flow_format))))
goto upipe_avcenc_provide_flow_format_err;
const char *chroma_map[UPIPE_AV_MAX_PLANES];
enum AVPixelFormat pix_fmt = upipe_av_sw_pixfmt_from_flow_def(
flow_format, codec->pix_fmts, chroma_map);
if (pix_fmt == AV_PIX_FMT_NONE) {
int bit_depth = 0;
uref_pic_flow_get_bit_depth(flow_format, &bit_depth);
uref_pic_flow_clear_format(flow_format);
if (unlikely(!ubase_check(upipe_av_pixfmt_to_flow_def(
bit_depth == 10 ? AV_PIX_FMT_P010 :
AV_PIX_FMT_NV12, flow_format))))
goto upipe_avcenc_provide_flow_format_err;
}
uref_pic_flow_set_surface_type_va(flow_format, "av.%s",
av_get_pix_fmt_name(hw_pix_fmt));
} else {
Expand Down
Loading