[FFmpeg-devel] [PATCH+RFC] AVFrame for audio
Aurelien Jacobs
aurel
Thu Sep 30 17:39:42 CEST 2010
On Thu, Sep 30, 2010 at 12:11:00PM +0200, Stefano Sabatini wrote:
> 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)
> > @@ -964,6 +964,13 @@
> > * - decoding: Set by libavcodec\
> > */\
> > void *hwaccel_picture_private;\
> > +\
> > + /**\
> > + * number of audio samples (per channel) described by this frame\
> > + * - encoding: Set by user.\
> > + * - decoding: Set by libavcodec.\
> > + */\
> > + int nb_samples;\
> >
> >
> > #define FF_QSCALE_TYPE_MPEG1 0
> > @@ -3478,8 +3485,11 @@
> > const uint8_t *buf, int buf_size);
> > #endif
> >
>
> > +#if LIBAVCODEC_VERSION_MAJOR < 53
>
> Define a symbol FF_API_AVCODEC_DECODE_AUDIO3 and use it like it's done
> for the other FF_API_* symbols, this will help to test regressions.
Instead, just merge this #if block with the one just above, which is
using the new FF_API_AUDIO_OLD define.
The same applies to utils.c.
Aurel
More information about the ffmpeg-devel
mailing list