[Mplayer-cvslog] CVS: main cfg-mplayer.h,1.169,1.170 mplayer.c,1.586,1.587

Arpi of Ize arpi at mplayerhq.hu
Sun Oct 6 01:00:21 CEST 2002


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv27551

Modified Files:
	cfg-mplayer.h mplayer.c 
Log Message:
new option -speed, to set playback speed rate (examples: -speed 1:3 or -speed 5)
it replaces old -srate behaviour ofor mplayer


Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -r1.169 -r1.170
--- cfg-mplayer.h	5 Oct 2002 22:55:44 -0000	1.169
+++ cfg-mplayer.h	5 Oct 2002 23:00:18 -0000	1.170
@@ -310,6 +310,8 @@
 	// set a-v distance, should be moved to -common and support in mencoder
 	{"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL},
 
+	{"speed", &playback_speed, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL},
+
 	{"framedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"hardframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, NULL},
 	{"noframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, NULL},

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.586
retrieving revision 1.587
diff -u -r1.586 -r1.587
--- mplayer.c	5 Oct 2002 22:55:44 -0000	1.586
+++ mplayer.c	5 Oct 2002 23:00:18 -0000	1.587
@@ -152,6 +152,8 @@
        int auto_quality=0;
 static int output_quality=0;
 
+float playback_speed=1.0;
+
 int use_gui=0;
 
 int osd_level=1;
@@ -1236,7 +1238,7 @@
   current_module="ao2_init";
   if(!(audio_out=init_best_audio_out(audio_driver_list,
       (ao_plugin_cfg.plugin_list), // plugin flag
-      force_srate?force_srate:sh_audio->samplerate,
+      force_srate?force_srate:sh_audio->samplerate*playback_speed,
       audio_output_channels?audio_output_channels:
       sh_audio->channels,sh_audio->sample_format,0))){
     // FAILED:
@@ -1247,7 +1249,7 @@
     inited_flags|=INITED_AO;
     mp_msg(MSGT_CPLAYER,MSGL_INFO,"AO: [%s] %dHz %dch %s\n",
       audio_out->info->short_name,
-      force_srate?force_srate:sh_audio->samplerate,
+      force_srate?force_srate:((int)(sh_audio->samplerate*playback_speed)),
       sh_audio->channels,
       audio_out_format_name(sh_audio->sample_format));
     mp_msg(MSGT_CPLAYER,MSGL_V,MSGTR_AODescription_AOAuthor,
@@ -1258,7 +1260,7 @@
 #if 1
     current_module="af_init";
     if(!init_audio_filters(sh_audio, 
-        sh_audio->samplerate,
+        (int)(sh_audio->samplerate*playback_speed),
 	sh_audio->channels, sh_audio->sample_format, sh_audio->samplesize,
 	ao_data.samplerate, ao_data.channels, ao_data.format,
 	audio_out_format_bits(ao_data.format)/8, /* ao_data.bps, */
@@ -1369,7 +1371,7 @@
   if(playsize>0){
       sh_audio->a_out_buffer_len-=playsize;
       memmove(sh_audio->a_out_buffer,&sh_audio->a_out_buffer[playsize],sh_audio->a_out_buffer_len);
-      sh_audio->timer+=playsize/((float)((ao_data.bps && sh_audio->afilter) ?
+      sh_audio->timer+=playback_speed*playsize/((float)((ao_data.bps && sh_audio->afilter) ?
           ao_data.bps : sh_audio->o_bps));
   }
 
@@ -1410,7 +1412,7 @@
 	// check for frame-drop:
 	current_module="check_framedrop";
 	if(sh_audio && !d_audio->eof){
-	    float delay=audio_out->get_delay();
+	    float delay=playback_speed*audio_out->get_delay();
 	    float d=(sh_video->timer)-(sh_audio->timer-delay);
 	    // we should avoid dropping to many frames in sequence unless we
 	    // are too late. and we allow 100ms A-V delay here:
@@ -1484,7 +1486,7 @@
       time_frame-=GetRelativeTime(); // reset timer
 
       if(sh_audio && !d_audio->eof){
-	  float delay=audio_out->get_delay();
+	  float delay=playback_speed*audio_out->get_delay();
 	  mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"delay=%f\n",delay);
 
 	  if (autosync){
@@ -1603,7 +1605,7 @@
     float v_pts=0;
 
     // unplayed bytes in our and soundcard/dma buffer:
-    float delay=audio_out->get_delay()+(float)sh_audio->a_buffer_len/(float)sh_audio->o_bps;
+    float delay=playback_speed*audio_out->get_delay()+(float)sh_audio->a_buffer_len/(float)sh_audio->o_bps;
 
     if (autosync){
       /*
@@ -1665,9 +1667,9 @@
         if(!quiet) mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f  %3d/%3d  %2d%% %2d%% %4.1f%% %d %d %d%%\r",
 	  a_pts-audio_delay-delay,v_pts,AV_delay,c_total,
           (int)sh_video->num_frames,(int)sh_video->num_frames_decoded,
-          (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0,
-          (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0,
-          (sh_video->timer>0.5)?(100.0*audio_time_usage/(double)sh_video->timer):0
+          (sh_video->timer>0.5)?(int)(100.0*video_time_usage*playback_speed/(double)sh_video->timer):0,
+          (sh_video->timer>0.5)?(int)(100.0*vout_time_usage*playback_speed/(double)sh_video->timer):0,
+          (sh_video->timer>0.5)?(100.0*audio_time_usage*playback_speed/(double)sh_video->timer):0
           ,drop_frame_cnt
 	  ,output_quality
 	  ,cache_fill_status




More information about the MPlayer-cvslog mailing list