Browse code

swr: drop 'AV' prefix from ResampleContext.

This type/struct is not part of the public API.

Clément Bœsch authored on 2011/11/16 16:06:42
Showing 2 changed files
... ...
@@ -56,7 +56,7 @@
56 56
 #endif
57 57
 
58 58
 
59
-typedef struct AVResampleContext{
59
+typedef struct ResampleContext {
60 60
     const AVClass *av_class;
61 61
     FELEM *filter_bank;
62 62
     int filter_length;
... ...
@@ -70,7 +70,7 @@ typedef struct AVResampleContext{
70 70
     int phase_mask;
71 71
     int linear;
72 72
     double factor;
73
-}AVResampleContext;
73
+} ResampleContext;
74 74
 
75 75
 /**
76 76
  * 0th order modified bessel function of the first kind.
... ...
@@ -199,13 +199,13 @@ static int build_filter(FELEM *filter, double factor, int tap_count, int phase_c
199 199
     return 0;
200 200
 }
201 201
 
202
-AVResampleContext *swr_resample_init(AVResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
202
+ResampleContext *swr_resample_init(ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
203 203
     double factor= FFMIN(out_rate * cutoff / in_rate, 1.0);
204 204
     int phase_count= 1<<phase_shift;
205 205
 
206 206
     if (!c || c->phase_shift != phase_shift || c->linear!=linear || c->factor != factor
207 207
            || c->filter_length != FFMAX((int)ceil(filter_size/factor), 1)) {
208
-        c = av_mallocz(sizeof(AVResampleContext));
208
+        c = av_mallocz(sizeof(*c));
209 209
         if (!c)
210 210
             return NULL;
211 211
 
... ...
@@ -238,7 +238,7 @@ error:
238 238
     return NULL;
239 239
 }
240 240
 
241
-void swr_resample_free(AVResampleContext **c){
241
+void swr_resample_free(ResampleContext **c){
242 242
     if(!*c)
243 243
         return;
244 244
     av_freep(&(*c)->filter_bank);
... ...
@@ -246,13 +246,13 @@ void swr_resample_free(AVResampleContext **c){
246 246
 }
247 247
 
248 248
 void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_distance){
249
-    AVResampleContext *c= s->resample;
249
+    ResampleContext *c= s->resample;
250 250
 //    sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;
251 251
     c->compensation_distance= compensation_distance;
252 252
     c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;
253 253
 }
254 254
 
255
-int swr_resample(AVResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx){
255
+int swr_resample(ResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx){
256 256
     int dst_index, i;
257 257
     int index= c->index;
258 258
     int frac= c->frac;
... ...
@@ -341,7 +341,7 @@ av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->comp
341 341
     return dst_index;
342 342
 }
343 343
 
344
-int swr_multiple_resample(AVResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){
344
+int swr_multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){
345 345
     int i, ret= -1;
346 346
 
347 347
     for(i=0; i<dst->ch_count; i++){
... ...
@@ -61,7 +61,7 @@ typedef struct SwrContext {          //FIXME find unused fields
61 61
     struct AudioConvert *in_convert;
62 62
     struct AudioConvert *out_convert;
63 63
     struct AudioConvert *full_convert;
64
-    struct AVResampleContext *resample;
64
+    struct ResampleContext *resample;
65 65
 
66 66
     float matrix[SWR_CH_MAX][SWR_CH_MAX];
67 67
     int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX];
... ...
@@ -70,11 +70,11 @@ typedef struct SwrContext {          //FIXME find unused fields
70 70
     //TODO callbacks for asm optims
71 71
 }SwrContext;
72 72
 
73
-struct AVResampleContext *swr_resample_init(struct AVResampleContext *, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
74
-void swr_resample_free(struct AVResampleContext **c);
75
-int swr_multiple_resample(struct AVResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
76
-void swr_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
77
-int swr_resample(struct AVResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx);
73
+struct ResampleContext *swr_resample_init(struct ResampleContext *, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
74
+void swr_resample_free(struct ResampleContext **c);
75
+int swr_multiple_resample(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
76
+void swr_resample_compensate(struct ResampleContext *c, int sample_delta, int compensation_distance);
77
+int swr_resample(struct ResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx);
78 78
 
79 79
 int swr_rematrix_init(SwrContext *s);
80 80
 int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy);