From 86c92509231f67a2397f0d98530e5dca1720d1f3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 17 Mar 2018 16:01:15 +0100 Subject: avformat/mxfenc: Add Product Version, Toolkit version and Platform Signed-off-by: Michael Niedermayer --- libavformat/mxfenc.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'libavformat/mxfenc.c') diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index fcaa330902..a9338f7bc3 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -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) -- cgit v1.2.3