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>
This commit is contained in:
parent
4a83541650
commit
18579f08e7
@ -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)
|
int64_t ff_iso8601_to_unix_time(const char *datestr)
|
||||||
{
|
{
|
||||||
#if HAVE_STRPTIME
|
#if HAVE_STRPTIME
|
||||||
struct tm time = {0};
|
struct tm time1 = {0}, time2 = {0};
|
||||||
strptime(datestr, "%Y - %m - %dT%T", &time);
|
char *ret1, *ret2;
|
||||||
return av_timegm(&time);
|
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
|
#else
|
||||||
av_log(NULL, AV_LOG_WARNING, "strptime() unavailable on this system, cannot convert "
|
av_log(NULL, AV_LOG_WARNING, "strptime() unavailable on this system, cannot convert "
|
||||||
"the date string.\n");
|
"the date string.\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user