diff mbox

[FFmpeg-devel,27/31] mpeg2_metadata: Update AVCodecParameters during init

Message ID 20190709011048.29601-2-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt July 9, 2019, 1:10 a.m. UTC
Otherwise the muxer could add header data that is based on the old
AVCodecParameters that contradicts and potentially nullifies the
modifications made to the bitstream.

This brings mpeg2_metadata in line with what is expected of a bitstream
filter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/mpeg2_metadata_bsf.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox

Patch

diff --git a/libavcodec/mpeg2_metadata_bsf.c b/libavcodec/mpeg2_metadata_bsf.c
index 3f371a028d..458a1f2e61 100644
--- a/libavcodec/mpeg2_metadata_bsf.c
+++ b/libavcodec/mpeg2_metadata_bsf.c
@@ -249,6 +249,11 @@  static int mpeg2_metadata_init(AVBSFContext *bsf)
         }
     }
 
+    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_reset(ctx->cbc, frag);