lavu/parseutils: allow MM:SS format for duration in av_parse_time()
authorSenthilnathan M <senthilnathan.maadasamy@gmail.com>
Wed, 20 Feb 2013 04:21:06 +0000 (09:51 +0530)
committerStefano Sabatini <stefasab@gmail.com>
Fri, 22 Feb 2013 22:43:46 +0000 (23:43 +0100)
Fix trac ticket #2258.

Signed-off-by: Senthilnathan M <senthilnathan.maadasamy@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
doc/syntax.texi
libavutil/parseutils.c
libavutil/parseutils.h
libavutil/version.h

index 4dddc3c..af22d6c 100644 (file)
@@ -98,7 +98,7 @@ year-month-day.
 
 The accepted syntax is:
 @example
-[-]HH:MM:SS[.m...]
+[-][HH:]MM:SS[.m...]
 [-]S+[.m...]
 @end example
 
index 73e400a..c67f971 100644 (file)
@@ -587,6 +587,11 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
         }
         /* parse timestr as HH:MM:SS */
         q = av_small_strptime(p, "%J:%M:%S", &dt);
+        if (!q) {
+            /* parse timestr as MM:SS */
+            q = av_small_strptime(p, "%M:%S", &dt);
+            dt.tm_hour = 0;
+        }
         if (!q) {
             /* parse timestr as S+ */
             dt.tm_sec = strtol(p, (void *)&q, 10);
index 1f56a7a..80ba2b7 100644 (file)
@@ -122,7 +122,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
  * year-month-day.
  * - If a duration the syntax is:
  * @code
- * [-]HH:MM:SS[.m...]]]
+ * [-][HH:]MM:SS[.m...]]]
  * [-]S+[.m...]
  * @endcode
  * @param duration flag which tells how to interpret timestr, if not
index 3b5c04d..5aca91d 100644 (file)
@@ -76,7 +76,7 @@
 
 #define LIBAVUTIL_VERSION_MAJOR  52
 #define LIBAVUTIL_VERSION_MINOR  17
-#define LIBAVUTIL_VERSION_MICRO 102
+#define LIBAVUTIL_VERSION_MICRO 103
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \