]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/resample.c
add assert to clarify that we know what we are doing
[ffmpeg] / libavcodec / resample.c
index 63371b0a1d8b9b0fc41d2d033be5f6a69e503853..66bb8dc45e1b86e850e19b567cc4c29073133589 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
@@ -124,30 +124,29 @@ static void ac3_5p1_mux(short *output, short *input1, short *input2, int n)
     }
 }
 
-ReSampleContext *audio_resample_init(int output_channels, int input_channels, 
+ReSampleContext *audio_resample_init(int output_channels, int input_channels,
                                       int output_rate, int input_rate)
 {
     ReSampleContext *s;
-    int i;
-    
+
     if ( input_channels > 2)
       {
-       av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than 2 unsupported.");
-       return NULL;
+        av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than 2 unsupported.");
+        return NULL;
       }
 
     s = av_mallocz(sizeof(ReSampleContext));
     if (!s)
       {
-       av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.");
-       return NULL;
+        av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.");
+        return NULL;
       }
 
     s->ratio = (float)output_rate / (float)input_rate;
-    
+
     s->input_channels = input_channels;
     s->output_channels = output_channels;
-    
+
     s->filter_channels = s->input_channels;
     if (s->output_channels < s->filter_channels)
         s->filter_channels = s->output_channels;
@@ -160,8 +159,8 @@ ReSampleContext *audio_resample_init(int output_channels, int input_channels,
     if(s->filter_channels>2)
       s->filter_channels = 2;
 
-    s->resample_context= av_resample_init(output_rate, input_rate);
-    
+    s->resample_context= av_resample_init(output_rate, input_rate, 16, 10, 0, 1.0);
+
     return s;
 }
 
@@ -187,7 +186,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
         memcpy(bufin[i], s->temp[i], s->temp_len * sizeof(short));
         buftmp2[i] = bufin[i] + s->temp_len;
     }
-    
+
     /* make some zoom to avoid round pb */
     lenout= (int)(nb_samples * s->ratio) + 16;
     bufout[0]= (short*) av_malloc( lenout * sizeof(short) );