[FFmpeg-devel] [PATCH] Add get_audio_buffer_ref to lavfi audio framework

Michael Niedermayer michaelni
Mon Sep 27 15:18:42 CEST 2010

On Wed, Sep 22, 2010 at 11:01:23AM -0700, S.N. Hemanth Meenakshisundaram wrote:
>  Fixed a bug found during testing of af_afifo filter.
> This patch is needed for asrc_abuffer patch, ffmpeg lavfi changes patch.
> Regards
> ---
>  libavfilter/avfilter.c |   20 ++++++++++++++++++++
>  libavfilter/avfilter.h |   34 ++++++++++++++++++++++++++++++++++
>  libavfilter/defaults.c |   42 ++++++++++++++++++++++++++++--------------
>  3 files changed, 82 insertions(+), 14 deletions(-)

another review as the previous was too terse and mans comments show people dont
understand the way its supposed to work

> @@ -365,6 +365,16 @@ struct AVFilterPad {
>                                             int64_t channel_layout, int planar);
>      /**
> +     * Callback function to get an audio buffer ref. If NULL, the filter system will
> +     * use avfilter_default_get_audio_buffer_ref().
> +     *
> +     * Input audio pads only.
> +     */
> +    AVFilterBufferRef *(*get_audio_buffer_ref)(AVFilterLink *link, int perms,
> +                                               char *buf, enum SampleFormat sample_fmt,
> +                                               int size, int64_t channel_layout, int planar);
> +
> +    /**
>       * Callback called after the slices of a frame are completely sent. If
>       * NULL, the filter layer will default to releasing the reference stored
>       * in the link structure during start_frame().

this is unneeded

There are 2 cases which both should be supported but supporting one for now is

1. The user provides a buffer which is then wraped in a  AVFilterBufferRef
   struct, flags are set accordingly to it being only valid until the next
   frame or valid until freed, writeable or not and a free function from the
   user must be set too. But there should be no need to do callbacks to
   filters to set this struct up
   One always can use a do nothing free function, mark the buffer as read only
   and only valid till the next frame. (this simply case also is enough if
   the more complete case turns out difficult to implement)
2. Call the existing  avfilter_get_(video/audio)_buffer() give the pointers
   to the user and let him draw in that and then just pass this on

The 2nd case allows decoders to draw straight into memory provided by lets say
SDL with zero copy. but it requires us to implement get/realease_buffer() for
video decoders

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100927/58f87518/attachment.pgp>

More information about the ffmpeg-devel mailing list