[FFmpeg-cvslog] avformat/mxfdec: set toolkit version metadata

Limin Wang git at videolan.org
Fri Feb 5 03:28:43 EET 2021


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Tue Feb  2 06:40:03 2021 +0800| [3f8db7eea0bc22148f0e27906d85975708b842ea] | committer: Limin Wang

avformat/mxfdec: set toolkit version metadata

Please check the string of toolkit version with below command:
./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy out.mxf
./ffmpeg -i out.mxf
....
toolkit_version : 58.65.101.0.0

Reviewed-by: Tomas Härdin <tjoppen at acc.umu.se>
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f8db7eea0bc22148f0e27906d85975708b842ea
---

 libavformat/mxfdec.c                | 24 ++++++++++++++++++++++++
 tests/ref/fate/mxf-probe-applehdr10 |  1 +
 tests/ref/fate/mxf-probe-dnxhd      |  1 +
 3 files changed, 26 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index d5fabd2a9a..9f22c386f0 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1978,6 +1978,15 @@ static int mxf_umid_to_str(UID ul, UID uid, char **str)
     return 0;
 }
 
+static int mxf_version_to_str(uint16_t major, uint16_t minor, uint16_t tertiary,
+                              uint16_t patch, uint16_t release, char **str)
+{
+    *str = av_asprintf("%d.%d.%d.%d.%d", major, minor, tertiary, patch, release);
+    if (!*str)
+        return AVERROR(ENOMEM);
+    return 0;
+}
+
 static int mxf_add_umid_metadata(AVDictionary **pm, const char *key, MXFPackage* package)
 {
     char *str;
@@ -2739,6 +2748,17 @@ static int64_t mxf_timestamp_to_int64(uint64_t timestamp)
     av_dict_set(&s->metadata, name, str, AV_DICT_DONT_STRDUP_VAL); \
 } while (0)
 
+#define SET_VERSION_METADATA(pb, name, major, minor, tertiary, patch, release, str) do { \
+    major = avio_rb16(pb); \
+    minor = avio_rb16(pb); \
+    tertiary = avio_rb16(pb); \
+    patch = avio_rb16(pb); \
+    release = avio_rb16(pb); \
+    if ((ret = mxf_version_to_str(major, minor, tertiary, patch, release, &str)) < 0) \
+        return ret; \
+    av_dict_set(&s->metadata, name, str, AV_DICT_DONT_STRDUP_VAL); \
+} while (0)
+
 #define SET_UID_METADATA(pb, name, var, str) do { \
     avio_read(pb, var, 16); \
     if ((ret = mxf_uid_to_str(var, &str)) < 0) \
@@ -2760,6 +2780,7 @@ static int mxf_read_identification_metadata(void *arg, AVIOContext *pb, int tag,
     UID uid = { 0 };
     char *str = NULL;
     uint64_t ts;
+    uint16_t major, minor, tertiary, patch, release;
     switch (tag) {
     case 0x3C01:
         SET_STR_METADATA(pb, "company_name", str);
@@ -2776,6 +2797,9 @@ static int mxf_read_identification_metadata(void *arg, AVIOContext *pb, int tag,
     case 0x3C06:
         SET_TS_METADATA(pb, "modification_date", ts, str);
         break;
+    case 0x3C07:
+        SET_VERSION_METADATA(pb, "toolkit_version", major, minor, tertiary, patch, release, str);
+        break;
     case 0x3C08:
         SET_STR_METADATA(pb, "application_platform", str);
         break;
diff --git a/tests/ref/fate/mxf-probe-applehdr10 b/tests/ref/fate/mxf-probe-applehdr10
index 53a767c1cd..0bf9bf1b63 100644
--- a/tests/ref/fate/mxf-probe-applehdr10
+++ b/tests/ref/fate/mxf-probe-applehdr10
@@ -164,6 +164,7 @@ TAG:product_name=Compressor
 TAG:product_version=4.4.7 (4.4.7)
 TAG:product_uid=00000000-0000-0000-0000-000000000000
 TAG:modification_date=2020-09-08T16:18:57.036000Z
+TAG:toolkit_version=3.8.0.171.1
 TAG:material_package_umid=0x060A2B340101010501010D201300000045843C9FE69D4B8FA90DDAAA1602A2E8
 TAG:timecode=00:01:15;26
 [/FORMAT]
diff --git a/tests/ref/fate/mxf-probe-dnxhd b/tests/ref/fate/mxf-probe-dnxhd
index 5a6221b1d5..74d1831f16 100644
--- a/tests/ref/fate/mxf-probe-dnxhd
+++ b/tests/ref/fate/mxf-probe-dnxhd
@@ -173,6 +173,7 @@ TAG:project_name=UHD
 TAG:uid=784c8132-ae36-ed4d-b0ff-2edf1f3f2d92
 TAG:generation_uid=b6bcfcab-70ff-7331-c47c-478869de11d2
 TAG:application_platform=AAFSDK (MacOS X)
+TAG:toolkit_version=1.1.0.0.0
 TAG:modification_date=2016-09-18T19:25:25.000000Z
 TAG:product_uid=acfbf03a-4f42-a231-d0b7-c06ecd3d4ad7
 TAG:product_version=Unknown version



More information about the ffmpeg-cvslog mailing list