]> git.sesse.net Git - ffmpeg/commitdiff
swr: rename swr_alloc2() to swr_alloc_set_opts().
authorClément Bœsch <ubitux@gmail.com>
Wed, 16 Nov 2011 18:43:58 +0000 (19:43 +0100)
committerClément Bœsch <ubitux@gmail.com>
Thu, 17 Nov 2011 09:16:07 +0000 (10:16 +0100)
ffmpeg.c
ffplay.c
libswresample/swresample.c
libswresample/swresample.h
libswresample/swresample_test.c

index 3d1185c3f73a49fcbf888533170d782fc069028e..b6643399348c01c309a4287a35fba0157b9766c2 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -891,11 +891,11 @@ need_realloc:
             //ost->swr = NULL;
             ost->audio_resample = 0;
         } else {
-            ost->swr = swr_alloc2(ost->swr,
-                                  enc->channel_layout, enc->sample_fmt, enc->sample_rate,
-                                  dec->channel_layout, dec->sample_fmt, dec->sample_rate,
-                                  ost->audio_channels_mapped ? ost->audio_channels_map : NULL,
-                                  0, NULL);
+            ost->swr = swr_alloc_set_opts(ost->swr,
+                                          enc->channel_layout, enc->sample_fmt, enc->sample_rate,
+                                          dec->channel_layout, dec->sample_fmt, dec->sample_rate,
+                                          ost->audio_channels_mapped ? ost->audio_channels_map : NULL,
+                                          0, NULL);
             av_opt_set_double(ost->swr, "rmvol", ost->rematrix_volume, 0);
             if (ost->audio_channels_mapped) {
                 av_opt_set_int(ost->swr, "icl", av_get_default_channel_layout(ost->audio_channels_mapped), 0);
index 5cc4fa42582bcaf25ca18546b214f38fe3ecc521..8022be504cc99a05780232ed313bae7b02a64d88 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -2076,9 +2076,10 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
             if (dec->sample_fmt != is->audio_src_fmt || dec_channel_layout != is->audio_src_channel_layout || dec->sample_rate != is->audio_src_freq) {
                 if (is->swr_ctx)
                     swr_free(&is->swr_ctx);
-                is->swr_ctx = swr_alloc2(NULL, is->audio_tgt_channel_layout, is->audio_tgt_fmt, is->audio_tgt_freq,
-                                               dec_channel_layout,          dec->sample_fmt,   dec->sample_rate,
-                                               NULL, 0, NULL);
+                is->swr_ctx = swr_alloc_set_opts(NULL,
+                                                 is->audio_tgt_channel_layout, is->audio_tgt_fmt, is->audio_tgt_freq,
+                                                 dec_channel_layout,           dec->sample_fmt,   dec->sample_rate,
+                                                 NULL, 0, NULL);
                 if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) {
                     fprintf(stderr, "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
                         dec->sample_rate,
index 0a2aa9540f8252ad6934b90f96ca4b4a9718c107..88dacd69109ae961ae902e8dff42533ce803c5f8 100644 (file)
@@ -82,9 +82,10 @@ SwrContext *swr_alloc(void){
     return s;
 }
 
-SwrContext *swr_alloc2(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
-                       int64_t  in_ch_layout, enum AVSampleFormat  in_sample_fmt, int  in_sample_rate,
-                       const int *channel_map, int log_offset, void *log_ctx){
+SwrContext *swr_alloc_set_opts(struct SwrContext *s,
+                               int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
+                               int64_t  in_ch_layout, enum AVSampleFormat  in_sample_fmt, int  in_sample_rate,
+                               const int *channel_map, int log_offset, void *log_ctx){
     if(!s) s= swr_alloc();
     if(!s) return NULL;
 
index f72715b1527e69cee7c3d91edbbae0ee17bfdb4f..bd45edc674e7e5a08f8777157f13518a7152b08f 100644 (file)
@@ -55,9 +55,10 @@ int swr_init(struct SwrContext *s);
  * @see swr_init(),swr_free()
  * @return NULL on error
  */
-struct SwrContext *swr_alloc2(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
-                              int64_t  in_ch_layout, enum AVSampleFormat  in_sample_fmt, int  in_sample_rate,
-                              const int *channel_map, int log_offset, void *log_ctx);
+struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
+                                      int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
+                                      int64_t  in_ch_layout, enum AVSampleFormat  in_sample_fmt, int  in_sample_rate,
+                                      const int *channel_map, int log_offset, void *log_ctx);
 
 /**
  * Free the given SwrContext.
index 1a37bcd5d218c27c4bb1bc79523509003034434c..037c91eb90d7c2c608f2c0f05d9a217a30711759 100644 (file)
@@ -130,12 +130,12 @@ int main(int argc, char **argv){
                                in_ch_count, out_ch_count,
                                in_sample_rate, out_sample_rate,
                                av_get_sample_fmt_name(in_sample_fmt), av_get_sample_fmt_name(out_sample_fmt));
-                        forw_ctx  = swr_alloc2(forw_ctx, out_ch_layout, out_sample_fmt+planar_out, out_sample_rate,
-                                                          in_ch_layout,  in_sample_fmt+planar_in ,  in_sample_rate,
-                                                          NULL, 0, 0);
-                        backw_ctx = swr_alloc2(backw_ctx,in_ch_layout,  in_sample_fmt,             in_sample_rate,
-                                                        out_ch_layout, out_sample_fmt+planar_out, out_sample_rate,
-                                                        NULL, 0, 0);
+                        forw_ctx  = swr_alloc_set_opts(forw_ctx, out_ch_layout, out_sample_fmt+planar_out, out_sample_rate,
+                                                                  in_ch_layout,  in_sample_fmt+planar_in ,  in_sample_rate,
+                                                       NULL, 0, 0);
+                        backw_ctx = swr_alloc_set_opts(backw_ctx, in_ch_layout,  in_sample_fmt,             in_sample_rate,
+                                                                 out_ch_layout, out_sample_fmt+planar_out, out_sample_rate,
+                                                       NULL, 0, 0);
                         if(swr_init( forw_ctx) < 0)
                             fprintf(stderr, "swr_init(->) failed\n");
                         if(swr_init(backw_ctx) < 0)