Browse code

Merge commit 'f5fac6f77752931347ab302563802dcaa49c2419'

* commit 'f5fac6f77752931347ab302563802dcaa49c2419':
asfdec: support reading ID3v2 tags in ASF files

Conflicts:
Changelog
libavformat/asfdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/02/10 21:06:16
Showing 2 changed files
... ...
@@ -16,6 +16,7 @@ version <next>:
16 16
 - histogram filter
17 17
 - tee muxer
18 18
 - il filter ported from libmpcodecs
19
+- support ID3v2 tags in ASF files
19 20
 
20 21
 
21 22
 version 1.1:
... ...
@@ -267,6 +267,16 @@ fail:
267 267
     return ret;
268 268
 }
269 269
 
270
+static void get_id3_tag(AVFormatContext *s, int len)
271
+{
272
+    ID3v2ExtraMeta *id3v2_extra_meta = NULL;
273
+
274
+    ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
275
+    if (id3v2_extra_meta)
276
+        ff_id3v2_parse_apic(s, &id3v2_extra_meta);
277
+    ff_id3v2_free_extra_meta(&id3v2_extra_meta);
278
+}
279
+
270 280
 static void get_tag(AVFormatContext *s, const char *key, int type, int len, int type2_size)
271 281
 {
272 282
     char *value;
... ...
@@ -284,12 +294,18 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len, int
284 284
     } else if (type == -1) { // ASCII
285 285
         avio_read(s->pb, value, len);
286 286
         value[len]=0;
287
+    } else if (type == 1) {  // byte array
288
+        if (!strcmp(key, "WM/Picture")) { // handle cover art
289
+            asf_read_picture(s, len);
290
+        } else if (!strcmp(key, "ID3")) { // handle ID3 tag
291
+            get_id3_tag(s, len);
292
+        } else {
293
+            av_log(s, AV_LOG_VERBOSE, "Unsupported byte array in tag %s.\n", key);
294
+        }
295
+        goto finish;
287 296
     } else if (type > 1 && type <= 5) {  // boolean or DWORD or QWORD or WORD
288 297
         uint64_t num = get_value(s->pb, type, type2_size);
289 298
         snprintf(value, len, "%"PRIu64, num);
290
-    } else if (type == 1 && !strcmp(key, "WM/Picture")) { // handle cover art
291
-        asf_read_picture(s, len);
292
-        goto finish;
293 299
     } else if (type == 6) { // (don't) handle GUID
294 300
         av_log(s, AV_LOG_DEBUG, "Unsupported GUID value in tag %s.\n", key);
295 301
         goto finish;