[FFmpeg-devel] [PATCH] samplefmt: change syntax for av_samples_alloc() and av_samples_fill_arrays()
Stefano Sabatini
stefano.sabatini-lala at poste.it
Mon May 23 19:48:53 CEST 2011
On date Monday 2011-05-23 16:51:25 +0200, Stefano Sabatini encoded:
> On date Monday 2011-05-23 15:15:31 +0200, Reimar Döffinger encoded:
> > On Mon, May 23, 2011 at 12:14:19AM +0200, Stefano Sabatini wrote:
> > > ---
> > > libavutil/samplefmt.c | 34 ++++++++++++++++++----------------
> > > libavutil/samplefmt.h | 26 ++++++++++++++++----------
> > > 2 files changed, 34 insertions(+), 26 deletions(-)
> > >
> > > diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
> > > index ea004d9..346e44e 100644
> > > --- a/libavutil/samplefmt.c
> > > +++ b/libavutil/samplefmt.c
> > > @@ -73,31 +73,29 @@ int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt)
> > > }
> > >
> > > int av_samples_fill_arrays(uint8_t *pointers[8], int linesizes[8],
> > > - uint8_t *buf, int nb_channels, int nb_samples,
> > > - enum AVSampleFormat sample_fmt, int planar, int align)
> > > + uint8_t *buf, int linesize0, int nb_channels,
> > > + enum AVSampleFormat sample_fmt, int planar)
> >
> > The name indicates that av_samples_fill_arrays is a public function, and this
> > would then be an API/ABI change...
>
> Yes indeed it was prematurely committed, but I have no problem at
>
> I retreat the patch for now, since I didn't explain clearly the reason
> for it, sorry for the noise.
Elaborating more: this patches is basically changing the layout of the
samples buffer.
My objective is getting a layout as similiar as possible with that of
the video buffer.
So this was my idea:
pointers -> contain pointers to each samples plane
linesizes -> the linesize of each plane
This looks simpler and generally easier to manage.
Currently we have:
* data[c] points to the first sample of channel c.
* data[c] + linesize[0] points to the second sample of channel c
This has a slight advantage for accessing the samples for each channel
c, but it has the disadvantage that:
* misuse the term "linesize" (with a different semantics depending on
planar/packed mode)
* creates an asymmetry between audio and video data layout
As for the current signature:
int av_samples_fill_arrays(uint8_t *pointers[8], int linesizes[8],
uint8_t *buf, int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int planar,
int align);
it looks fine and I can't remember why I had this linesize0 idea.
--
FFmpeg = Free and Fundamentalist Mournful Peaceless Elaborated God
More information about the ffmpeg-devel
mailing list