@@ -487,6 +487,12 @@ table 6-6).
Set the colour description in the stream (see H.262 section 6.3.6
and tables 6-7, 6-8 and 6-9).
+@item full_update
+If this is set, an effort is made to update the AVCodecParameters in addition
+to the bitstream. If unset, muxers might add header information based upon
+the old AVCodecParameters that contradicts and potentially precedes the
+changes made at the bitstream level. On by default.
+
@end table
@section mpeg4_unpack_bframes
@@ -43,6 +43,8 @@ typedef struct MPEG2MetadataContext {
int matrix_coefficients;
int mpeg1_warned;
+
+ int full_update;
} MPEG2MetadataContext;
@@ -253,6 +255,12 @@ static int mpeg2_metadata_init(AVBSFContext *bsf)
}
}
+ if (ctx->full_update)
+ ff_cbs_update_video_parameters(ctx->cbc, bsf->par_out, -1, -1, -1,
+ -1, -1, -1, ctx->colour_primaries,
+ ctx->transfer_characteristics,
+ ctx->matrix_coefficients, -1, -1);
+
err = 0;
fail:
ff_cbs_fragment_uninit(ctx->cbc, frag);
@@ -289,6 +297,9 @@ static const AVOption mpeg2_metadata_options[] = {
OFFSET(matrix_coefficients), AV_OPT_TYPE_INT,
{ .i64 = -1 }, -1, 255, FLAGS },
+ { "full_update", "Update not only bitstream, but also AVCodecParameters",
+ OFFSET(full_update), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS},
+
{ NULL }
};
Otherwise the muxer could add header data that is based on the old AVCodecParameters that contradicts and nullifies the modifications made to the bitstream. An option to revert to the old behaviour is included. The documentation has been updated to reflect the change. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com> --- doc/bitstream_filters.texi | 6 ++++++ libavcodec/mpeg2_metadata_bsf.c | 11 +++++++++++ 2 files changed, 17 insertions(+)