[FFmpeg-cvslog] lavu/parseutils: accept %J for hours >= 24.

Nicolas George git at videolan.org
Sun Dec 2 12:19:45 CET 2012


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Sat Dec  1 16:58:51 2012 +0100| [86a2486812f14bf513632e425649a534882e56f7] | committer: Nicolas George

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

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86a2486812f14bf513632e425649a534882e56f7
---

 libavutil/parseutils.c |    5 +++--
 libavutil/parseutils.h |    1 +
 libavutil/version.h    |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index a335978..f188e81 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -454,7 +454,8 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
             c = *fmt++;
             switch(c) {
             case 'H':
-                val = date_get_num(&p, 0, 23, 2);
+            case 'J':
+                val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2);
                 if (val == -1)
                     return NULL;
                 dt->tm_hour = val;
@@ -581,7 +582,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
             ++p;
         }
         /* parse timestr as HH:MM:SS */
-        q = av_small_strptime(p, time_fmt[0], &dt);
+        q = av_small_strptime(p, "%J:%M:%S", &dt);
         if (!q) {
             /* parse timestr as S+ */
             dt.tm_sec = strtol(p, (void *)&q, 10);
diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h
index da7d345..1f56a7a 100644
--- a/libavutil/parseutils.h
+++ b/libavutil/parseutils.h
@@ -141,6 +141,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration);
  * In particular it actually supports the parameters:
  * - %H: the hour as a decimal number, using a 24-hour clock, in the
  * range '00' through '23'
+ * - %J: hours as a decimal number, in the range '0' through INT_MAX
  * - %M: the minute as a decimal number, using a 24-hour clock, in the
  * range '00' through '59'
  * - %S: the second as a decimal number, using a 24-hour clock, in the
diff --git a/libavutil/version.h b/libavutil/version.h
index b46c3f2..a44feda 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -76,7 +76,7 @@
 
 #define LIBAVUTIL_VERSION_MAJOR  52
 #define LIBAVUTIL_VERSION_MINOR  11
-#define LIBAVUTIL_VERSION_MICRO 100
+#define LIBAVUTIL_VERSION_MICRO 101
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list