changeset 937:a8a34da9c17f

when using -ss: "seek seconds" -> "super seek" now it understands 1:22:41.4 2:13 style time
author laaz
date Fri, 01 Jun 2001 22:48:50 +0000
parents 3c0d3171d5cf
children fe187745dfb9
files cfg-mplayer.h mplayer.c mplayer.h
diffstat 3 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Fri Jun 01 22:03:46 2001 +0000
+++ b/cfg-mplayer.h	Fri Jun 01 22:48:50 2001 +0000
@@ -71,7 +71,7 @@
 	{"bg", &play_in_bg, CONF_TYPE_FLAG, 0, 0, 1},
 	{"nobg", &play_in_bg, CONF_TYPE_FLAG, 0, 1, 0},
 	{"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0},
-	{"ss", &seek_to_sec, CONF_TYPE_INT, CONF_MIN, 0, 0},
+	{"ss", &seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0},
 	{"sound", &has_audio, CONF_TYPE_FLAG, 0, 0, 1},
 	{"nosound", &has_audio, CONF_TYPE_FLAG, 0, 1, 0},
 	{"abs", &audio_buffer_size, CONF_TYPE_INT, CONF_MIN, 0, 0},
--- a/mplayer.c	Fri Jun 01 22:03:46 2001 +0000
+++ b/mplayer.c	Fri Jun 01 22:48:50 2001 +0000
@@ -445,7 +445,7 @@
 
 char* filename=NULL; //"MI2-Trailer.avi";
 int i;
-int seek_to_sec=0;
+char *seek_to_sec=NULL;
 int seek_to_byte=0;
 int f; // filedes
 stream_t* stream=NULL;
@@ -513,7 +513,7 @@
 int osd_function=OSD_PLAY;
 int osd_last_pts=-303;
 
-int rel_seek_secs=0;
+float rel_seek_secs=0;
 
 #include "mixer.h"
 #include "cfg-mplayer.h"
@@ -2155,9 +2155,18 @@
       break;
   }
   if (seek_to_sec) {
-     rel_seek_secs += seek_to_sec;
-     seek_to_sec = 0;
+    int a,b; float d;
+    
+    if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3)
+	rel_seek_secs += 3600*a +60*b +d ;
+    else if (sscanf(seek_to_sec, "%d:%f", &a, &d)==2)
+	rel_seek_secs += 60*a +d;
+    else if (sscanf(seek_to_sec, "%f", &d)==1)
+	rel_seek_secs += d;
+
+     seek_to_sec = NULL;
   }
+  
   if(rel_seek_secs)
   if(file_format==DEMUXER_TYPE_AVI && demuxer->idx_size<=0){
     printf("Can't seek in raw .AVI streams! (index required, try with the -idx switch!)  \n");
--- a/mplayer.h	Fri Jun 01 22:03:46 2001 +0000
+++ b/mplayer.h	Fri Jun 01 22:48:50 2001 +0000
@@ -6,7 +6,7 @@
 
 extern char* filename;
 extern int i;
-extern int seek_to_sec;
+extern char *seek_to_sec;
 extern int seek_to_byte;
 extern int f; // filedes
 extern int stream_type;
@@ -70,7 +70,7 @@
 extern int osd_level;
 extern int nogui;
 
-extern int rel_seek_secs;
+extern float rel_seek_secs;
 
 extern int osd_visible;
 extern int osd_function;