From ed6ae6a58b8e2b6406bd6d4d4ab3de229ca7e7b7 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Sat, 14 Mar 2009 23:39:52 +0000 Subject: [PATCH] use utc time for timestamp and do not set it if not specified Originally committed as revision 17971 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/mxfenc.c | 8 ++++---- tests/libav.regression.ref | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 2732d8b..ab8f36b 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1368,7 +1368,7 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt static uint64_t mxf_parse_timestamp(time_t timestamp) { - struct tm *time = localtime(×tamp); + struct tm *time = gmtime(×tamp); return (uint64_t)(time->tm_year+1900) << 48 | (uint64_t)(time->tm_mon+1) << 40 | (uint64_t) time->tm_mday << 32 | @@ -1490,10 +1490,8 @@ static int mxf_write_header(AVFormatContext *s) mxf->essence_container_count = 1; } - if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { + if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) mxf_gen_umid(s); - mxf->timestamp = mxf_parse_timestamp(s->timestamp); - } for (i = 0; i < s->nb_streams; i++) { MXFStreamContext *sc = s->streams[i]->priv_data; @@ -1502,6 +1500,8 @@ static int mxf_write_header(AVFormatContext *s) sc->order = AV_RB32(sc->track_essence_element_key+12); } + if (s->timestamp) + mxf->timestamp = mxf_parse_timestamp(s->timestamp); mxf->duration = -1; mxf->timecode_track = av_mallocz(sizeof(*mxf->timecode_track)); diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref index 27c2f38..017afd3 100644 --- a/tests/libav.regression.ref +++ b/tests/libav.regression.ref @@ -9,10 +9,10 @@ c351132527ccb1e8cab06cc0822fde23 *./tests/data/b-libav.rm bdb7484c68db722f66ba1630cf79844c *./tests/data/b-libav.mpg 378880 ./tests/data/b-libav.mpg ./tests/data/b-libav.mpg CRC=0x2b71a386 -ece97d012890ba7f2371246a5f245561 *./tests/data/b-libav.mxf +259a87c8d22aab76665047ecdbfa9267 *./tests/data/b-libav.mxf 535097 ./tests/data/b-libav.mxf ./tests/data/b-libav.mxf CRC=0xd7ff387d -89fe0716dee263dd0f52b2d49ad87d38 *./tests/data/b-libav.mxf_d10 +0a7cc51de3da754ce36dffeeda290c45 *./tests/data/b-libav.mxf_d10 5330989 ./tests/data/b-libav.mxf_d10 ./tests/data/b-libav.mxf_d10 CRC=0xd241c8b6 c0cc2ae4df6a8b3df84986929a393116 *./tests/data/b-libav.ts -- 2.7.4