Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-11 03:43:26 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-08-16 22:39:37 +0400
commitb7d5e016a3f3b2c60f8dc6725ab9628ef58a7644 (patch)
tree38141862e08783af9834cbde6c110339a5b87ab5 /libswresample/swresample.h
parent3574d34aca9dfac28d61bd783a7aa9b4c2d736f0 (diff)
swresample: Add AVFrame based API
Based on commit fb1ddcdc8f51b9d261ae8e9c26b91e81f7b6bf45 by Luca Barbato <lu_zero@gentoo.org> Adapted for libswresample by Michael Niedermayer Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/swresample.h')
-rw-r--r--libswresample/swresample.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/libswresample/swresample.h b/libswresample/swresample.h
index 4b8b0451ee..37656a667d 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().
+ *
+ * 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 the result of a bitwise-OR of them 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, const 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_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in);
+
+/**
+ * @}
* @}
*/