[MPlayer-cvslog] r24922 - in trunk: libmpcodecs/dec_audio.c libmpcodecs/dec_audio.h mencoder.c mplayer.c

uau subversion at mplayerhq.hu
Thu Nov 1 07:52:28 CET 2007


Author: uau
Date: Thu Nov  1 07:52:28 2007
New Revision: 24922

Log:
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.


Modified:
   trunk/libmpcodecs/dec_audio.c
   trunk/libmpcodecs/dec_audio.h
   trunk/mencoder.c
   trunk/mplayer.c

Modified: trunk/libmpcodecs/dec_audio.c
==============================================================================
--- trunk/libmpcodecs/dec_audio.c	(original)
+++ trunk/libmpcodecs/dec_audio.c	Thu Nov  1 07:52:28 2007
@@ -313,19 +313,8 @@ void uninit_audio(sh_audio_t *sh_audio)
 }
 
 
-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 @@ int init_audio_filters(sh_audio_t *sh_au
     }
     // 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)

Modified: trunk/libmpcodecs/dec_audio.h
==============================================================================
--- trunk/libmpcodecs/dec_audio.h	(original)
+++ trunk/libmpcodecs/dec_audio.h	Thu Nov  1 07:52:28 2007
@@ -7,10 +7,5 @@ extern void resync_audio_stream(sh_audio
 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);

Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c	(original)
+++ trunk/mencoder.c	Thu Nov  1 07:52:28 2007
@@ -914,10 +914,9 @@ mux_a->codec=out_audio_codec;
 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(mux_a->codec != ACODEC_COPY) {
     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 @@ else {
 		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);
 		}

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	(original)
+++ trunk/mplayer.c	Thu Nov  1 07:52:28 2007
@@ -1213,9 +1213,7 @@ int build_afilter_chain(sh_audio_t *sh_a
     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 @@ if(mpctx->sh_audio){
   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);



More information about the MPlayer-cvslog mailing list