[FFmpeg-devel] [PATCH] Implement av_samples_fill_arrays().
Stefano Sabatini
stefano.sabatini-lala
Sat Jan 15 19:24:01 CET 2011
On date Saturday 2011-01-15 14:24:35 +0100, Michael Niedermayer encoded:
> On Sat, Jan 15, 2011 at 02:27:03AM +0100, Stefano Sabatini wrote:
> > ---
> > libavcore/audioconvert.c | 14 ++++++++++++++
> > libavcore/audioconvert.h | 21 +++++++++++++++++++++
> > 2 files changed, 35 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavcore/audioconvert.c b/libavcore/audioconvert.c
> > index 1c6a511..7a46a3e 100644
> > --- a/libavcore/audioconvert.c
> > +++ b/libavcore/audioconvert.c
> > @@ -166,3 +166,17 @@ int av_samples_fill_pointers(uint8_t *pointers[8], uint8_t *buf, int buf_size,
> >
> > return per_channel_size / sample_size;
> > }
> > +
> > +int av_samples_fill_arrays(uint8_t *data[8], int linesizes[8],
> > + uint8_t *buf, int buf_size,
> > + enum AVSampleFormat sample_fmt, int planar,
> > + int64_t channel_layout, int nb_channels)
> > +{
>
> again channel_layout has nothing to do with what the code does
Of course, so now I wonder if libavcore/samples.h is a better place
for this API.
Now it is:
int av_samples_fill_linesizes(int linesizes[8], enum AVSampleFormat sample_fmt,
int planar, int nb_channels);
int av_samples_fill_pointers(uint8_t *pointers[8], uint8_t *buf, int buf_size,
enum AVSampleFormat sample_fmt, int planar,
int nb_channels);
int av_samples_fill_arrays(uint8_t *data[8], int linesizes[8],
uint8_t *buf, int buf_size,
enum AVSampleFormat sample_fmt, int planar,
int nb_channels);
This is useful for factorizing code in
avfilter_default_get_audio_buffer() (see attached patch) and in
avfilter_get_audio_buffer_ref_from_buffer().
I can eventually merge the implementation of the three functions in
av_samples_fill_arrays(), since currently there is not the need of two
separate av_samples_fill_linesizes/pointers functions.
Please comment on this API.
Usage sample attached.
--
FFmpeg = Fierce & Fast Multipurpose Picky Everlasting Gigant
More information about the ffmpeg-devel
mailing list