]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/mxfenc.c
avfilter/vf_xstack: set better error msg for
[ffmpeg] / libavformat / mxfenc.c
index 4f9f353ffc323f25b335afa1ea96ee1eed75d58e..8c6db94865c99a344a560acfcab8215351188e2d 100644 (file)
@@ -2332,8 +2332,9 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st,
     return !!sc->codec_ul;
 }
 
-static uint64_t mxf_parse_timestamp(time_t timestamp)
+static uint64_t mxf_parse_timestamp(int64_t timestamp64)
 {
+    time_t timestamp = timestamp64 / 1000000;
     struct tm tmbuf;
     struct tm *time = gmtime_r(&timestamp, &tmbuf);
     if (!time)
@@ -2343,7 +2344,8 @@ static uint64_t mxf_parse_timestamp(time_t timestamp)
            (uint64_t) time->tm_mday       << 32 |
                       time->tm_hour       << 24 |
                       time->tm_min        << 16 |
-                      time->tm_sec        << 8;
+                      time->tm_sec        << 8  |
+                      (timestamp64 % 1000000) / 4000;
 }
 
 static void mxf_gen_umid(AVFormatContext *s)
@@ -2580,7 +2582,7 @@ static int mxf_write_header(AVFormatContext *s)
             sc->order = AV_RB32(sc->track_essence_element_key+12);
     }
 
-    if (ff_parse_creation_time_metadata(s, &timestamp, 1) > 0)
+    if (ff_parse_creation_time_metadata(s, &timestamp, 0) > 0)
         mxf->timestamp = mxf_parse_timestamp(timestamp);
     mxf->duration = -1;
 
@@ -3040,7 +3042,7 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int
 }
 
 #define MXF_COMMON_OPTIONS \
-    { "signal_standard", "Force/set Sigal Standard",\
+    { "signal_standard", "Force/set Signal Standard",\
       offsetof(MXFContext, signal_standard), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 7, AV_OPT_FLAG_ENCODING_PARAM, "signal_standard"},\
     { "bt601", "ITU-R BT.601 and BT.656, also SMPTE 125M (525 and 625 line interlaced)",\
       0, AV_OPT_TYPE_CONST, {.i64 = 1}, -1, 7, AV_OPT_FLAG_ENCODING_PARAM, "signal_standard"},\
@@ -3093,6 +3095,8 @@ static const AVOption opatom_options[] = {
     { "mxf_audio_edit_rate", "Audio edit rate for timecode",
         offsetof(MXFContext, audio_edit_rate), AV_OPT_TYPE_RATIONAL, {.dbl=25}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
     MXF_COMMON_OPTIONS
+    { "store_user_comments", "",
+      offsetof(MXFContext, store_user_comments), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
     { NULL },
 };