[FFmpeg-cvslog] lavu/parseutils: allow MM:SS format for duration in av_parse_time()
Senthilnathan M
git at videolan.org
Fri Feb 22 23:50:47 CET 2013
ffmpeg | branch: master | Senthilnathan M <senthilnathan.maadasamy at gmail.com> | Wed Feb 20 10:09:06 2013 +0530| [12a269a5229d3a37be0743fc9655f743ebc44b6e] | committer: Stefano Sabatini
lavu/parseutils: allow MM:SS format for duration in av_parse_time()
Fix trac ticket #2258.
Signed-off-by: Senthilnathan M <senthilnathan.maadasamy at gmail.com>
Signed-off-by: Stefano Sabatini <stefasab at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12a269a5229d3a37be0743fc9655f743ebc44b6e
---
doc/syntax.texi | 2 +-
libavutil/parseutils.c | 5 +++++
libavutil/parseutils.h | 2 +-
libavutil/version.h | 2 +-
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/doc/syntax.texi b/doc/syntax.texi
index 4dddc3c..af22d6c 100644
--- a/doc/syntax.texi
+++ b/doc/syntax.texi
@@ -98,7 +98,7 @@ year-month-day.
The accepted syntax is:
@example
-[-]HH:MM:SS[.m...]
+[-][HH:]MM:SS[.m...]
[-]S+[.m...]
@end example
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 73e400a..c67f971 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -588,6 +588,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);
if (q == p) /* the parsing didn't succeed */
diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h
index 1f56a7a..80ba2b7 100644
--- a/libavutil/parseutils.h
+++ b/libavutil/parseutils.h
@@ -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
diff --git a/libavutil/version.h b/libavutil/version.h
index 3b5c04d..5aca91d 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -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, \
More information about the ffmpeg-cvslog
mailing list