[MPlayer-dev-eng] [PATCH] slave mode absolute seek

Sidik Isani lksi at cfht.hawaii.edu
Thu Sep 19 06:18:47 CEST 2002


Hello -

  I have an application using "mplayer -slave" (very convenient -- it
  works great!)  In my case, the master knows where it wants mplayer
  to seek to, but it does not know the total length of the clip to
  calculate a percentage seek (type=1).  This tiny patch adds "type=2"
  absolute seconds seek capability.  Update for man page is included.

  My mailer seems to force the attachment to be just "text/plain".
  Please let me know if I need to resubmit it as base64 or if it doesn't
  apply cleanly to the current CVS.  It should.  Thank you very much
  for MPlayer!

Be seeing you,

- Sidik
-------------- next part --------------
diff -ru MPlayer-0.90pre7.DIST/DOCS/mplayer.1 MPlayer-0.90pre7/DOCS/mplayer.1
--- MPlayer-0.90pre7.DIST/DOCS/mplayer.1	Tue Sep  3 10:48:56 2002
+++ MPlayer-0.90pre7/DOCS/mplayer.1	Wed Sep 18 18:02:00 2002
@@ -1691,11 +1691,13 @@
 .B Commands
 .br
 .br
-seek <value> [type=<0/1>]
+seek <value> [type=<0/1/2>]
                 Seek to some place in the movie.
                 Type 0 is a relative seek of +/-
                 <value> seconds. Type 1 seek to
-                <value> % in the movie.
+                <value> % in the movie.  Type 2
+                is a seek to an absolute position
+                of <value> seconds.
 
 audio_delay <value>
                 Adjust the audio delay of value seconds
diff -ru MPlayer-0.90pre7.DIST/mplayer.c MPlayer-0.90pre7/mplayer.c
--- MPlayer-0.90pre7.DIST/mplayer.c	Mon Sep  2 12:19:44 2002
+++ MPlayer-0.90pre7/mplayer.c	Mon Sep 16 21:48:04 2002
@@ -1949,7 +1949,13 @@
       int v,abs;
       v = cmd->args[0].v.i;
       abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
-      if(abs) {
+      if(abs==2) { /* Absolute seek to a specific timestamp in seconds */
+        abs_seek_pos = 1;
+	if(sh_video)
+	  osd_function= (v > sh_video->timer) ? OSD_FFW : OSD_REW;
+	rel_seek_secs = v;
+      }
+      else if(abs) { /* Absolute seek by percentage */
 	abs_seek_pos = 3;
 	if(sh_video)
 	  osd_function= (v > sh_video->timer) ? OSD_FFW : OSD_REW;


More information about the MPlayer-dev-eng mailing list