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

Michael Niedermayer michaelni at gmx.at
Sun Mar 31 00:25:11 CET 2013


On Sat, Mar 30, 2013 at 04:31:08PM +0100, Stefano Sabatini wrote:
> On date Sunday 2013-03-24 00:06:20 +0100, Stefano Sabatini encoded:
> > On date Saturday 2013-03-23 12:18:27 -0400, compn encoded:
> [...]
> > I'll push the av_samples_alloc_array_and_samples() variant in one/two
> > days if I read no objections/comments.
> 
> Updated with a leak in case of av_samples_alloc() failure fixed.
> -- 
> FFmpeg = Fascinating & Fantastic Multimedia Peaceful Empowered Geek

>  doc/APIchanges        |    3 +++
>  libavutil/samplefmt.c |   15 +++++++++++++++
>  libavutil/samplefmt.h |   13 +++++++++++++
>  libavutil/version.h   |    2 +-
>  4 files changed, 32 insertions(+), 1 deletion(-)
> 8c092864285f5e9922351f55a57a3db850fe47c2  0001-lavu-samplefmt-add-av_samples_alloc_array_and_pointe.patch
> From 836fd210d5918cc59f1c5701125becdac0250b16 Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Thu, 21 Mar 2013 11:48:28 +0100
> Subject: [PATCH] lavu/samplefmt: add av_samples_alloc_array_and_pointers()
> 
> ---
>  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

otherwise LGTM

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130331/fc23506f/attachment.asc>


More information about the ffmpeg-devel mailing list