[FFmpeg-devel] [PATCH 6/8] matroska: convert tag keys to uppercase when muxing.

Anton Khirnov wyskas
Wed Jun 2 15:16:03 CEST 2010


---
 libavformat/matroska.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index 4e7ed63..8ba1ee1 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -93,6 +93,24 @@ const CodecMime ff_mkv_mime_tags[] = {
     {""                           , CODEC_ID_NONE}
 };
 
+static void conv2native(AVMetadata **src, AVMetadata **dst)
+{
+    AVMetadataTag *t = NULL;
+
+    while ((t = av_metadata_get(*src, "", t, AV_METADATA_IGNORE_SUFFIX))) {
+        uint8_t *p = t->key;
+
+        /* convert to uppercase and replace ' ' -> '_' */
+        while (*p) {
+            if (*p == ' ')
+                *p = '_';
+            else if (*p >= 'a' && *p <= 'z')
+                *p = toupper(*p);
+            p++;
+        }
+    }
+}
+
 static const AVMetadataConvTable matroska_conv_table[] = {
     { "LEAD_PERFORMER", "performer" },
     { "PART_NUMBER"   , "track"  },
@@ -101,4 +119,5 @@ static const AVMetadataConvTable matroska_conv_table[] = {
 
 const AVMetadataConv ff_mkv_metadata_conv = {
     matroska_conv_table,
+    .conv2native = conv2native,
 };
-- 
1.7.1




More information about the ffmpeg-devel mailing list