]> git.sesse.net Git - ffmpeg/commitdiff
asfdec: support reading ID3v2 tags in ASF files
authorVladimir Pantelic <vladoman@gmail.com>
Fri, 8 Feb 2013 10:06:37 +0000 (11:06 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sat, 9 Feb 2013 17:57:21 +0000 (18:57 +0100)
Yes, these files do exist

Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Changelog
libavformat/asfdec.c

index c235727e423c2e71113b6c6eef7934a2ab216f76..f56c112a2421d7be470383cc64316236f33bd96d 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -3,6 +3,7 @@ releases are sorted from youngest to oldest.
 
 version 10:
 - av_strnstr
+- support ID3v2 tags in ASF files
 
 
 version 9:
index 51422ea13706f9763d9286a0989cfd92421fb232..0a315d4e364128531e5ae7a29040aeac39f5c0c2 100644 (file)
@@ -277,6 +277,16 @@ fail:
     return ret;
 }
 
+static void get_id3_tag(AVFormatContext *s, int len)
+{
+    ID3v2ExtraMeta *id3v2_extra_meta = NULL;
+
+    ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
+    if (id3v2_extra_meta)
+        ff_id3v2_parse_apic(s, &id3v2_extra_meta);
+    ff_id3v2_free_extra_meta(&id3v2_extra_meta);
+}
+
 static void get_tag(AVFormatContext *s, const char *key, int type, int len, int type2_size)
 {
     char *value;
@@ -291,12 +301,18 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len, int
 
     if (type == 0) {         // UTF16-LE
         avio_get_str16le(s->pb, len, value, 2 * len + 1);
+    } else if (type == 1) {  // byte array
+        if (!strcmp(key, "WM/Picture")) { // handle cover art
+            asf_read_picture(s, len);
+        } else if (!strcmp(key, "ID3")) { // handle ID3 tag
+            get_id3_tag(s, len);
+        } else {
+            av_log(s, AV_LOG_VERBOSE, "Unsupported byte array in tag %s.\n", key);
+        }
+        goto finish;
     } else if (type > 1 && type <= 5) {  // boolean or DWORD or QWORD or WORD
         uint64_t num = get_value(s->pb, type, type2_size);
         snprintf(value, len, "%"PRIu64, num);
-    } else if (type == 1 && !strcmp(key, "WM/Picture")) { // handle cover art
-        asf_read_picture(s, len);
-        goto finish;
     } else if (type == 6) { // (don't) handle GUID
         av_log(s, AV_LOG_DEBUG, "Unsupported GUID value in tag %s.\n", key);
         goto finish;