avformat/mxfenc: Add Product Version, Toolkit version and Platform
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 17 Mar 2018 15:01:15 +0000 (16:01 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 8 May 2018 21:02:58 +0000 (23:02 +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 fcaa330..a9338f7 100644 (file)
@@ -431,9 +431,12 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
     { 0x3C09, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x01,0x00,0x00,0x00}}, /* This Generation UID */
     { 0x3C01, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x02,0x01,0x00,0x00}}, /* Company Name */
     { 0x3C02, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x03,0x01,0x00,0x00}}, /* Product Name */
+    { 0x3C03, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x04,0x00,0x00,0x00}}, /* Product Version */
     { 0x3C04, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x05,0x01,0x00,0x00}}, /* Version String */
     { 0x3C05, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x07,0x00,0x00,0x00}}, /* Product ID */
     { 0x3C06, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x10,0x02,0x03,0x00,0x00}}, /* Modification Date */
+    { 0x3C07, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x0A,0x00,0x00,0x00}}, /* Toolkit Version */
+    { 0x3C08, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x06,0x01,0x00,0x00}}, /* Platform */
     // Content Storage
     { 0x1901, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x05,0x01,0x00,0x00}}, /* Package strong reference batch */
     { 0x1902, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x05,0x02,0x00,0x00}}, /* Package strong reference batch */
@@ -776,6 +779,22 @@ static void mxf_write_local_tag_utf16(AVIOContext *pb, int tag, const char *valu
     avio_put_str16be(pb, value);
 }
 
+static void store_version(AVFormatContext *s){
+    AVIOContext *pb = s->pb;
+
+    if (s->flags & AVFMT_FLAG_BITEXACT) {
+        avio_wb16(pb, 0); // major
+        avio_wb16(pb, 0); // minor
+        avio_wb16(pb, 0); // tertiary
+    } else {
+        avio_wb16(pb, LIBAVFORMAT_VERSION_MAJOR); // major
+        avio_wb16(pb, LIBAVFORMAT_VERSION_MINOR); // minor
+        avio_wb16(pb, LIBAVFORMAT_VERSION_MICRO); // tertiary
+    }
+    avio_wb16(pb, 0); // patch
+    avio_wb16(pb, 0); // release
+}
+
 static void mxf_write_identification(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
@@ -790,7 +809,7 @@ static void mxf_write_identification(AVFormatContext *s)
 
     version = s->flags & AVFMT_FLAG_BITEXACT ?
         "0.0.0" : AV_STRINGIFY(LIBAVFORMAT_VERSION);
-    length = 72 + mxf_utf16_local_tag_length(company) +
+    length = 100 +mxf_utf16_local_tag_length(company) +
                   mxf_utf16_local_tag_length(product) +
                   mxf_utf16_local_tag_length(version);
     klv_encode_ber_length(pb, length);
@@ -805,6 +824,10 @@ static void mxf_write_identification(AVFormatContext *s)
     mxf_write_uuid(pb, Identification, 1);
     mxf_write_local_tag_utf16(pb, 0x3C01, company); // Company Name
     mxf_write_local_tag_utf16(pb, 0x3C02, product); // Product Name
+
+    mxf_write_local_tag(pb, 10, 0x3C03); // Product Version
+    store_version(s);
+
     mxf_write_local_tag_utf16(pb, 0x3C04, version); // Version String
 
     // write product uid
@@ -814,6 +837,9 @@ static void mxf_write_identification(AVFormatContext *s)
     // modification date
     mxf_write_local_tag(pb, 8, 0x3C06);
     avio_wb64(pb, mxf->timestamp);
+
+    mxf_write_local_tag(pb, 10, 0x3C07); // Toolkit Version
+    store_version(s);
 }
 
 static void mxf_write_content_storage(AVFormatContext *s, MXFPackage *packages, int package_count)
index 0964f96..e5b9ee2 100644 (file)
@@ -1,4 +1,4 @@
-6da61d6b9b654c9b1e8f70be01fae7f7 *tests/data/fate/copy-trac4914.mxf
+da66943da7ede9d7409c78befa3c1b95 *tests/data/fate/copy-trac4914.mxf
 561209 tests/data/fate/copy-trac4914.mxf
 #tb 0: 1001/30000
 #media_type 0: video
index ecd818f..a22d058 100644 (file)
@@ -1 +1 @@
-3d81a5c7479617d2f082a828db5e1d80
+d35f74e97bb8a3d5cadc1df69d82dcf9
index a1c578a..13c7eca 100644 (file)
@@ -1 +1 @@
-39441bec6d05cd65adc0f5b8557fe8ad
+6222dfa98933f06afb9992ab6c21486c
index a5f3db2..c9a1ce8 100644 (file)
@@ -1,9 +1,9 @@
-0c59c7eb43abd8fbd9eab41dc0bec1d0 *./tests/data/lavf/lavf.mxf
+707059147bb7569509cf3b697b54d701 *./tests/data/lavf/lavf.mxf
 525881 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-6b0e6f16dfd1ba0524bf14f16d50b86d *./tests/data/lavf/lavf.mxf
+5af94bc17e47190a1e2943a461c836ff *./tests/data/lavf/lavf.mxf
 561209 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-b9e4dbb9a9b65fadf47509ef2b094fe5 *./tests/data/lavf/lavf.mxf
+523ed9d06ab7a4090f9a29fa7abf7a03 *./tests/data/lavf/lavf.mxf
 525881 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
index 6db0d0e..2e6e13f 100644 (file)
@@ -1,3 +1,3 @@
-bac717411fd88894e71db6b5268a75bc *./tests/data/lavf/lavf.mxf_d10
+07a242f1881f0349e4ed10a4f1584ddb *./tests/data/lavf/lavf.mxf_d10
 5331501 ./tests/data/lavf/lavf.mxf_d10
 ./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488
index b17542b..e192f91 100644 (file)
@@ -1,3 +1,3 @@
-06549669b096e58a3a57279004532ed2 *./tests/data/lavf/lavf.mxf_dv25
+8117b64eaee48b9b6f8be964afbed8e0 *./tests/data/lavf/lavf.mxf_dv25
 3833901 ./tests/data/lavf/lavf.mxf_dv25
 ./tests/data/lavf/lavf.mxf_dv25 CRC=0xbdaf7f52
index 6411576..4d6b45d 100644 (file)
@@ -1,3 +1,3 @@
-6b3297c1f3af13398719ffd4e194e87b *./tests/data/lavf/lavf.mxf_dvcpro50
+d6e87fb17a89a8a8fff96e0fd9d6fd4a *./tests/data/lavf/lavf.mxf_dvcpro50
 7430701 ./tests/data/lavf/lavf.mxf_dvcpro50
 ./tests/data/lavf/lavf.mxf_dvcpro50 CRC=0xe3bbe4b4
index 153537e..969e2bc 100644 (file)
@@ -1,3 +1,3 @@
-e1568a9638de2883ca8cfa63c044432c *./tests/data/lavf/lavf.mxf_opatom
+fea3ed4c2e5088701154530cb2a57f98 *./tests/data/lavf/lavf.mxf_opatom
 4717113 ./tests/data/lavf/lavf.mxf_opatom
 ./tests/data/lavf/lavf.mxf_opatom CRC=0xf55aa22a
index ffddde0..84ac7b2 100644 (file)
@@ -1,3 +1,3 @@
-63a33b96d0a8e10d5e9dd6c1dfd2b63b *./tests/data/lavf/lavf.mxf_opatom_audio
+71735ea72b3bdcfa3455d51bc439aa57 *./tests/data/lavf/lavf.mxf_opatom_audio
 102457 ./tests/data/lavf/lavf.mxf_opatom_audio
 ./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff