mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-06 09:22:36 +08:00
avformat: factorize iso 8601 timestamp writer to a dictionary avutil function
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user