[MPlayer-dev-eng] [PATCH 1/2] playback_speed limits: new_srate

Robert Juliano juliano.1 at osu.edu
Sat Jun 2 21:05:07 CEST 2007


Patch 1: remove incorrect limits on playback_speed

The limits from resample are for *output* rates, but new_srate
sets the input rate for the filter stream.  Patches both
mplayer and mencoder.

Robert

Index: mplayer.c
===================================================================
--- mplayer.c	(revision 23455)
+++ mplayer.c	(working copy)
@@ -1198,7 +1198,6 @@
  */
 int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data)
 {
-  int new_srate;
   int result;
   if (!sh_audio)
   {
@@ -1208,16 +1207,8 @@
     mpctx->mixer.afilter = NULL;
     return 0;
   }
-  new_srate = sh_audio->samplerate * playback_speed;
-  if (new_srate != ao_data->samplerate) {
-    // limits are taken from libaf/af_resample.c
-    if (new_srate < 8000)
-      new_srate = 8000;
-    if (new_srate > 192000)
-      new_srate = 192000;
-    playback_speed = (float)new_srate / (float)sh_audio->samplerate;
-  }
-  result =  init_audio_filters(sh_audio, new_srate,
+  result =  init_audio_filters(sh_audio,
+           sh_audio->samplerate * playback_speed,
            sh_audio->channels, sh_audio->sample_format,
            &ao_data->samplerate, &ao_data->channels, &ao_data->format,
            ao_data->outburst * 4, ao_data->buffersize);
Index: mencoder.c
===================================================================
--- mencoder.c	(revision 23455)
+++ mencoder.c	(working copy)
@@ -643,14 +643,7 @@
 }
 
   if (sh_audio) {
-    new_srate = sh_audio->samplerate;
-    if (playback_speed != 1.0) {
-        new_srate *= playback_speed;
-        // limits are taken from libaf/af_resample.c
-        if (new_srate < 8000) new_srate = 8000;
-        if (new_srate > 192000) new_srate = 192000;
-        playback_speed = (float)new_srate / (float)sh_audio->samplerate;
-    }
+    new_srate = sh_audio->samplerate * playback_speed;
   }
 
 // after reading video params we should load subtitles because



More information about the MPlayer-dev-eng mailing list