Browse code

lavu/parseutils: accept %J for hours >= 24.

Allow to parse durations >= 24:00:00.

Nicolas George authored on 2012/12/02 00:58:51
Showing 3 changed files
... ...
@@ -454,7 +454,8 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
454 454
             c = *fmt++;
455 455
             switch(c) {
456 456
             case 'H':
457
-                val = date_get_num(&p, 0, 23, 2);
457
+            case 'J':
458
+                val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2);
458 459
                 if (val == -1)
459 460
                     return NULL;
460 461
                 dt->tm_hour = val;
... ...
@@ -581,7 +582,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
581 581
             ++p;
582 582
         }
583 583
         /* parse timestr as HH:MM:SS */
584
-        q = av_small_strptime(p, time_fmt[0], &dt);
584
+        q = av_small_strptime(p, "%J:%M:%S", &dt);
585 585
         if (!q) {
586 586
             /* parse timestr as S+ */
587 587
             dt.tm_sec = strtol(p, (void *)&q, 10);
... ...
@@ -141,6 +141,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration);
141 141
  * In particular it actually supports the parameters:
142 142
  * - %H: the hour as a decimal number, using a 24-hour clock, in the
143 143
  * range '00' through '23'
144
+ * - %J: hours as a decimal number, in the range '0' through INT_MAX
144 145
  * - %M: the minute as a decimal number, using a 24-hour clock, in the
145 146
  * range '00' through '59'
146 147
  * - %S: the second as a decimal number, using a 24-hour clock, in the
... ...
@@ -76,7 +76,7 @@
76 76
 
77 77
 #define LIBAVUTIL_VERSION_MAJOR  52
78 78
 #define LIBAVUTIL_VERSION_MINOR  11
79
-#define LIBAVUTIL_VERSION_MICRO 100
79
+#define LIBAVUTIL_VERSION_MICRO 101
80 80
 
81 81
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
82 82
                                                LIBAVUTIL_VERSION_MINOR, \