[FFmpeg-devel] [PATCH 02/10] swr: rename AVAudioConvert to SwrAudioConvert.

Clément Bœsch ubitux at gmail.com
Wed Nov 16 21:50:49 CET 2011


Use public libswresample struct prefix for consistency purpose. This
also avoid the confusion with the old audio convert code.
---
 libswresample/audioconvert.c        |   18 +++++++++---------
 libswresample/audioconvert.h        |   16 ++++++++--------
 libswresample/swresample_internal.h |    6 +++---
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/libswresample/audioconvert.c b/libswresample/audioconvert.c
index 268d276..fd49b44 100644
--- a/libswresample/audioconvert.c
+++ b/libswresample/audioconvert.c
@@ -34,7 +34,7 @@
 
 typedef void (conv_func_type)(uint8_t *po, const uint8_t *pi, int is, int os, uint8_t *end);
 
-struct AVAudioConvert {
+struct SwrAudioConvert {
     int channels;
     conv_func_type *conv_f;
     const int *ch_map;
@@ -108,17 +108,17 @@ conv_func_type *fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB*AV_SAMPLE_FMT_NB] =
     FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL),
 };
 
-AVAudioConvert *swr_audio_convert_alloc(enum AVSampleFormat out_fmt,
-                                        enum AVSampleFormat in_fmt,
-                                        int channels, const int *ch_map,
-                                        int flags)
+SwrAudioConvert *swr_audio_convert_alloc(enum AVSampleFormat out_fmt,
+                                         enum AVSampleFormat in_fmt,
+                                         int channels, const int *ch_map,
+                                         int flags)
 {
-    AVAudioConvert *ctx;
+    SwrAudioConvert *ctx;
     conv_func_type *f = fmt_pair_to_conv_functions[out_fmt + AV_SAMPLE_FMT_NB*in_fmt];
 
     if (!f)
         return NULL;
-    ctx = av_malloc(sizeof(AVAudioConvert));
+    ctx = av_malloc(sizeof(*ctx));
     if (!ctx)
         return NULL;
     ctx->channels = channels;
@@ -127,12 +127,12 @@ AVAudioConvert *swr_audio_convert_alloc(enum AVSampleFormat out_fmt,
     return ctx;
 }
 
-void swr_audio_convert_free(AVAudioConvert **ctx)
+void swr_audio_convert_free(SwrAudioConvert **ctx)
 {
     av_freep(ctx);
 }
 
-int swr_audio_convert(AVAudioConvert *ctx, AudioData *out, AudioData*in, int len)
+int swr_audio_convert(SwrAudioConvert *ctx, AudioData *out, AudioData*in, int len)
 {
     int ch;
     const uint8_t null_input[8] = {0};
diff --git a/libswresample/audioconvert.h b/libswresample/audioconvert.h
index 6909a05..3b594af 100644
--- a/libswresample/audioconvert.h
+++ b/libswresample/audioconvert.h
@@ -33,8 +33,8 @@
 #include "libavutil/cpu.h"
 #include "libavutil/audioconvert.h"
 
-struct AVAudioConvert;
-typedef struct AVAudioConvert AVAudioConvert;
+struct SwrAudioConvert;
+typedef struct SwrAudioConvert SwrAudioConvert;
 
 /**
  * Create an audio sample format converter context
@@ -46,16 +46,16 @@ typedef struct AVAudioConvert AVAudioConvert;
  *               if all channels must be selected
  * @return NULL on error
  */
-AVAudioConvert *swr_audio_convert_alloc(enum AVSampleFormat out_fmt,
-                                        enum AVSampleFormat in_fmt,
-                                        int channels, const int *ch_map,
-                                        int flags);
+SwrAudioConvert *swr_audio_convert_alloc(enum AVSampleFormat out_fmt,
+                                         enum AVSampleFormat in_fmt,
+                                         int channels, const int *ch_map,
+                                         int flags);
 
 /**
  * Free audio sample format converter context.
  * and set the pointer to NULL
  */
-void swr_audio_convert_free(AVAudioConvert **ctx);
+void swr_audio_convert_free(SwrAudioConvert **ctx);
 
 /**
  * Convert between audio sample formats
@@ -63,6 +63,6 @@ void swr_audio_convert_free(AVAudioConvert **ctx);
  * @param[in] in array of input buffers for each channel
  * @param len length of audio frame size (measured in samples)
  */
-int swr_audio_convert(AVAudioConvert *ctx, AudioData *out, AudioData *in, int len);
+int swr_audio_convert(SwrAudioConvert *ctx, AudioData *out, AudioData *in, int len);
 
 #endif /* AUDIOCONVERT_H */
diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
index 4764ddf..0040bfa 100644
--- a/libswresample/swresample_internal.h
+++ b/libswresample/swresample_internal.h
@@ -58,9 +58,9 @@ typedef struct SwrContext {          //FIXME find unused fields
     int in_buffer_count;
     int resample_in_constraint;
 
-    struct AVAudioConvert *in_convert;
-    struct AVAudioConvert *out_convert;
-    struct AVAudioConvert *full_convert;
+    struct SwrAudioConvert *in_convert;
+    struct SwrAudioConvert *out_convert;
+    struct SwrAudioConvert *full_convert;
     struct AVResampleContext *resample;
 
     float matrix[SWR_CH_MAX][SWR_CH_MAX];
-- 
1.7.7.3



More information about the ffmpeg-devel mailing list