changeset 24894:2bfc75674b71

Simplify init_audio_filters() arguments Remove the following arguments as redundant: in_channels, in_format, out_minsize, out_maxsize. The first two always equal fields of the sh_audio_t struct given as the first argument to the function. The last two are unused after the allocation of sh_audio->a_out_buffer was changed to be done on demand. After the out_minsize and out_maxsize arguments are removed the function preinit_audio_filters() is identical to init_audio_filters(), so remove it and use the latter instead.
author uau
date Thu, 01 Nov 2007 06:52:28 +0000
parents bc6132465897
children 463e96055996
files libmpcodecs/dec_audio.c libmpcodecs/dec_audio.h mencoder.c mplayer.c
diffstat 4 files changed, 13 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/dec_audio.c	Thu Nov 01 06:52:23 2007 +0000
+++ b/libmpcodecs/dec_audio.c	Thu Nov 01 06:52:28 2007 +0000
@@ -313,19 +313,8 @@
 }
 
 
-int preinit_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
-			  int in_channels, int in_format, int *out_samplerate,
-			  int *out_channels, int *out_format)
-{
-    return init_audio_filters(sh_audio, in_samplerate, in_channels, in_format,
-			      out_samplerate, out_channels, out_format, 0, 0);
-}
-
-
 int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
-		       int in_channels, int in_format, int *out_samplerate,
-		       int *out_channels, int *out_format,
-		       int out_minsize, int out_maxsize)
+		       int *out_samplerate, int *out_channels, int *out_format)
 {
     af_stream_t *afs = sh_audio->afilter;
     if (!afs) {
@@ -334,8 +323,8 @@
     }
     // input format: same as codec's output format:
     afs->input.rate   = in_samplerate;
-    afs->input.nch    = in_channels;
-    afs->input.format = in_format;
+    afs->input.nch    = sh_audio->channels;
+    afs->input.format = sh_audio->sample_format;
     af_fix_parameters(&(afs->input));
 
     // output format: same as ao driver's input format (if missing, fallback to input)
--- a/libmpcodecs/dec_audio.h	Thu Nov 01 06:52:23 2007 +0000
+++ b/libmpcodecs/dec_audio.h	Thu Nov 01 06:52:28 2007 +0000
@@ -7,10 +7,5 @@
 extern void skip_audio_frame(sh_audio_t *sh_audio);
 extern void uninit_audio(sh_audio_t *sh_audio);
 
-extern int init_audio_filters(sh_audio_t *sh_audio, 
-	int in_samplerate, int in_channels, int in_format,
-	int *out_samplerate, int *out_channels, int *out_format,
-	int out_minsize, int out_maxsize);
-extern int preinit_audio_filters(sh_audio_t *sh_audio,
-        int in_samplerate, int in_channels, int in_format,
-        int* out_samplerate, int* out_channels, int* out_format);
+extern int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
+		int *out_samplerate, int *out_channels, int *out_format);
--- a/mencoder.c	Thu Nov 01 06:52:23 2007 +0000
+++ b/mencoder.c	Thu Nov 01 06:52:28 2007 +0000
@@ -914,10 +914,9 @@
 ao_data.samplerate = force_srate;
 ao_data.channels = 0;
 ao_data.format = audio_output_format;
-if(!preinit_audio_filters(sh_audio,
+if(!init_audio_filters(sh_audio,
    // input:
    new_srate,
-   sh_audio->channels, sh_audio->sample_format,
    // output:
    &ao_data.samplerate, &ao_data.channels, &ao_data.format)) {
      mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError);
@@ -932,9 +931,8 @@
     if(!aencoder)
         mencoder_exit(1, NULL);
     if(!init_audio_filters(sh_audio, 
-        new_srate, sh_audio->channels, sh_audio->sample_format,  
-        &aparams.sample_rate, &aparams.channels, &aencoder->input_format, 
-        aencoder->min_buffer_size, aencoder->max_buffer_size)) {
+        new_srate,
+        &aparams.sample_rate, &aparams.channels, &aencoder->input_format)) {
       mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoMatchingFilter);
       mencoder_exit(1,NULL);
     }
@@ -1031,11 +1029,9 @@
 		int out_srate = mux_a->wf->nSamplesPerSec;
 		int out_channels = mux_a->wf->nChannels;
 		int out_format = aencoder->input_format;
-		int out_minsize = aencoder->min_buffer_size;
-		int out_maxsize = aencoder->max_buffer_size;
-		if (!init_audio_filters(sh_audio, new_srate, sh_audio->channels,
-					sh_audio->sample_format, &out_srate, &out_channels,
-					&out_format, out_minsize, out_maxsize)) {
+		if (!init_audio_filters(sh_audio, new_srate,
+					&out_srate, &out_channels,
+					&out_format)) {
 			mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_NoMatchingFilter);
 			mencoder_exit(1, NULL);
 		}
--- a/mplayer.c	Thu Nov 01 06:52:23 2007 +0000
+++ b/mplayer.c	Thu Nov 01 06:52:28 2007 +0000
@@ -1213,9 +1213,7 @@
     playback_speed = (float)new_srate / (float)sh_audio->samplerate;
   }
   result =  init_audio_filters(sh_audio, new_srate,
-           sh_audio->channels, sh_audio->sample_format,
-           &ao_data->samplerate, &ao_data->channels, &ao_data->format,
-           ao_data->outburst * 4, ao_data->buffersize);
+           &ao_data->samplerate, &ao_data->channels, &ao_data->format);
   mpctx->mixer.afilter = sh_audio->afilter;
 #ifdef HAVE_NEW_GUI
   if (use_gui) guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter);
@@ -1495,10 +1493,9 @@
   ao_data.format=audio_output_format;
 #if 1
   // first init to detect best values
-  if(!preinit_audio_filters(mpctx->sh_audio,
+  if(!init_audio_filters(mpctx->sh_audio,   // preliminary init
         // input:
         (int)(mpctx->sh_audio->samplerate*playback_speed),
-	mpctx->sh_audio->channels, mpctx->sh_audio->sample_format,
 	// output:
 	&ao_data.samplerate, &ao_data.channels, &ao_data.format)){
       mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError);