[FFmpeg-devel] [PATCH] Add af_resample - sample fmt and channel layout conversion filter

S.N. Hemanth Meenakshisundaram smeenaks
Mon Sep 27 09:22:49 CEST 2010

 On 09/26/2010 05:50 PM, Michael Niedermayer wrote:
> On Mon, Sep 27, 2010 at 02:41:16AM +0200, Stefano Sabatini wrote:
>> On date Monday 2010-09-27 02:21:49 +0200, Michael Niedermayer encoded:
>>> On Mon, Sep 27, 2010 at 12:40:31AM +0200, Stefano Sabatini wrote:
>> [...]
>>>>> the functions belong to libavfilter
>>>>> what is the plan to move them there?
>>>> Impossible as lavc uses that functions internally.  The plan was to
>>> resample uses them, resample doesnt belong to lavc, not more than
>>> sws would belong there
>>>> directly use them, and move to something better when we'll have a
>>>> revisited resampling/conversion API, a libavresample was mentioned.
>>>> Since this is not going to take small time, the idea was to use the
>>>> quickest solution and not stall audio lavfi development.
>>> the quickest is to copy the 2 pages of poor code not to export it as
>>> public ABI/API from the wrong lib
>>> that API/ABI requires maintaince and is not a small burden when things
>>> have to be moved to the correct place or when API/ABI changes which with
>>> such trashy code will happen unless development stops
>> OK so the quickest path looks like to duplicate the code as it was
>> done in the original version from Hemanth...
> yes, i dont like it but i think this is a rare case where this will cause
> fewer problems
> also the code in libavcodec should be marked as deprecated as soon as possible
> [...]

To clarify:

* The filter will wrap the existing av_audio_convert_alloc and
av_audio_convert functions to do the sample format conversion.
* It will duplicate (and extend) the code for channel mixing.

Also, I was wondering if it makes sense to split this filter into two:

1. af_reformat - which wraps the sample format conversion functions
listed above and is auto-inserted between filters not having a common
sample format and

2. af_chmix - which will duplicate and extend the channel mixing
routines. We can make this filter accept integer or float sample formats
and then process data through fixed and floating point mixing routines
accordingly. This filter can then be improved without affecting the
af_reformat which seems to be needed to write most other audio filters.


More information about the ffmpeg-devel mailing list