[vorbis-dev] ogg123 -k 1:59 patch.ogg # minutes and seconds

Hans Schou chlor at schou.dk
Mon Mar 3 15:53:41 PST 2003



On Sun, 2 Mar 2003, Segher Boessenkool wrote:

> Ah well, I'll write it in C for you [completely untested!]
> (leaving out the locale stuff).
> 
> double strtotime(const char *s)

Thanks! It should not be 'const',
otherwise it is fine.

diff -Naur vorbis-tools-1.0.orig/ogg123/cmdline_options.c vorbis-tools-1.0/ogg123/cmdline_options.c
--- vorbis-tools-1.0.orig/ogg123/cmdline_options.c	Thu Jul 11 04:44:39 2002
+++ vorbis-tools-1.0/ogg123/cmdline_options.c	Tue Mar  4 00:46:02 2003
@@ -50,6 +50,17 @@
     {0, 0, 0, 0}
 };
 
+double strtotime(char *s)
+{
+	double time;
+
+	time = strtod(s, &s);
+
+	while (*s == ':')
+		time = 60 * time + strtod(s + 1, &s);
+
+	return time;
+}
 
 int parse_cmdline_options (int argc, char **argv,
                            ogg123_options_t *ogg123_opts,
@@ -137,7 +148,7 @@
         break;
 
         case 'k':
-	  ogg123_opts->seekpos = atof(optarg);
+	  ogg123_opts->seekpos = strtotime(optarg);
           break;
           
         case 'l':

<p>
-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
You didn't answer my question. 
				-- John McClane, Die Hard
--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis-dev mailing list