[MPlayer-dev-eng] [PATCH] -frames and ao_oss.c fixes

Tibcu tibcu at sch.bme.hu
Wed Jun 26 17:30:41 CEST 2002


Hi!

I noticed a very stupid bug in ao_oss.c, 20020626-ao_oss.c.diff fixes it

The other patch touches three files, but the bug was only in mplayer.c
* -frames 0 doesn't work, it plays 1 frame, but it shouldn't
* -frames x (x>0) plays always x+1 frames, that's bad
  the interesting thing is, mencoder.c isn't affected, though the code
  seems similar
* the biggest problem, that mplayer in multifile mode only uses given
  frame number to the first file, but a global switch should work
  equally with all files (I specified -frames before playlist, so I
  think it means I used it global way when it not worked)
  this made it necessary to modify cfg-common.c and so mencoder.c too
  (if I know well, mencoder.c can't handle multiple files, so the patch
  only touches it to be in sync with cfg-common.c)
  (or should have I moved frames option to mplayer/mencoder specific
  cfg files?)
20020626-frames-fix.diff adresses all the three issues
    So now you can use -frames 0 -vo null in scripts gathering infos from
    your files etc.

Hope my patches are useful, any feedback is welcome
-- 
                                -=+=- Tibcu -=+=-
-------------- next part --------------
diff -Naur old/ao_oss.c new/ao_oss.c
--- old/ao_oss.c	Tue Jun  4 20:32:38 2002
+++ new/ao_oss.c	Wed Jun 26 06:45:02 2002
@@ -168,7 +168,7 @@
     ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
     mp_msg(MSGT_AO,MSGL_V,"audio_setup: using %d Hz samplerate (requested: %d)\n",ao_data.samplerate,rate);
     if(ao_data.samplerate!=rate)
-	mp_msg(MSGT_AO,MSGL_WARN,"WARNING! Your soundcard does NOT support %d Hz samplerate! A-V sync problems are possible! Try with '-aop list=resample:fout=%d'\n",rate);
+	mp_msg(MSGT_AO,MSGL_WARN,"WARNING! Your soundcard does NOT support %d Hz samplerate! A-V sync problems or wrong speed are possible! Try with '-aop list=resample:fout=%d'\n",rate,ao_data.samplerate);
   }
 
   if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)==-1){
-------------- next part --------------
diff -Naur old/cfg-common.h new/cfg-common.h
--- old/cfg-common.h	Wed Jun 26 07:48:52 2002
+++ new/cfg-common.h	Wed Jun 26 16:45:57 2002
@@ -49,7 +49,7 @@
 // ------------------------- demuxer options --------------------
 
 	// number of frames to play/convert
-	{"frames", &play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
+	{"frames", &play_n_frames_mf, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
 
 	// seek to byte/seconds position
 	{"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
diff -Naur old/mencoder.c new/mencoder.c
--- old/mencoder.c	Mon Jun 24 13:29:08 2002
+++ new/mencoder.c	Wed Jun 26 16:49:05 2002
@@ -151,6 +151,7 @@
 int pass_working=0;
 
 static int play_n_frames=-1;
+static int play_n_frames_mf=-1;
 
 #include "libvo/font_load.h"
 #include "libvo/sub.h"
@@ -797,6 +798,8 @@
 	audio_preload = 0.0;
 	default_max_pts_correction = 0;
 	}
+
+play_n_frames=play_n_frames_mf;
 
 while(!at_eof){
 
diff -Naur old/mplayer.c new/mplayer.c
--- old/mplayer.c	Mon Jun 24 13:29:09 2002
+++ new/mplayer.c	Wed Jun 26 16:49:27 2002
@@ -233,6 +233,7 @@
 static int force_srate=0;
 static int frame_dropping=0; // option  0=no drop  1= drop vo  2= drop decode
 static int play_n_frames=-1;
+static int play_n_frames_mf=-1;
 
 // screen info:
 char* video_driver=NULL; //"mga"; // default
@@ -1488,12 +1489,18 @@
 
 total_time_usage_start=GetTimer();
 audio_time_usage=0; video_time_usage=0; vout_time_usage=0;
+play_n_frames=play_n_frames_mf;
+
+if(play_n_frames==0){
+  eof=PT_NEXT_ENTRY; goto goto_next_file;
+}
+
 while(!eof){
     float aq_sleep_time=0;
 
     if(play_n_frames>=0){
       --play_n_frames;
-      if(play_n_frames<0) eof = PT_NEXT_ENTRY;
+      if(play_n_frames<=0) eof = PT_NEXT_ENTRY;
     }
 
 /*========================== PLAY AUDIO ============================*/


More information about the MPlayer-dev-eng mailing list