aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mxfdec.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2021-02-02 06:40:03 +0800
committerLimin Wang <lance.lmwang@gmail.com>2021-02-05 09:27:05 +0800
commit3f8db7eea0bc22148f0e27906d85975708b842ea (patch)
tree473466f1d32eb1feebd59a096cc73fb9e6349be8 /libavformat/mxfdec.c
parentcba716f55e79ebb2db9627c6e3e11d6fc77ae737 (diff)
downloadffmpeg-3f8db7eea0bc22148f0e27906d85975708b842ea.tar.gz
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@acc.umu.se> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavformat/mxfdec.c')
-rw-r--r--libavformat/mxfdec.c24
1 files changed, 24 insertions, 0 deletions
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;