[FFmpeg-devel] [RFC] libavfilter audio API and related issues

Stefano Sabatini stefano.sabatini-lala
Wed Jun 2 10:34:01 CEST 2010

On date Wednesday 2010-06-02 06:29:48 +0000, S.N. Hemanth Meenakshisundaram encoded:
> Hi All,
> I am working on the audio structures and functions. Keeping parameters like # of
> channels at the buffer level as Michael recommended above. I have a couple of
> questions at this point:
> 1. I need to use functions like avcodec_channel_layout_num_channels() from
> audioconvert.c and avcodec_channel_layout_num_channels() from resample.c
> Is it ok to define new functions in libavfilter since we eventually hope to
> replace resample.c etc and also lavfi shouldn't be dependent on lavc. Please let
> me know if I should call existing functions instead.

I don't think this is currently a problem, lavfi already depends on
lavc, we'll get rid of the dependencies when we'll have a replacement
for resample.c (libavresample?). And the audio conversion API is
already messed up enough (audioconvert, resample, resample2...), no
need to add more meat.

> 2. If supported sample formats differ between adjacent filters, I am
> automatically inserting a resampling filter in between just as a scaling filter
> is inserted for video. But how should differences in supported channel layouts
> be handled? Should this be left to individual filters to decide?

An idea would be to make each audio filter support a set of channel
layouts, which could be specified in an array. When a conversion is
needed, one or more conversion/resampling filters are inserted which
will convert the sample format and/or will change the channel layout.

Such conversion may be performed either by a single filter or by two
separate filters (a resampler and an audio channel layout converter).

FFmpeg = Free and Foolish Multimedia Powerful Elected Generator

More information about the ffmpeg-devel mailing list