]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Export parse_time_or_die from ffmpeg.c to cmdutils.c
authorsuperdump <superdump@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 31 Mar 2008 10:01:06 +0000 (10:01 +0000)
committersuperdump <superdump@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 31 Mar 2008 10:01:06 +0000 (10:01 +0000)
Patch by Stefano Sabatini (stefano sabatini-lala poste it)

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@12647 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

cmdutils.c
cmdutils.h
ffmpeg.c

index 36508d25b40d93939b4a855924ff5d12789fdfb5..3eb9c18ecd9b6d01f7cca9c515047cbecf80de30 100644 (file)
@@ -52,6 +52,17 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
     exit(1);
 }
 
+int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
+{
+    int64_t us = parse_date(timestr, is_duration);
+    if (us == INT64_MIN) {
+        fprintf(stderr, "Invalid %s specification for %s: %s\n",
+                is_duration ? "duration" : "date", context, timestr);
+        exit(1);
+    }
+    return us;
+}
+
 void show_help_options(const OptionDef *options, const char *msg, int mask, int value)
 {
     const OptionDef *po;
index d06a1f8e8302a7e31fa0d2f89447444615df78f6..1e27d8fcc2f549898623461fadd3ec9a48958f24 100644 (file)
  */
 double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max);
 
+/**
+ * Parses a string specifying a time and returns its corresponding
+ * value as a number of microseconds. Exits from the application if
+ * the string cannot be correctly parsed.
+ *
+ * @param context the context of the value to be set (e.g. the
+ * corresponding commandline option name)
+ * @param timestr the string to be parsed
+ * @param is_duration a flag which tells how to interpret \p timestr, if
+ * not zero \p timestr is interpreted as a duration, otherwise as a
+ * date
+ *
+ * @see av_parse_date()
+ */
+int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
+
 typedef struct {
     const char *name;
     int flags;
index 7c8ff4910ed3aaeeb883af2afe437777c8d0f32d..753cd20cb0365aaff19e849372288feba78141fc 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2580,17 +2580,6 @@ static void opt_map_meta_data(const char *arg)
     m->in_file = strtol(p, &p, 0);
 }
 
-static int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
-{
-    int64_t us = parse_date(timestr, is_duration);
-    if (us == INT64_MIN) {
-        fprintf(stderr, "Invalid %s specification for %s: %s\n",
-                is_duration ? "duration" : "date", context, timestr);
-        exit(1);
-    }
-    return us;
-}
-
 static int opt_recording_time(const char *opt, const char *arg)
 {
     recording_time = parse_time_or_die(opt, arg, 1);