diff options
author | Nicolas Gaullier <nicolas.gaullier@cji.paris> | 2020-03-05 11:17:24 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-03-20 11:16:05 +0300 |
commit | 1ec86be79b11ec238067d099d424dd6ee48c8de7 (patch) | |
tree | 899ef764107c928493f0864a4c042cb9080fd797 /libavcodec/mpeg12dec.c | |
parent | 42271f8e182a85ac1d6706e0461b37895fd6c1f0 (diff) |
avcodec/mpeg12dec: Add CPB coded side data
This fixes mpeg2video stream copies to mpeg muxer like this:
ffmpeg -i xdcamhd.mxf -c:v copy output.mpg
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/mpeg12dec.c')
-rw-r--r-- | libavcodec/mpeg12dec.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index d553da45bc..67ce59d451 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1399,6 +1399,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1) MpegEncContext *s = &s1->mpeg_enc_ctx; int horiz_size_ext, vert_size_ext; int bit_rate_ext; + AVCPBProperties *cpb_props; skip_bits(&s->gb, 1); /* profile and level esc*/ s->avctx->profile = get_bits(&s->gb, 3); @@ -1430,6 +1431,12 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1) ff_dlog(s->avctx, "sequence extension\n"); s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO; + if (cpb_props = ff_add_cpb_side_data(s->avctx)) { + cpb_props->buffer_size = s1->rc_buffer_size; + if (s->bit_rate != 0x3FFFF*400) + cpb_props->max_bitrate = s->bit_rate; + } + if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_DEBUG, "profile: %d, level: %d ps: %d cf:%d vbv buffer: %d, bitrate:%"PRId64"\n", |