[FFmpeg-devel] [RFC] libavfilter audio API and related issues
Stefano Sabatini
stefano.sabatini-lala
Mon Apr 5 19:49:14 CEST 2010
On date Monday 2010-04-05 16:54:18 +0200, Michael Niedermayer encoded:
> only a few quick comments
>
> On Mon, Apr 05, 2010 at 01:55:43PM +0200, Stefano Sabatini wrote:
> > Follow some notes about a possible design for the audio support in
> > libavfilter.
> >
> > AVFilterSamples struct
> > ======================
> >
> > (Already defined in afilters, but renamed AVFilterBuffer at some
> > point.)
> >
> > Follows a possible definition (with some differences whit respect to
> > that currently implemented in afilters):
> >
> > typedef struct AVFilterSamples
> > {
> > uint8_t *data;
>
> missing suport for planar formats
> also the structs are very similar to existing structs, do we really
> want new structs for each stream type?
> file position missing, it was possibly added later to the video
> structs and forgotten to be added to audio because it has seperate
> structs
I see the point, but then there are some specific fields which are
only meaningful for audio (sample_rate) and video (w, h, pixel_aspect).
Also data[4]/linesize[4] is going to work only with samples with no
more than four channel, av_audio_convert supports up to 6 channels.
Also we may need more enum SampleFormat, now we have (avcodec.h):
/**
* all in native-endian format
*/
enum SampleFormat {
SAMPLE_FMT_NONE = -1,
SAMPLE_FMT_U8, ///< unsigned 8 bits
SAMPLE_FMT_S16, ///< signed 16 bits
SAMPLE_FMT_S32, ///< signed 32 bits
SAMPLE_FMT_FLT, ///< float
SAMPLE_FMT_DBL, ///< double
SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
};
I wonder if we should support LE/BE variants like it is done with PCM
CODEC_ID_* and for enum PixelFormat.
Following the simplest path (distinct struct for
AVFilterPic/AVFilterSamples):
typedef struct AVFilterSamples
{
uint8_t *data[6];
int linesize[6];
enum SampleFormat format;
unsigned refcount;
/** private data to be used by a custom free function */
void *priv;
void (*free)(struct AVFilterSamples *samples);
} AVFilterSamples;
typedef struct AVFilterSamplesRef
{
AVFilterSamples *samples;
uint8_t *data[6]; ///< samples data
unsigned linesize[6];
int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE
int64_t pos; ///< byte position in stream, -1 if unknown
unsigned sample_rate; ///< number of sampler per second
int perms; ///< permissions
} AVFilterSamplesRef;
This should allow to support packed/planar format with up to six
channels.
[...]
Regards.
--
FFmpeg = Fostering Fast Maxi Powerful Erudite Gargoyle
More information about the ffmpeg-devel
mailing list