diff --git a/cfg-mplayer.h b/cfg-mplayer.h index c548283d8e..47ffdf468f 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -71,7 +71,7 @@ struct config conf[]={ {"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}, diff --git a/mplayer.c b/mplayer.c index 682b9e125f..5e6d752410 100644 --- a/mplayer.c +++ b/mplayer.c @@ -445,7 +445,7 @@ extern int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m 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_visible=100; 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 @@ switch(sh_video->codec->driver){ 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"); diff --git a/mplayer.h b/mplayer.h index cc2e79fd53..239dd2428b 100644 --- a/mplayer.h +++ b/mplayer.h @@ -6,7 +6,7 @@ extern int divx_quality; 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 verbose; 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;