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

Pierre Choffet peuc at wanadoo.fr
Thu Jan 28 02:00:23 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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index d788232..ba3c4e1 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1460,8 +1460,14 @@ static void matroska_convert_tags(AVFormatContext *s)
                        i, tags[i].target.trackuid);
             }
         } else {
+            char prefix[1024];
+            sprintf(prefix, "%" PRIu64, tags[i].target.typevalue);
+            if (tags[i].target.type) {
+                strncat(prefix, "-", sizeof(char));
+                av_strlcat(prefix, tags[i].target.type, strlen(tags[i].target.type) - 22);
+            }
             matroska_convert_tag(s, &tags[i].tag, &s->metadata,
-                                 tags[i].target.type);
+                                 prefix);
         }
     }
 }
-- 
2.7.0



More information about the ffmpeg-devel mailing list