]> git.sesse.net Git - ffmpeg/blobdiff - libswresample/swresample.h
swr: use memcpy when input and output match
[ffmpeg] / libswresample / swresample.h
index 64b9aacd259ff6132678636195be8cf069dd52ab..137517d6d2935b19154fe65ac95388d7fcfec727 100644 (file)
 #include "libavutil/samplefmt.h"
 
 #define LIBSWRESAMPLE_VERSION_MAJOR 0
-#define LIBSWRESAMPLE_VERSION_MINOR 9
+#define LIBSWRESAMPLE_VERSION_MINOR 11
 #define LIBSWRESAMPLE_VERSION_MICRO 100
 
 #define LIBSWRESAMPLE_VERSION_INT  AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
                                                   LIBSWRESAMPLE_VERSION_MINOR, \
                                                   LIBSWRESAMPLE_VERSION_MICRO)
 
+#if LIBSWRESAMPLE_VERSION_MAJOR < 1
 #define SWR_CH_MAX 32   ///< Maximum number of channels
+#endif
 
 #define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate
 //TODO use int resample ?
 //long term TODO can we enable this dynamically?
 
+enum SwrDitherType {
+    SWR_DITHER_NONE = 0,
+    SWR_DITHER_RECTANGULAR,
+    SWR_DITHER_TRIANGULAR,
+    SWR_DITHER_TRIANGULAR_HIGHPASS,
+    SWR_DITHER_NB,              ///< not part of API/ABI
+};
 
 typedef struct SwrContext SwrContext;
 
+/**
+ * Get the AVClass for swrContext. It can be used in combination with
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
+ *
+ * @see av_opt_find().
+ */
+const AVClass *swr_get_class(void);
+
 /**
  * Allocate SwrContext.
  *
@@ -100,6 +117,10 @@ void swr_free(struct SwrContext **s);
  * in and in_count can be set to 0 to flush the last few samples out at the
  * end.
  *
+ * If more input is provided than output space then the input will be buffered.
+ * You can avoid this buffering by providing more output space than input.
+ * Convertion will run directly without copying whenever possible.
+ *
  * @param s         allocated Swr context, with parameters set
  * @param out       output buffers, only the first one need be set in case of packed audio
  * @param out_count amount of space available for output in samples per channel
@@ -108,8 +129,8 @@ void swr_free(struct SwrContext **s);
  *
  * @return number of samples output per channel, negative value on error
  */
-int swr_convert(struct SwrContext *s, uint8_t *out[SWR_CH_MAX], int out_count,
-                                const uint8_t *in [SWR_CH_MAX], int in_count);
+int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
+                                const uint8_t **in , int in_count);
 
 /**
  * Activate resampling compensation.