aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Gaullier <nicolas.gaullier@cji.paris>2020-03-05 09:17:24 +0100
committerAnton Khirnov <anton@khirnov.net>2020-03-20 09:16:05 +0100
commit1ec86be79b11ec238067d099d424dd6ee48c8de7 (patch)
tree899ef764107c928493f0864a4c042cb9080fd797
parent42271f8e182a85ac1d6706e0461b37895fd6c1f0 (diff)
downloadffmpeg-1ec86be79b11ec238067d099d424dd6ee48c8de7.tar.gz
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>
-rw-r--r--libavcodec/mpeg12dec.c7
-rw-r--r--tests/ref/fate/mxf-probe-d103
-rw-r--r--tests/ref/fate/ts-demux2
3 files changed, 11 insertions, 1 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",
diff --git a/tests/ref/fate/mxf-probe-d10 b/tests/ref/fate/mxf-probe-d10
index ab564467b5..317d4ae4c5 100644
--- a/tests/ref/fate/mxf-probe-d10
+++ b/tests/ref/fate/mxf-probe-d10
@@ -50,6 +50,9 @@ DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:file_package_umid=0x060A2B340101010501010D1313000000AE86B200913105800000080046A54011
+[SIDE_DATA]
+side_data_type=CPB properties
+[/SIDE_DATA]
[/STREAM]
[STREAM]
index=1
diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
index eb13ecc684..cdf34d6af0 100644
--- a/tests/ref/fate/ts-demux
+++ b/tests/ref/fate/ts-demux
@@ -15,7 +15,7 @@
1, 5760, 5760, 2880, 1536, 0xbab5129c
1, 8640, 8640, 2880, 1536, 0x602f034b, S=1, 1, 0x00bd00bd
1, 11520, 11520, 2880, 906, 0x69cdcbcd
-0, 32037, 36541, 1501, 114336, 0x37a215a8, S=1, 1, 0x00e000e0
+0, 32037, 36541, 1501, 114336, 0x37a215a8, S=2, 1, 0x00e000e0, 24, 0x663d0b52
0, 33538, 33538, 1501, 12560, 0xb559a3d4, F=0x0, S=1, 1, 0x00e000e0
0, 35040, 35040, 1501, 12704, 0x2614adf4, F=0x0, S=1, 1, 0x00e000e0
0, 36541, 41046, 1501, 51976, 0x9ff1dbfe, F=0x0, S=1, 1, 0x00e000e0