diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2021-06-23 17:12:43 +0100 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2021-06-29 15:31:06 +0100 |
commit | d70dde2712bbead523004d8294ff1a0fdeab480b (patch) | |
tree | 4f69abe45cca715c9c3b8c58e17f31dea1b77e1e /libavcodec/h264_metadata_bsf.c | |
parent | b74beba9a9a317caa7ac973cb76cc6ab0ade7667 (diff) |
avcodec/h264_metadata_bsf: Allow zeroing constraint_set4_flag and constraint_set5_flag
These bits are reserved in earlier versions of the H.264 spec, and
some poor hardware decoders require they are zero. Thus, it is useful
to be able to zero these on streams that may have them set. The result
is still a valid H.264 bitstream.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/h264_metadata_bsf.c')
-rw-r--r-- | libavcodec/h264_metadata_bsf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index ef74cba560..452a8ec5dc 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -61,6 +61,7 @@ typedef struct H264MetadataContext { AVRational tick_rate; int fixed_frame_rate_flag; + int zero_new_constraint_set_flags; int crop_left; int crop_right; @@ -228,6 +229,10 @@ static int h264_metadata_update_sps(AVBSFContext *bsf, need_vui = 1; } SET_VUI_FIELD(fixed_frame_rate_flag); + if (ctx->zero_new_constraint_set_flags) { + sps->constraint_set4_flag = 0; + sps->constraint_set5_flag = 0; + } if (sps->separate_colour_plane_flag || sps->chroma_format_idc == 0) { crop_unit_x = 1; @@ -618,6 +623,9 @@ static const AVOption h264_metadata_options[] = { { "fixed_frame_rate_flag", "Set VUI fixed frame rate flag", OFFSET(fixed_frame_rate_flag), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, FLAGS }, + { "zero_new_constraint_set_flags", "Set constraint_set4_flag / constraint_set5_flag to zero", + OFFSET(zero_new_constraint_set_flags), AV_OPT_TYPE_BOOL, + { .i64 = 0 }, 0, 1, FLAGS }, { "crop_left", "Set left border crop offset", OFFSET(crop_left), AV_OPT_TYPE_INT, |