diff options
author | Martin Storsjö <martin@martin.st> | 2011-11-08 00:12:09 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-11-16 11:22:43 +0200 |
commit | 18579f08e73d8b072952b7e388c55ab407db0ec7 (patch) | |
tree | b6aa0ff0a34fef3a2251099c2511afbc09634b19 /libavformat | |
parent | 4a835416508820de383cda8cc906b6f1bd938889 (diff) | |
download | ffmpeg-18579f08e73d8b072952b7e388c55ab407db0ec7.tar.gz |
avformat: Accept the ISO8601 separate format as input, too
This makes the function accept the format of creation_time
as output by demuxers (e.g. the mov demuxer), making the
creation timestamp stay intact if transcoding.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index dfcac203db..b8262ecaf1 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3943,9 +3943,14 @@ void ff_make_absolute_url(char *buf, int size, const char *base, int64_t ff_iso8601_to_unix_time(const char *datestr) { #if HAVE_STRPTIME - struct tm time = {0}; - strptime(datestr, "%Y - %m - %dT%T", &time); - return av_timegm(&time); + struct tm time1 = {0}, time2 = {0}; + char *ret1, *ret2; + ret1 = strptime(datestr, "%Y - %m - %d %T", &time1); + ret2 = strptime(datestr, "%Y - %m - %dT%T", &time2); + if (ret2 && !ret1) + return av_timegm(&time2); + else + return av_timegm(&time1); #else av_log(NULL, AV_LOG_WARNING, "strptime() unavailable on this system, cannot convert " "the date string.\n"); |