diff options
author | Marton Balint <cus@passwd.hu> | 2016-06-29 22:44:59 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2016-08-17 23:45:41 +0200 |
commit | b72a7b96f84e5f16dd93b60668aecfda99442c71 (patch) | |
tree | 0f51e4e5cdb3a35aad6aa1652d1554dbc93d2653 /libavformat/utils.c | |
parent | a810126fd1b922154359a84b49ae2b7b9568efae (diff) | |
download | ffmpeg-streaming-b72a7b96f84e5f16dd93b60668aecfda99442c71.zip ffmpeg-streaming-b72a7b96f84e5f16dd93b60668aecfda99442c71.tar.gz |
avformat: factorize iso 8601 timestamp writer to a dictionary avutil function
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index c84d69c..47cb7dd 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -5217,20 +5217,8 @@ int ff_standardize_creation_time(AVFormatContext *s) { int64_t timestamp; int ret = ff_parse_creation_time_metadata(s, ×tamp, 0); - if (ret == 1) { - time_t seconds = timestamp / 1000000; - struct tm *ptm, tmbuf; - ptm = gmtime_r(&seconds, &tmbuf); - if (ptm) { - char buf[32]; - if (!strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", ptm)) - return AVERROR_EXTERNAL; - av_strlcatf(buf, sizeof(buf), ".%06dZ", (int)(timestamp % 1000000)); - av_dict_set(&s->metadata, "creation_time", buf, 0); - } else { - return AVERROR_EXTERNAL; - } - } + if (ret == 1) + return avpriv_dict_set_timestamp(&s->metadata, "creation_time", timestamp); return ret; } |