libavformat/mxfenc.c: Add 'Presentation Y offset' metadata
authorTim Nicholson <tim.nicholson@bbc.co.uk>
Mon, 30 Mar 2015 10:11:17 +0000 (11:11 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 30 Mar 2015 13:03:41 +0000 (15:03 +0200)
Previously unset, and some software mishandles files if it is absent

Signed-off-by: Tim Nicholson <tim.nicholson@bbc.co.uk>
Reviewed-by: tomas.hardin@codemill.se
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mxfenc.c
tests/ref/lavf/mxf
tests/ref/lavf/mxf_d10
tests/ref/lavf/mxf_opatom

index ac60357..7b400b3 100644 (file)
@@ -406,6 +406,7 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
     { 0x3202, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x02,0x01,0x00,0x00,0x00}}, /* Stored Height */
     { 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 */
+    { 0x320B, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0E,0x00,0x00,0x00}}, /* Presentation Y offset */
     { 0x320E, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x00,0x00,0x00}}, /* Aspect Ratio */
     { 0x3201, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x06,0x01,0x00,0x00,0x00,0x00}}, /* Picture Essence Coding */
     { 0x3212, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x03,0x01,0x06,0x00,0x00,0x00}}, /* Field Dominance (Opt) */
@@ -978,7 +979,7 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
     int stored_height = (st->codec->height+15)/16*16;
     int display_height;
     int f1, f2;
-    unsigned desc_size = size+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20;
+    unsigned desc_size = size+8+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20;
     if (sc->interlaced && sc->field_dominance)
         desc_size += 5;
 
@@ -1003,6 +1004,10 @@ 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
+    mxf_write_local_tag(pb, 4, 0x320B);
+    avio_wb32(pb, (st->codec->height - display_height)>>sc->interlaced);
+
     // component depth
     mxf_write_local_tag(pb, 4, 0x3301);
     avio_wb32(pb, sc->component_depth);
index 8ead434..5fb984b 100644 (file)
@@ -1,9 +1,9 @@
-306708cc2ad2414def89fa2f3c0bfc5c *./tests/data/lavf/lavf.mxf
+613b160bf09927661d9455dd975ad780 *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1
-f465084f0c365926a81aab56fb6b945c *./tests/data/lavf/lavf.mxf
+64471cfc480751f2ca7998c4edbc7a02 *./tests/data/lavf/lavf.mxf
 560697 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x11a6178e
-52fc707e1177c97232e2537168c232e6 *./tests/data/lavf/lavf.mxf
+a546bd6d8fe1608690bf2fc326cab0c3 *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1
index 71707ca..8201557 100644 (file)
@@ -1,3 +1,3 @@
-8f601d5b55a0665cc105a115dc8b3af0 *./tests/data/lavf/lavf.mxf_d10
+22dca5c8d62fe7ad1c56416ae736d6c1 *./tests/data/lavf/lavf.mxf_d10
 5330989 ./tests/data/lavf/lavf.mxf_d10
 ./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488
index 5529e5b..0dd59c1 100644 (file)
@@ -1,3 +1,3 @@
-0f753a141424e2a1b44e6390f70172eb *./tests/data/lavf/lavf.mxf_opatom
+5df0bb1083cbe0ef3a70e4a93e44d812 *./tests/data/lavf/lavf.mxf_opatom
 4717113 ./tests/data/lavf/lavf.mxf_opatom
 ./tests/data/lavf/lavf.mxf_opatom CRC=0xbdd696b9