[FFmpeg-devel] [PATCH] lavu/samplefmt: make av_samples_fill_arrays() return the required size of the buffer

Stefano Sabatini stefasab at gmail.com
Sun Nov 25 20:39:19 CET 2012


On date Sunday 2012-11-25 19:09:26 +0100, Michael Niedermayer encoded:
> On Sun, Nov 25, 2012 at 07:03:59PM +0100, Michael Niedermayer wrote:
[...]
> > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> > > index 2029b53..cc983c3 100644
> > > --- a/libavcodec/utils.c
> > > +++ b/libavcodec/utils.c
> > > @@ -419,7 +419,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
> > >          }
> > >          if ((ret = avcodec_fill_audio_frame(frame, avctx->channels,
> > >                                              avctx->sample_fmt, buf->data[0],
> > > -                                            buf->audio_data_size, 0)))
> > > +                                            buf->audio_data_size, 0)) < 0)
> > >              return ret;
> > >  
> > >          if (frame->extended_data == frame->data)
> > > @@ -1373,7 +1373,7 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx,
> > >          if ((ret = avcodec_fill_audio_frame(frame, avctx->channels,
> > >                                              avctx->sample_fmt,
> > >                                              (const uint8_t *)samples,
> > > -                                            samples_size, 1)))
> > > +                                            samples_size, 1)) < 0)
> > >              return ret;
> > >  
> > >          /* fabricate frame pts from sample count.
> > the
> > above 2 hunks are ok

Pushed.

> > rest seems problematic ABI/API wise
> 

> I would suggest to change the API docs to not claim 0 is returned
> but that instead it is a unspecified value >= 0
> thats not breaking ABI/API and on the next bump we can then change it
> to return size,

Yes, new patch sent.
-- 
FFmpeg = Fanciful and Fierce Mastodontic Peaceful Enhancing Governor


More information about the ffmpeg-devel mailing list