[FFmpeg-cvslog] swr: make audio convert code explicitely private.

Clément Bœsch git at videolan.org
Thu Nov 17 10:21:48 CET 2011


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Wed Nov 16 08:00:31 2011 +0100| [fc6351d019047ecd8f2fcd0a5aadedfac9fc617b] | committer: Clément Bœsch

swr: make audio convert code explicitely private.

Only what's declared in libswresample/swresample.h is public.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fc6351d019047ecd8f2fcd0a5aadedfac9fc617b
---

 libswresample/audioconvert.c        |   18 +++++++++---------
 libswresample/audioconvert.h        |   16 ++++++++--------
 libswresample/swresample.c          |   30 +++++++++++++++---------------
 libswresample/swresample_internal.h |    6 +++---
 4 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/libswresample/audioconvert.c b/libswresample/audioconvert.c
index 268d276..845c9c0 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 AudioConvert {
     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)
+AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt,
+                                       enum AVSampleFormat in_fmt,
+                                       int channels, const int *ch_map,
+                                       int flags)
 {
-    AVAudioConvert *ctx;
+    AudioConvert *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 swri_audio_convert_free(AudioConvert **ctx)
 {
     av_freep(ctx);
 }
 
-int swr_audio_convert(AVAudioConvert *ctx, AudioData *out, AudioData*in, int len)
+int swri_audio_convert(AudioConvert *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..6d09271 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 AudioConvert;
+typedef struct AudioConvert AudioConvert;
 
 /**
  * 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);
+AudioConvert *swri_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 swri_audio_convert_free(AudioConvert **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 swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len);
 
 #endif /* AUDIOCONVERT_H */
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index cec577e..5a98ac5 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -119,9 +119,9 @@ void swr_free(SwrContext **ss){
         free_temp(&s->midbuf);
         free_temp(&s->preout);
         free_temp(&s->in_buffer);
-        swr_audio_convert_free(&s-> in_convert);
-        swr_audio_convert_free(&s->out_convert);
-        swr_audio_convert_free(&s->full_convert);
+        swri_audio_convert_free(&s-> in_convert);
+        swri_audio_convert_free(&s->out_convert);
+        swri_audio_convert_free(&s->full_convert);
         swr_resample_free(&s->resample);
     }
 
@@ -136,9 +136,9 @@ int swr_init(SwrContext *s){
     free_temp(&s->midbuf);
     free_temp(&s->preout);
     free_temp(&s->in_buffer);
-    swr_audio_convert_free(&s-> in_convert);
-    swr_audio_convert_free(&s->out_convert);
-    swr_audio_convert_free(&s->full_convert);
+    swri_audio_convert_free(&s-> in_convert);
+    swri_audio_convert_free(&s->out_convert);
+    swri_audio_convert_free(&s->full_convert);
 
     s-> in.planar= s-> in_sample_fmt >= 0x100;
     s->out.planar= s->out_sample_fmt >= 0x100;
@@ -209,15 +209,15 @@ av_assert0(s->out.ch_count);
     s->out.bps= av_get_bytes_per_sample(s->out_sample_fmt);
 
     if(!s->resample && !s->rematrix && !s->channel_map){
-        s->full_convert = swr_audio_convert_alloc(s->out_sample_fmt,
-                                                  s-> in_sample_fmt, s-> in.ch_count, NULL, 0);
+        s->full_convert = swri_audio_convert_alloc(s->out_sample_fmt,
+                                                   s-> in_sample_fmt, s-> in.ch_count, NULL, 0);
         return 0;
     }
 
-    s->in_convert = swr_audio_convert_alloc(s->int_sample_fmt,
-                                            s-> in_sample_fmt, s->used_ch_count, s->channel_map, 0);
-    s->out_convert= swr_audio_convert_alloc(s->out_sample_fmt,
-                                            s->int_sample_fmt, s->out.ch_count, NULL, 0);
+    s->in_convert = swri_audio_convert_alloc(s->int_sample_fmt,
+                                             s-> in_sample_fmt, s->used_ch_count, s->channel_map, 0);
+    s->out_convert= swri_audio_convert_alloc(s->out_sample_fmt,
+                                             s->int_sample_fmt, s->out.ch_count, NULL, 0);
 
 
     s->postin= s->in;
@@ -335,7 +335,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
 
     if(s->full_convert){
         av_assert0(!s->resample);
-        swr_audio_convert(s->full_convert, out, in, in_count);
+        swri_audio_convert(s->full_convert, out, in, in_count);
         return out_count;
     }
 
@@ -385,7 +385,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
     }
 
     if(in != postin){
-        swr_audio_convert(s->in_convert, postin, in, in_count);
+        swri_audio_convert(s->in_convert, postin, in, in_count);
     }
 
     if(s->resample_first){
@@ -402,7 +402,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
 
     if(preout != out){
 //FIXME packed doesnt need more than 1 chan here!
-        swr_audio_convert(s->out_convert, out, preout, out_count);
+        swri_audio_convert(s->out_convert, out, preout, out_count);
     }
     if(!in_arg)
         s->in_buffer_count = 0;
diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
index 4764ddf..460a753 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 AudioConvert *in_convert;
+    struct AudioConvert *out_convert;
+    struct AudioConvert *full_convert;
     struct AVResampleContext *resample;
 
     float matrix[SWR_CH_MAX][SWR_CH_MAX];



More information about the ffmpeg-cvslog mailing list