[FFmpeg-devel] [PATCH v7 1/3] avformat/mxfdec: set toolkit version metadata

Tomas Härdin tjoppen at acc.umu.se
Thu Feb 4 20:34:35 EET 2021


tis 2021-02-02 klockan 20:47 +0800 skrev lance.lmwang at gmail.com:
> From: Limin Wang <lance.lmwang at gmail.com>
> 
> 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>
> ---
>  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 93fa7a9..18db056 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)

Looks OK

/Tomas



More information about the ffmpeg-devel mailing list