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" },
62 {
"TCMP",
"compilation" },
65 {
"TDEN",
"creation_time" },
66 {
"TSOA",
"album-sort" },
67 {
"TSOP",
"artist-sort" },
68 {
"TSOT",
"title-sort" },
75 {
"TCP",
"compilation" },
77 {
"TEN",
"encoded_by" },
79 {
"TP2",
"album_artist" },
80 {
"TP3",
"performer" },
86 "TALB",
"TBPM",
"TCOM",
"TCON",
"TCOP",
"TDLY",
"TENC",
"TEXT",
87 "TFLT",
"TIT1",
"TIT2",
"TIT3",
"TKEY",
"TLAN",
"TLEN",
"TMED",
88 "TOAL",
"TOFN",
"TOLY",
"TOPE",
"TOWN",
"TPE1",
"TPE2",
"TPE3",
89 "TPE4",
"TPOS",
"TPUB",
"TRCK",
"TRSN",
"TRSO",
"TSRC",
"TSSE",
94 "TDEN",
"TDOR",
"TDRC",
"TDRL",
"TDTG",
"TIPL",
"TMCL",
"TMOO",
95 "TPRO",
"TSOA",
"TSOP",
"TSOT",
"TSST",
100 "TDAT",
"TIME",
"TORY",
"TRDA",
"TSIZ",
"TYER",
106 "32x32 pixels 'file icon'",
111 "Media (e.g. label side of CD)",
112 "Lead artist/lead performer/soloist",
117 "Lyricist/text writer",
118 "Recording Location",
120 "During performance",
121 "Movie/video screen capture",
122 "A bright coloured fish",
124 "Band/artist logotype",
125 "Publisher/Studio logotype",
142 return buf[0] == magic[0] &&
143 buf[1] == magic[1] &&
144 buf[2] == magic[2] &&
147 (buf[6] & 0x80) == 0 &&
148 (buf[7] & 0x80) == 0 &&
149 (buf[8] & 0x80) == 0 &&
150 (buf[9] & 0x80) == 0;
155 int len = ((buf[6] & 0x7f) << 21) +
156 ((buf[7] & 0x7f) << 14) +
157 ((buf[8] & 0x7f) << 7) +
169 v = (v << 7) + (
avio_r8(s) & 0x7F);
223 if ((left -= 2) < 0) {
244 while ((left > 1) && ch) {
245 GET_UTF16(ch, ((left -= 2) >= 0 ?
get(pb) : 0),
break;)
288 if (
decode_str(s, pb, encoding, &dst, &taglen) < 0) {
293 if (!(strcmp(key,
"TCON") && strcmp(key,
"TCO")) &&
294 (sscanf(dst,
"(%d)", &genre) == 1 || sscanf(dst,
"%d", &genre) == 1) &&
298 }
else if (!(strcmp(key,
"TXXX") && strcmp(key,
"TXX"))) {
301 if (
decode_str(s, pb, encoding, &dst, &taglen) < 0) {
365 if (!geob_data->
data) {
371 "Error reading GEOB frame, data truncated.\n");
374 geob_data->
data = NULL;
379 new_extra->
tag =
"GEOB";
380 new_extra->
data = geob_data;
381 new_extra->
next = *extra_meta;
382 *extra_meta = new_extra;
395 while (*str >=
'0' && *str <=
'9')
412 char date[17] = { 0 };
431 snprintf(date + 10,
sizeof(date) - 10,
465 if (!new_extra || !apic)
473 taglen -=
avio_get_str(pb, taglen, mimetype,
sizeof(mimetype));
487 "Unknown attached picture mimetype: %s, skipping.\n", mimetype);
505 "Error decoding attached picture description.\n");
514 new_extra->
tag =
"APIC";
515 new_extra->
data = apic;
516 new_extra->
next = *extra_meta;
517 *extra_meta = new_extra;
568 if (taglen < 0 || taglen > len)
617 meta->
next = *extra_meta;
652 while (id3v2_extra_meta_funcs[i].tag3) {
653 if (tag && !memcmp(tag,
654 (isv34 ? id3v2_extra_meta_funcs[i].tag4 :
655 id3v2_extra_meta_funcs[i].tag3),
657 return &id3v2_extra_meta_funcs[i];
672 const char *reason = NULL;
675 unsigned char *
buffer = NULL;
678 unsigned char *uncompressed_buffer = NULL;
679 int uncompressed_buffer_size = 0;
686 reason =
"compression";
704 unsync = flags & 0x80;
706 if (isv34 && flags & 0x40) {
713 reason =
"invalid extended header length";
719 reason =
"extended header too long.";
724 while (len >= taghdrlen) {
725 unsigned int tflags = 0;
749 len -= taghdrlen + tlen;
775 if (tencr || (!CONFIG_ZLIB && tcomp)) {
782 type =
"encrypted and compressed";
787 }
else if (tag[0] ==
'T' ||
792 if (unsync || tunsync || tcomp) {
799 if (unsync || tunsync) {
806 if (*(b - 1) == 0xff &&
avio_tell(pb) < end - 1 &&
810 *b++ = val ? val :
avio_r8(pb);
825 av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen);
826 if (!uncompressed_buffer) {
831 if (!(unsync || tunsync)) {
840 err = uncompress(uncompressed_buffer, &dlen, buffer, tlen);
845 ffio_init_context(&pb_local, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL);
855 extra_func->
read(s, pbx, tlen, tag, extra_meta, isv34);
856 }
else if (!tag[0]) {
868 if (version == 4 && flags & 0x10)
910 len = ((buf[6] & 0x7f) << 21) |
911 ((buf[7] & 0x7f) << 14) |
912 ((buf[8] & 0x7f) << 7) |
914 id3v2_parse(pb, metadata, s, len, buf[3], buf[5], extra_meta);
918 }
while (found_header);
945 next = current->
next;
957 for (cur = *extra_meta; cur; cur = cur->
next) {
961 if (strcmp(cur->
tag,
"APIC"))