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

Pierre Choffet peuc at wanadoo.fr
Tue Feb 2 18:59:56 CET 2016


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);
         }
     }
 }
-- 
2.7.0



More information about the ffmpeg-devel mailing list