avformat/mxfenc: Add Sample width/height/x offset/y offset, Display x offset and...
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 17 Mar 2018 22:06:13 +0000 (23:06 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 11 May 2018 23:08:01 +0000 (01:08 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mxfenc.c
tests/ref/fate/copy-trac4914
tests/ref/fate/mxf-reel_name
tests/ref/fate/time_base
tests/ref/lavf/mxf
tests/ref/lavf/mxf_d10
tests/ref/lavf/mxf_dv25
tests/ref/lavf/mxf_dvcpro50
tests/ref/lavf/mxf_opatom
tests/ref/lavf/mxf_opatom_audio

index 83b7fff..f955b50 100644 (file)
@@ -481,9 +481,16 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
     { 0x320D, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x03,0x02,0x05,0x00,0x00,0x00}}, /* Video Line Map */
     { 0x3203, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x02,0x02,0x00,0x00,0x00}}, /* Stored Width */
     { 0x3202, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x02,0x01,0x00,0x00,0x00}}, /* Stored Height */
+    { 0x3216, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x01,0x03,0x02,0x08,0x00,0x00,0x00}}, /* Stored F2 Offset */
+    { 0x3205, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x08,0x00,0x00,0x00}}, /* Sampled Width */
+    { 0x3204, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x07,0x00,0x00,0x00}}, /* Sampled Height */
+    { 0x3206, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x09,0x00,0x00,0x00}}, /* Sampled X Offset */
+    { 0x3207, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0A,0x00,0x00,0x00}}, /* Sampled Y Offset */
     { 0x3209, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0C,0x00,0x00,0x00}}, /* Display Width */
     { 0x3208, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0B,0x00,0x00,0x00}}, /* Display Height */
+    { 0x320A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0D,0x00,0x00,0x00}}, /* Display X offset */
     { 0x320B, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0E,0x00,0x00,0x00}}, /* Presentation Y offset */
+    { 0x3217, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x01,0x03,0x02,0x07,0x00,0x00,0x00}}, /* Display F2 offset */
     { 0x320E, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x00,0x00,0x00}}, /* Aspect Ratio */
     { 0x3210, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x02,0x01,0x01,0x01,0x02,0x00}}, /* Transfer characteristic */
     { 0x3213, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x18,0x01,0x02,0x00,0x00,0x00,0x00}}, /* Image Start Offset */
@@ -1173,13 +1180,15 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
     int stored_height = (st->codecpar->height+15)/16*16;
     int display_height;
     int f1, f2;
-    unsigned desc_size = size+8+8+8+8+8+8+8+5+16+4+12+20+5 + 6;
+    unsigned desc_size = size+8+8+8+8+8+8+8+5+16+4+12+20+5 + 5*8 + 6;
     UID transfer_ul = {0};
 
     if (sc->interlaced && sc->field_dominance)
         desc_size += 5;
     if (sc->signal_standard)
         desc_size += 5;
+    if (sc->interlaced)
+        desc_size += 8;
     if (sc->v_chroma_sub_sample)
         desc_size += 8;
     if (st->codecpar->color_range != AVCOL_RANGE_UNSPECIFIED)
@@ -1211,6 +1220,22 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
         avio_wb32(pb, 0);
     }
 
+    //Sampled width
+    mxf_write_local_tag(pb, 4, 0x3205);
+    avio_wb32(pb, st->codecpar->width);
+
+    //Samples height
+    mxf_write_local_tag(pb, 4, 0x3204);
+    avio_wb32(pb, st->codecpar->height>>sc->interlaced);
+
+    //Sampled X Offset
+    mxf_write_local_tag(pb, 4, 0x3206);
+    avio_wb32(pb, 0);
+
+    //Sampled Y Offset
+    mxf_write_local_tag(pb, 4, 0x3207);
+    avio_wb32(pb, 0);
+
     mxf_write_local_tag(pb, 4, 0x3209);
     avio_wb32(pb, st->codecpar->width);
 
@@ -1224,10 +1249,20 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
     mxf_write_local_tag(pb, 4, 0x3208);
     avio_wb32(pb, display_height>>sc->interlaced);
 
-    // presentation Y offset
+    // display X offset
+    mxf_write_local_tag(pb, 4, 0x320A);
+    avio_wb32(pb, 0);
+
+    // display Y offset
     mxf_write_local_tag(pb, 4, 0x320B);
     avio_wb32(pb, (st->codecpar->height - display_height)>>sc->interlaced);
 
+    if (sc->interlaced) {
+        //Display F2 Offset
+        mxf_write_local_tag(pb, 4, 0x3217);
+        avio_wb32(pb, -((st->codecpar->height - display_height)&1));
+    }
+
     // component depth
     mxf_write_local_tag(pb, 4, 0x3301);
     avio_wb32(pb, sc->component_depth);
index 231cdaf..a805699 100644 (file)
@@ -1,4 +1,4 @@
-efa819aae97478b7e8e486a52e7ca7ab *tests/data/fate/copy-trac4914.mxf
+ed7921a1218fce5ca0fd27217ddd7863 *tests/data/fate/copy-trac4914.mxf
 561721 tests/data/fate/copy-trac4914.mxf
 #tb 0: 1001/30000
 #media_type 0: video
index 8985965..273e51d 100644 (file)
@@ -1 +1 @@
-159c175b80f35b924ef55293ef433d0a
+02b2c67154665a72c6adebe9c234b778
index 460eae1..d5fd8e0 100644 (file)
@@ -1 +1 @@
-aa60f92877322f9e22c90d4fc508d73a
+b27e3b5e01771daa4425db36366aafb5
index b3be23f..30a7846 100644 (file)
@@ -1,9 +1,9 @@
-24b059ddbf6022df8059b7e13a11d2a9 *./tests/data/lavf/lavf.mxf
+93367bc02b8997b84224e7eb359cae8a *./tests/data/lavf/lavf.mxf
 526393 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-937b67f0d27d44da8f10f862445a376b *./tests/data/lavf/lavf.mxf
+0087ea968d20cc9192456fcd4c00019e *./tests/data/lavf/lavf.mxf
 561721 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-ffb3f5fb2473ce2895ffc0b6ca38ba1f *./tests/data/lavf/lavf.mxf
+7754550ff6fe5895555610f586a15fc5 *./tests/data/lavf/lavf.mxf
 526393 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
index e3d764c..4c27204 100644 (file)
@@ -1,3 +1,3 @@
-f429e5c52dadb28236bd72c75544f757 *./tests/data/lavf/lavf.mxf_d10
+693c6e28c56607aba86e73da3d14cecf *./tests/data/lavf/lavf.mxf_d10
 5332013 ./tests/data/lavf/lavf.mxf_d10
 ./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488
index d22bb31..ac9147d 100644 (file)
@@ -1,3 +1,3 @@
-f570a233ee440058987a5b9f3642fea5 *./tests/data/lavf/lavf.mxf_dv25
+37ad73c526ecc698dbae5a8995c7dd4d *./tests/data/lavf/lavf.mxf_dv25
 3834413 ./tests/data/lavf/lavf.mxf_dv25
 ./tests/data/lavf/lavf.mxf_dv25 CRC=0xbdaf7f52
index 9d0db2b..19740a9 100644 (file)
@@ -1,3 +1,3 @@
-914aed46af112523de45ae3487aa6d79 *./tests/data/lavf/lavf.mxf_dvcpro50
+8e989e5eb6f64741c1f3f2a9bfdb6f9a *./tests/data/lavf/lavf.mxf_dvcpro50
 7431213 ./tests/data/lavf/lavf.mxf_dvcpro50
 ./tests/data/lavf/lavf.mxf_dvcpro50 CRC=0xe3bbe4b4
index 13a4ff3..29b1b58 100644 (file)
@@ -1,3 +1,3 @@
-75ccb51d422e319f4b284a94815bb0c7 *./tests/data/lavf/lavf.mxf_opatom
+b6e1fde300f68808ead5c316fd9a4543 *./tests/data/lavf/lavf.mxf_opatom
 4717625 ./tests/data/lavf/lavf.mxf_opatom
 ./tests/data/lavf/lavf.mxf_opatom CRC=0xf55aa22a
index f8bfb60..a86aa99 100644 (file)
@@ -1,3 +1,3 @@
-55868441de7088b20438417ecdf77d93 *./tests/data/lavf/lavf.mxf_opatom_audio
+cc0dc4aacd82f5495456000c4ce38b08 *./tests/data/lavf/lavf.mxf_opatom_audio
 102969 ./tests/data/lavf/lavf.mxf_opatom_audio
 ./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff