changeset 4716:7c99a46b3f3d libavformat

use utc time for timestamp and do not set it if not specified
author bcoudurier
date Sat, 14 Mar 2009 23:39:52 +0000
parents 2b75450ca0a9
children ee2dd1b3afc3
files mxfenc.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mxfenc.c	Sat Mar 14 22:51:38 2009 +0000
+++ b/mxfenc.c	Sat Mar 14 23:39:52 2009 +0000
@@ -1368,7 +1368,7 @@
 
 static uint64_t mxf_parse_timestamp(time_t timestamp)
 {
-    struct tm *time = localtime(&timestamp);
+    struct tm *time = gmtime(&timestamp);
     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 @@
         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 @@
         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));