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>
This commit is contained in:
Limin Wang 2021-02-02 06:40:03 +08:00
parent cba716f55e
commit 3f8db7eea0
3 changed files with 26 additions and 0 deletions

View File

@ -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;

View File

@ -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]

View File

@ -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