[FFmpeg-devel] [PATCH 1/2] Add TargetTypeValue in Matroska tag prefix

Nicolas George george at nsup.org
Wed Feb 3 16:22:03 CET 2016


Le quartidi 14 pluviôse, an CCXXIV, Pierre Choffet a écrit :
> Previously, the Matroska tag names were structured like this:
>   [<TargetType>/]<TagName>
> This lead to an issue when <TargetType> is not available: the different levels tags overwrite each
> other when they have the same name.
> 
> This patch transforms the name prefix into:
>   <TargetTypeValue>[-<TargetType>]/<TagName>
> 
> As the TargetTypeValue has default value in case it has no data, it prevents from overriding of other levels
> tags.
> ---
>  libavformat/matroskadec.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index d788232..d7d0e54 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -1460,8 +1460,16 @@ static void matroska_convert_tags(AVFormatContext *s)
>                         i, tags[i].target.trackuid);
>              }
>          } else {
> -            matroska_convert_tag(s, &tags[i].tag, &s->metadata,
> -                                 tags[i].target.type);

> +            char *prefix;
> +            if (tags[i].target.type)
> +                prefix = av_asprintf("%"PRIu64"-%s",
> +                                     tags[i].target.typevalue,
> +                                     tags[i].target.type);
> +            else
> +                prefix = av_asprintf("%"PRIu64, tags[i].target.typevalue);
> +
> +            matroska_convert_tag(s, &tags[i].tag, &s->metadata, prefix);
> +            av_free(prefix);

Thanks for the change, but with asprintf, checks for allocation failure are
necessary.

>          }
>      }
>  }

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160203/fc79a643/attachment.sig>


More information about the ffmpeg-devel mailing list