On 10/08/14 8:49 PM, Michael Niedermayer wrote: > From: Luca Barbato <lu_z...@gentoo.org> > > TODO:bump
APIChanges entry as well > > Signed-off-by: Michael Niedermayer <michae...@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 > > diff --git a/libswresample/Makefile b/libswresample/Makefile > index 75c6535..120ee33 100644 > --- a/libswresample/Makefile > +++ b/libswresample/Makefile > @@ -13,6 +13,7 @@ OBJS = audioconvert.o \ > resample.o \ > resample_dsp.o \ > swresample.o \ > + swresample_frame.o \ > > OBJS-$(CONFIG_LIBSOXR) += soxr_resample.o > OBJS-$(CONFIG_SHARED) += log2_tab.o > diff --git a/libswresample/swresample.h b/libswresample/swresample.h > index 4b8b045..687891b 100644 > --- a/libswresample/swresample.h > +++ b/libswresample/swresample.h > @@ -121,6 +121,7 @@ > */ > > #include <stdint.h> > +#include "libavutil/frame.h" > #include "libavutil/samplefmt.h" > > #include "libswresample/version.h" > @@ -467,6 +468,66 @@ const char *swresample_license(void); > > /** > * @} > + * > + * @name AVFrame based API > + * @{ > + */ > + > +/** > + * 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); > + > +/** > + * Configure or reconfigure the SwrContext using the information > + * provided by the AVFrames. > + * > + * The original resampling context is reset even on failure. > + * The function calls swr_close() internally if the context is open. > + * > + * @see swr_close(); > + * > + * @param swr audio resample context > + * @param output output AVFrame > + * @param input input AVFrame > + * @return 0 on success, AVERROR on failure. > + */ > +int swr_config_by_frames(SwrContext *swr, AVFrame *out, AVFrame *in); Maybe swr_config_frame()? _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel