[Libav-user] Allocate and free audio frame
Paul B Mahol
onemda at gmail.com
Sat Jul 20 20:27:40 CEST 2013
On 7/20/13, Massimo Battistel <battistel at gmail.com> wrote:
> hello,
> to allocate video frame buffers I use "avpicture_alloc" and to free it I
> use "avpicture_free".
>
> to allocate audio frame buffers I first have to allocate a buffer using
> "av_malloc" and then use "avcodec_fill_audio_frame". Is there a specific
> method to free audio frames? Now I'm using "avpicture_free" and it works,
> but is this the proper way?
You can use av_samples_alloc_array_and_samples() to allocate samples
for specific sample format and av_free(p) to free array and array that holds
pointers to that same array.
Note this is just most elegant why to handle both planar and packed
sample formats: see doc/examples/resampling_audio.c
>
> thanks,
> M
>
More information about the Libav-user
mailing list