[FFmpeg-devel] [PATCH] lavu/samplefmt: add function av_samples_alloc_pointers()

Stefano Sabatini stefasab at gmail.com
Sun Mar 31 18:09:08 CEST 2013


On date Sunday 2013-03-31 00:25:11 +0100, Michael Niedermayer encoded:
> On Sat, Mar 30, 2013 at 04:31:08PM +0100, Stefano Sabatini wrote:
[...]
> >  doc/APIchanges        |    3 +++
> >  libavutil/samplefmt.c |   15 +++++++++++++++
> >  libavutil/samplefmt.h |   13 +++++++++++++
> >  libavutil/version.h   |    2 +-
> >  4 files changed, 32 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index bc4d4fe..01f7825 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -15,6 +15,9 @@ libavutil:     2012-10-22
> >  
> >  API changes, most recent first:
> >  
> > +2013-03-30 - xxxxxxx - lavu 52.24.100 - samplefmt.h
> > +  Add av_samples_alloc_array_and_samples().
> > +
> >  2013-03-29 - xxxxxxx - lavf 55.1.100 - avformat.h
> >    Add av_guess_frame_rate()
> >  
> > diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
> > index 6f762df..ecb8274 100644
> > --- a/libavutil/samplefmt.c
> > +++ b/libavutil/samplefmt.c
> > @@ -207,6 +207,21 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
> >  #endif
> >  }
> >  
> > +int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
> > +                                       int nb_samples, enum AVSampleFormat sample_fmt, int align)
> > +{
> > +    int ret, nb_planes = av_sample_fmt_is_planar(sample_fmt) ? nb_channels : 1;
> > +
> > +    *audio_data = av_malloc(sizeof(*audio_data) * nb_planes);
> 
> should probably be av_calloc

Yes.
 
> otherwise LGTM

Pushed with that change, thanks.
-- 
FFmpeg = Free & Fantastic MultiPurpose Enhancing Gospel


More information about the ffmpeg-devel mailing list