45 {
"TCOM",
"composer" },
47 {
"TCOP",
"copyright" },
48 {
"TENC",
"encoded_by" },
50 {
"TLAN",
"language" },
52 {
"TPE2",
"album_artist" },
53 {
"TPE3",
"performer" },
55 {
"TPUB",
"publisher" },
57 {
"TSSE",
"encoder" },
64 {
"TDEN",
"creation_time" },
65 {
"TSOA",
"album-sort" },
66 {
"TSOP",
"artist-sort" },
67 {
"TSOT",
"title-sort" },
75 {
"TEN",
"encoded_by" },
77 {
"TP2",
"album_artist" },
78 {
"TP3",
"performer" },
84 "TALB",
"TBPM",
"TCOM",
"TCON",
"TCOP",
"TDLY",
"TENC",
"TEXT",
85 "TFLT",
"TIT1",
"TIT2",
"TIT3",
"TKEY",
"TLAN",
"TLEN",
"TMED",
86 "TOAL",
"TOFN",
"TOLY",
"TOPE",
"TOWN",
"TPE1",
"TPE2",
"TPE3",
87 "TPE4",
"TPOS",
"TPUB",
"TRCK",
"TRSN",
"TRSO",
"TSRC",
"TSSE",
92 "TDEN",
"TDOR",
"TDRC",
"TDRL",
"TDTG",
"TIPL",
"TMCL",
"TMOO",
93 "TPRO",
"TSOA",
"TSOP",
"TSOT",
"TSST",
98 "TDAT",
"TIME",
"TORY",
"TRDA",
"TSIZ",
"TYER",
104 "32x32 pixels 'file icon'",
109 "Media (e.g. label side of CD)",
110 "Lead artist/lead performer/soloist",
115 "Lyricist/text writer",
116 "Recording Location",
118 "During performance",
119 "Movie/video screen capture",
120 "A bright coloured fish",
122 "Band/artist logotype",
123 "Publisher/Studio logotype",
140 return buf[0] == magic[0] &&
141 buf[1] == magic[1] &&
142 buf[2] == magic[2] &&
145 (buf[6] & 0x80) == 0 &&
146 (buf[7] & 0x80) == 0 &&
147 (buf[8] & 0x80) == 0 &&
148 (buf[9] & 0x80) == 0;
153 int len = ((buf[6] & 0x7f) << 21) +
154 ((buf[7] & 0x7f) << 14) +
155 ((buf[8] & 0x7f) << 7) +
167 v = (v << 7) + (
avio_r8(s) & 0x7F);
221 if ((left -= 2) < 0) {
242 while ((left > 1) && ch) {
243 GET_UTF16(ch, ((left -= 2) >= 0 ?
get(pb) : 0),
break;)
286 if (
decode_str(s, pb, encoding, &dst, &taglen) < 0) {
291 if (!(strcmp(key,
"TCON") && strcmp(key,
"TCO")) &&
292 (sscanf(dst,
"(%d)", &genre) == 1 || sscanf(dst,
"%d", &genre) == 1) &&
296 }
else if (!(strcmp(key,
"TXXX") && strcmp(key,
"TXX"))) {
299 if (
decode_str(s, pb, encoding, &dst, &taglen) < 0) {
363 if (!geob_data->
data) {
369 "Error reading GEOB frame, data truncated.\n");
372 geob_data->
data = NULL;
377 new_extra->
tag =
"GEOB";
378 new_extra->
data = geob_data;
379 new_extra->
next = *extra_meta;
380 *extra_meta = new_extra;
393 while (*str >=
'0' && *str <=
'9')
410 char date[17] = { 0 };
429 snprintf(date + 10,
sizeof(date) - 10,
463 if (!new_extra || !apic)
471 taglen -=
avio_get_str(pb, taglen, mimetype,
sizeof(mimetype));
485 "Unknown attached picture mimetype: %s, skipping.\n", mimetype);
503 "Error decoding attached picture description.\n");
512 new_extra->
tag =
"APIC";
513 new_extra->
data = apic;
514 new_extra->
next = *extra_meta;
515 *extra_meta = new_extra;
566 if (taglen < 0 || taglen > len)
615 meta->
next = *extra_meta;
650 while (id3v2_extra_meta_funcs[i].tag3) {
651 if (tag && !memcmp(tag,
652 (isv34 ? id3v2_extra_meta_funcs[i].tag4 :
653 id3v2_extra_meta_funcs[i].tag3),
655 return &id3v2_extra_meta_funcs[i];
670 const char *reason = NULL;
673 unsigned char *
buffer = NULL;
676 unsigned char *uncompressed_buffer = NULL;
677 int uncompressed_buffer_size = 0;
684 reason =
"compression";
702 unsync = flags & 0x80;
704 if (isv34 && flags & 0x40) {
711 reason =
"invalid extended header length";
717 reason =
"extended header too long.";
722 while (len >= taghdrlen) {
723 unsigned int tflags = 0;
747 len -= taghdrlen + tlen;
773 if (tencr || (!CONFIG_ZLIB && tcomp)) {
780 type =
"encrypted and compressed";
785 }
else if (tag[0] ==
'T' ||
790 if (unsync || tunsync || tcomp) {
797 if (unsync || tunsync) {
804 if (*(b - 1) == 0xff &&
avio_tell(pb) < end - 1 &&
808 *b++ = val ? val :
avio_r8(pb);
823 av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen);
824 if (!uncompressed_buffer) {
829 if (!(unsync || tunsync)) {
838 err = uncompress(uncompressed_buffer, &dlen, buffer, tlen);
843 ffio_init_context(&pb_local, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL);
853 extra_func->
read(s, pbx, tlen, tag, extra_meta, isv34);
854 }
else if (!tag[0]) {
866 if (version == 4 && flags & 0x10)
899 len = ((buf[6] & 0x7f) << 21) |
900 ((buf[7] & 0x7f) << 14) |
901 ((buf[8] & 0x7f) << 7) |
903 id3v2_parse(pb, metadata, s, len, buf[3], buf[5], extra_meta);
907 }
while (found_header);
934 next = current->
next;
944 for (cur = *extra_meta; cur; cur = cur->
next) {
948 if (strcmp(cur->
tag,
"APIC"))