[FFmpeg-cvslog] r12647 - in trunk: cmdutils.c cmdutils.h ffmpeg.c

superdump subversion
Mon Mar 31 12:01:07 CEST 2008


Author: superdump
Date: Mon Mar 31 12:01:06 2008
New Revision: 12647

Log:
Export parse_time_or_die from ffmpeg.c to cmdutils.c

Patch by Stefano Sabatini (stefano sabatini-lala poste it)


Modified:
   trunk/cmdutils.c
   trunk/cmdutils.h
   trunk/ffmpeg.c

Modified: trunk/cmdutils.c
==============================================================================
--- trunk/cmdutils.c	(original)
+++ trunk/cmdutils.c	Mon Mar 31 12:01:06 2008
@@ -52,6 +52,17 @@ double parse_number_or_die(const char *c
     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;

Modified: trunk/cmdutils.h
==============================================================================
--- trunk/cmdutils.h	(original)
+++ trunk/cmdutils.h	Mon Mar 31 12:01:06 2008
@@ -39,6 +39,22 @@
  */
 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;

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	(original)
+++ trunk/ffmpeg.c	Mon Mar 31 12:01:06 2008
@@ -2580,17 +2580,6 @@ static void opt_map_meta_data(const char
     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);




More information about the ffmpeg-cvslog mailing list