[FFmpeg-devel] [PATCH] swresample: Add AVFrame based API

Michael Niedermayer michaelni at gmx.at
Mon Aug 11 21:53:34 CEST 2014


On Mon, Aug 11, 2014 at 10:02:54AM +0200, Clément Bœsch wrote:
> On Mon, Aug 11, 2014 at 01:49:19AM +0200, Michael Niedermayer wrote:
> > From: Luca Barbato <lu_zero at gentoo.org>
> > 
> > TODO:bump
> > 
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libswresample/Makefile           |    1 +
> >  libswresample/swresample.h       |   61 +++++++++++++++
> >  libswresample/swresample_frame.c |  158 ++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 220 insertions(+)
> >  create mode 100644 libswresample/swresample_frame.c
> > 
> [...]
> > +/**
> > + * Convert the samples in the input AVFrame and write them to the output AVFrame.
> > + *
> > + * Input and output AVFrames must have channel_layout, sample_rate and format set.
> > + *
> > + * If the output AVFrame does not have the data pointers allocated the nb_samples
> > + * field will be set using av_frame_get_buffer()
> > + * is called to allocate the frame.
> > + *
> > + * The output AVFrame can be NULL or have fewer allocated samples than required.
> > + * In this case, any remaining samples not written to the output will be added
> > + * to an internal FIFO buffer, to be returned at the next call to this function
> > + * or to swr_convert() or to swr_convert_frame().
> > + *
> > + * If converting sample rate, there may be data remaining in the internal
> > + * resampling delay buffer. swr_get_delay() tells the number of
> > + * remaining samples. To get this data as output, call this function or
> > + * swr_convert() with NULL input.
> > + *
> > + * If the SwrContext configuration does not match the output and
> > + * input AVFrame settings the conversion does not take place and depending on
> > + * which AVFrame is not matching AVERROR_OUTPUT_CHANGED, AVERROR_INPUT_CHANGED
> > + * or AVERROR_OUTPUT_CHANGED|AVERROR_INPUT_CHANGED is returned.
> > + *
> > + * @see swr_delay()
> > + * @see swr_convert()
> > + * @see swr_get_delay()
> > + *
> > + * @param swr             audio resample context
> > + * @param output          output AVFrame
> > + * @param input           input AVFrame
> > + * @return                0 on success, AVERROR on failure or nonmatching
> > + *                        configuration.
> > + */
> > +int swr_convert_frame(SwrContext *swr,
> > +                      AVFrame *output, AVFrame *input);
> > +
> 
> Is it possible to have input AVFrame const or it needs to increment
> references or something?

yes works, changed

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140811/5b318738/attachment.asc>


More information about the ffmpeg-devel mailing list