[FFmpeg-devel] [PATCH+RFC] AVFrame for audio

Stefano Sabatini stefano.sabatini-lala
Thu Sep 30 12:11:00 CEST 2010


On date Wednesday 2010-09-29 21:20:04 -0400, Justin Ruggles encoded:
> Hi,
> 
> Peter Ross wrote:
> 
> > On Thu, Sep 02, 2010 at 07:11:37PM -0400, Justin Ruggles wrote:
> >> Hi,
> >>
> >> Peter Ross wrote:
> >>
> >>> To prototype use of audio in AVFrame, I have modified the PCM encoder/decoder
> >>> and addded new public lavc functions.
> >>>
> >>> Existing SAMPLE_FMTs are mapping onto (AVFrame*)->data[0]. The obvious
> >>> next step is to support planar audio, and splitting FF_COMMON_FRAME into
> >>> common, audio- and video-specific parts.
> >>>
> >>> avctx->reget_audio_buffer() is implemened using a simple realloc. It
> >>> probably makes sense to reuse the video InternalBuffer stuff, but i'm not
> >>> sure.
> >> Any progress on this?  I really like the idea.
> > 
> > Unfortunately not. If you or anyone else wants to run with this patch, please do.
> 
> Here is a new patch+rfc to only change the audio decoding to behave like
> video decoding.
> 
> - adds nb_sample to AVFrame

<nitpick>
I'd prefer samples_nb. The _nb prefix at the end allows alignment tricks like:
samples
samples_nb

Also I read it like:
samples_nb -> samples number
which sounds better than
nb_samples -> number (of) samples
</nitpick>

> - adapts get/reget_buffer to support video or audio media types
> - example implementation for pcm decoder
> 
> Once this part is reviewed and agreed upon, I'll work on the user-side
> usage of avcodec_decode_audio4() and the tedious work of changing all
> the audio decoders to the new API.
> 
> Planar audio would definitely be nice to add later, but I'm not sure how
> to go about it. maybe something like...
> 
> - a new AVFrame field **audio_data
> - allocate channel pointers and data for each channel in get_buffer()
> - add planer sample formats and support in conversion function/filter
>     - might allow moving float_to_int16_interleave() to avfilter?
> 
> Cheers,
> Justin
> 

> Index: libavcodec/avcodec.h
> ===================================================================
> --- libavcodec/avcodec.h	(revision 25266)
> +++ libavcodec/avcodec.h	(working copy)
> @@ -31,8 +31,8 @@
>  #include "libavutil/cpu.h"
>  
>  #define LIBAVCODEC_VERSION_MAJOR 52
> -#define LIBAVCODEC_VERSION_MINOR 91
> -#define LIBAVCODEC_VERSION_MICRO  1
> +#define LIBAVCODEC_VERSION_MINOR 92
> +#define LIBAVCODEC_VERSION_MICRO  0




More information about the ffmpeg-devel mailing list