diff mencoder.c @ 22312:cca9ff25bed2

Move parsing of the -ss option to the option code. Also fixes a memory leak of the parameter string.
author uau
date Sat, 24 Feb 2007 07:11:57 +0000
parents 5bf6c178f09a
children 06dd10ccb659
line wrap: on
line diff
--- a/mencoder.c	Fri Feb 23 22:14:15 2007 +0000
+++ b/mencoder.c	Sat Feb 24 07:11:57 2007 +0000
@@ -250,7 +250,7 @@
 	return m_config_parse_config_file(mconfig, filename);
 }
 
-static char *seek_to_sec=NULL;
+static double seek_to_sec;
 static off_t seek_to_byte=0;
 
 static m_time_size_t end_at = { .type = END_AT_NONE, .pos = 0 };
@@ -1035,16 +1035,7 @@
 }
 
 if (seek_to_sec) {
-    int a,b; float d;
-
-    if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3)
-        d += 3600*a + 60*b;
-    else if (sscanf(seek_to_sec, "%d:%f", &a, &d)==2)
-        d += 60*a;
-    else 
-        sscanf(seek_to_sec, "%f", &d);
-
-    demux_seek(demuxer, d, audio_delay, 1);
+    demux_seek(demuxer, seek_to_sec, audio_delay, 1);
 //  there is 2 way to handle the -ss option in 3-pass mode:
 // > 1. do the first pass for the whole file, and use -ss for 2nd/3rd pases only
 // > 2. do all the 3 passes with the same -ss value