[FFmpeg-devel] [PATCH v7 3/3] avcodec/mpeg12dec: Add CPB coded side data

Gaullier Nicolas nicolas.gaullier at cji.paris
Thu Feb 20 13:36:12 EET 2020


> De : ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> De la part de James Almer
> Envoyé : vendredi 7 février 2020 23:48
> À : ffmpeg-devel at ffmpeg.org
> Objet : Re: [FFmpeg-devel] [PATCH v7 3/3] avcodec/mpeg12dec: Add CPB coded side data
> 
> On 2/7/2020 7:43 PM, James Almer wrote:
> > On 1/14/2020 8:42 PM, Nicolas Gaullier wrote:
> >> This fixes mpeg2video stream copies to mpeg muxer like this:
> >>   ffmpeg -i xdcamhd.mxf -c:v copy output.mpg
> >> ---
> >>  libavcodec/mpeg12dec.c       | 7 +++++++
> >>  tests/ref/fate/mxf-probe-d10 | 3 +++
> >>  tests/ref/fate/ts-demux      | 2 +-
> >>  3 files changed, 11 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> >> index 17f9495a1d..48ac14fafa 100644
> >> --- a/libavcodec/mpeg12dec.c
> >> +++ b/libavcodec/mpeg12dec.c
> >> @@ -1398,6 +1398,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);
> >> @@ -1429,6 +1430,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 = FFMAX(cpb_props->buffer_size, s->avctx->rc_buffer_size);
> >
> > cpb_props->buffer_size is initialized as zero, and rc_buffer_size is not
> > meant to be used for decoding, so i imagine is also zero.
> 
> Ok, so i see this decoder is setting rc_buffer_size despite the doxy
> stating it shouldn't, so nevermind that part.
> 
> I think this should be done using an internal field in Mpeg1Context
> instead, or the API changed and it reflected in the doxy. I'm more
> inclined for the former option, since you'll be exporting the value
> using AVCPBProperties after all.
I agree with you, but this is not related to my patchset, so this should be fixed in another patch.
And I would like not to postpone this again... do you mind if this patch is applied first and if I fix this mpeg12dec design issue later (I am committing myself to do it) ?
Nicolas


More information about the ffmpeg-devel mailing list