]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/mxfenc.c
mxfdec: Make sure mxf->nb_index_tables > 0 in mxf_packet_timestamps()
[ffmpeg] / libavformat / mxfenc.c
index 0acd74b3e796d8e83614492bac7047a9a80bd7bc..881902b2f8a050d3c1cf396e1fbf258466fc5c86 100644 (file)
@@ -70,7 +70,7 @@ typedef struct {
     int index;               ///< index in mxf_essence_container_uls table
     const UID *codec_ul;
     int order;               ///< interleaving order if dts are equal
-    int interlaced;          ///< wether picture is interlaced
+    int interlaced;          ///< whether picture is interlaced
     int temporal_reordering;
     AVRational aspect_ratio; ///< display aspect ratio
     int closed_gop;          ///< gop is closed, used in mpeg-2 frame parsing
@@ -1287,6 +1287,8 @@ static const UID mxf_mpeg2_codec_uls[] = {
     { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x03,0x03,0x00 }, // MP-HL Long GOP
     { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x04,0x02,0x00 }, // 422P-HL I-Frame
     { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x04,0x03,0x00 }, // 422P-HL Long GOP
+    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x05,0x02,0x00 }, // MP@H-14 I-Frame
+    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x05,0x03,0x00 }, // MP@H-14 Long GOP
 };
 
 static const UID *mxf_get_mpeg2_codec_ul(AVCodecContext *avctx)
@@ -1298,6 +1300,8 @@ static const UID *mxf_get_mpeg2_codec_ul(AVCodecContext *avctx)
             return &mxf_mpeg2_codec_uls[0+long_gop];
         else if (avctx->level == 4) // High
             return &mxf_mpeg2_codec_uls[4+long_gop];
+        else if (avctx->level == 6) // High 14
+            return &mxf_mpeg2_codec_uls[8+long_gop];
     } else if (avctx->profile == 0) { // 422
         if (avctx->level == 5) // Main
             return &mxf_mpeg2_codec_uls[2+long_gop];
@@ -1424,11 +1428,11 @@ static int mxf_write_header(AVFormatContext *s)
                 av_log(s, AV_LOG_ERROR, "unsupported video frame rate\n");
                 return -1;
             }
-            av_set_pts_info(st, 64, mxf->time_base.num, mxf->time_base.den);
+            avpriv_set_pts_info(st, 64, mxf->time_base.num, mxf->time_base.den);
             if (mxf->tc.str) {
                 mxf->tc.rate.num = mxf->time_base.den;
                 mxf->tc.rate.den = mxf->time_base.num;
-                if (ff_init_smtpe_timecode(s, &mxf->tc) < 0)
+                if (avpriv_init_smpte_timecode(s, &mxf->tc) < 0)
                     return -1;
             }
             if (s->oformat == &ff_mxf_d10_muxer) {
@@ -1458,7 +1462,7 @@ static int mxf_write_header(AVFormatContext *s)
                 av_log(s, AV_LOG_ERROR, "only 48khz is implemented\n");
                 return -1;
             }
-            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
+            avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
             if (s->oformat == &ff_mxf_d10_muxer) {
                 if (st->index != 1) {
                     av_log(s, AV_LOG_ERROR, "MXF D-10 only support one audio track\n");
@@ -1568,9 +1572,9 @@ static void mxf_write_system_item(AVFormatContext *s)
     avio_w8(pb, 0x81); // SMPTE 12M time code
     time_code = frame;
     if (mxf->tc.drop)
-        time_code = ff_framenum_to_drop_timecode(time_code);
-    time_code = ff_framenum_to_smtpe_timecode(time_code, mxf->timecode_base,
-                                              mxf->tc.drop);
+        time_code = avpriv_framenum_to_drop_timecode(time_code);
+    time_code = avpriv_framenum_to_smpte_timecode(time_code, mxf->timecode_base,
+                                                  mxf->tc.drop);
     avio_wb32(pb, time_code);
     avio_wb32(pb, 0); // binary group data
     avio_wb64(pb, 0);
@@ -1867,7 +1871,7 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int
                                mxf_interleave_get_packet, mxf_compare_timestamps);
 }
 
-static const AVClass class = {
+static const AVClass mxf_class = {
     .class_name = "mxf",
     .item_name  = av_default_item_name,
     .version    = LIBAVUTIL_VERSION_INT,
@@ -1877,6 +1881,16 @@ static const AVClass class = {
     },
 };
 
+static const AVClass mxf_d10_class = {
+    .class_name = "mxf_d10",
+    .item_name  = av_default_item_name,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .option     = (const AVOption[]){
+        {TIMECODE_OPT(MXFContext, AV_OPT_FLAG_ENCODING_PARAM)},
+        {NULL}
+    },
+};
+
 AVOutputFormat ff_mxf_muxer = {
     .name              = "mxf",
     .long_name         = NULL_IF_CONFIG_SMALL("Material eXchange Format"),
@@ -1890,7 +1904,7 @@ AVOutputFormat ff_mxf_muxer = {
     .write_trailer     = mxf_write_footer,
     .flags             = AVFMT_NOTIMESTAMPS,
     .interleave_packet = mxf_interleave,
-    .priv_class        = &class,
+    .priv_class        = &mxf_class,
 };
 
 AVOutputFormat ff_mxf_d10_muxer = {
@@ -1905,5 +1919,5 @@ AVOutputFormat ff_mxf_d10_muxer = {
     .write_trailer     = mxf_write_footer,
     .flags             = AVFMT_NOTIMESTAMPS,
     .interleave_packet = mxf_interleave,
-    .priv_class        = &class,
+    .priv_class        = &mxf_d10_class,
 };