diff options
author | Aaron Colwell <acolwell@chromium.org> | 2012-03-05 19:02:48 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-05 19:02:48 +0100 |
commit | 2e061130f422e870824eee5505bfde01ff70086f (patch) | |
tree | 2b5a2ef3cbc28fc478ac2aacc7851502703683b3 /libavformat/matroskaenc.c | |
parent | c7048036dbe6e61b53f72f6950de021abe44bd4c (diff) | |
download | ffmpeg-2e061130f422e870824eee5505bfde01ff70086f.tar.gz |
matroska : Add support for reading/writing creation_time metadata.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 0ee83486a6..0b367251f6 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -940,6 +940,14 @@ static int mkv_write_header(AVFormatContext *s) put_ebml_binary(pb, MATROSKA_ID_SEGMENTUID, segment_uid, 16); } + if (tag = av_dict_get(s->metadata, "creation_time", NULL, 0)) { + // Adjust time so it's relative to 2001-01-01 and convert to nanoseconds. + int64_t date_utc = (ff_iso8601_to_unix_time(tag->value) - 978307200) * 1000000000; + uint8_t date_utc_buf[8]; + AV_WB64(date_utc_buf, date_utc); + put_ebml_binary(pb, MATROSKA_ID_DATEUTC, date_utc_buf, 8); + } + // reserve space for the duration mkv->duration = 0; mkv->duration_offset = avio_tell(pb); |