Commit 0a64e789 authored by conrad's avatar conrad

Write the creation time


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10336 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 90089411
...@@ -127,6 +127,18 @@ static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const cha ...@@ -127,6 +127,18 @@ static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const cha
put_ebml_binary(pb, elementid, str, strlen(str)); put_ebml_binary(pb, elementid, str, strlen(str));
} }
// avtime is POSIX time, microseconds
static void put_ebml_date(ByteIOContext *pb, unsigned int elementid, int64_t avtime)
{
// midnight Jan 1, 1970 in UNIX epoch, microseconds
const int64_t ebmlDateStart = 978307200ULL * 1000000;
int64_t ebmlTime = (avtime - ebmlDateStart) * 1000;
put_ebml_id(pb, elementid);
put_ebml_size(pb, 8, 0);
put_be64(pb, ebmlTime);
}
// this reserves exactly the amount of space specified by size, which must be at least 2 // this reserves exactly the amount of space specified by size, which must be at least 2
static void put_ebml_void(ByteIOContext *pb, uint64_t size) static void put_ebml_void(ByteIOContext *pb, uint64_t size)
{ {
...@@ -526,6 +538,7 @@ static int mkv_write_header(AVFormatContext *s) ...@@ -526,6 +538,7 @@ static int mkv_write_header(AVFormatContext *s)
if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
put_ebml_string(pb, MATROSKA_ID_MUXINGAPP , LIBAVFORMAT_IDENT); put_ebml_string(pb, MATROSKA_ID_MUXINGAPP , LIBAVFORMAT_IDENT);
put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT); put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT);
put_ebml_date (pb, MATROSKA_ID_DATEUTC , av_gettime() );
} }
// XXX: segment UID // XXX: segment UID
// reserve space for the duration // reserve space for the duration
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment