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" },
63 {
"TCMP",
"compilation" },
66 {
"TDEN",
"creation_time" },
67 {
"TSOA",
"album-sort" },
68 {
"TSOP",
"artist-sort" },
69 {
"TSOT",
"title-sort" },
76 {
"TCP",
"compilation" },
78 {
"TEN",
"encoded_by" },
80 {
"TP2",
"album_artist" },
81 {
"TP3",
"performer" },
87 "TALB",
"TBPM",
"TCOM",
"TCON",
"TCOP",
"TDLY",
"TENC",
"TEXT",
88 "TFLT",
"TIT1",
"TIT2",
"TIT3",
"TKEY",
"TLAN",
"TLEN",
"TMED",
89 "TOAL",
"TOFN",
"TOLY",
"TOPE",
"TOWN",
"TPE1",
"TPE2",
"TPE3",
90 "TPE4",
"TPOS",
"TPUB",
"TRCK",
"TRSN",
"TRSO",
"TSRC",
"TSSE",
95 "TDEN",
"TDOR",
"TDRC",
"TDRL",
"TDTG",
"TIPL",
"TMCL",
"TMOO",
96 "TPRO",
"TSOA",
"TSOP",
"TSOT",
"TSST",
101 "TDAT",
"TIME",
"TORY",
"TRDA",
"TSIZ",
"TYER",
107 "32x32 pixels 'file icon'",
112 "Media (e.g. label side of CD)",
113 "Lead artist/lead performer/soloist",
118 "Lyricist/text writer",
119 "Recording Location",
121 "During performance",
122 "Movie/video screen capture",
123 "A bright coloured fish",
125 "Band/artist logotype",
126 "Publisher/Studio logotype",
143 return buf[0] == magic[0] &&
144 buf[1] == magic[1] &&
145 buf[2] == magic[2] &&
148 (buf[6] & 0x80) == 0 &&
149 (buf[7] & 0x80) == 0 &&
150 (buf[8] & 0x80) == 0 &&
151 (buf[9] & 0x80) == 0;
156 int len = ((buf[6] & 0x7f) << 21) +
157 ((buf[7] & 0x7f) << 14) +
158 ((buf[8] & 0x7f) << 7) +
170 v = (v << 7) + (
avio_r8(s) & 0x7F);
176 return (((size) & (0x7f << 0)) >> 0) +
177 (((
size) & (0x7f << 8)) >> 1) +
178 (((
size) & (0x7f << 16)) >> 2) +
179 (((
size) & (0x7f << 24)) >> 3);
190 if ((buf[len] <
'A' ||
266 if ((left -= 2) < 0) {
287 while ((left > 1) && ch) {
288 GET_UTF16(ch, ((left -= 2) >= 0 ?
get(pb) : 0),
break;)
331 if (
decode_str(s, pb, encoding, &dst, &taglen) < 0) {
336 if (!(strcmp(key,
"TCON") && strcmp(key,
"TCO")) &&
337 (sscanf(dst,
"(%d)", &genre) == 1 || sscanf(dst,
"%d", &genre) == 1) &&
341 }
else if (!(strcmp(key,
"TXXX") && strcmp(key,
"TXX"))) {
344 if (
decode_str(s, pb, encoding, &dst, &taglen) < 0) {
378 if (
decode_str(s, pb, encoding, &descriptor, &taglen) < 0)
381 if (
decode_str(s, pb, encoding, &text, &taglen) < 0)
385 key =
av_asprintf(
"lyrics-%s%s%s", descriptor[0] ? (
char *)descriptor :
"",
386 descriptor[0] ?
"-" :
"",
454 if (!geob_data->
data) {
460 "Error reading GEOB frame, data truncated.\n");
468 new_extra->
tag =
"GEOB";
469 new_extra->
data = geob_data;
470 new_extra->
next = *extra_meta;
471 *extra_meta = new_extra;
484 while (*str >=
'0' && *str <=
'9')
501 char date[17] = { 0 };
520 snprintf(date + 10,
sizeof(date) - 10,
550 if (taglen <= 4 || (!isv34 && taglen <= 6))
555 if (!new_extra || !apic)
563 taglen -=
avio_get_str(pb, taglen, mimetype,
sizeof(mimetype));
579 "Unknown attached picture mimetype: %s, skipping.\n", mimetype);
597 "Error decoding attached picture description.\n");
606 new_extra->
tag =
"APIC";
607 new_extra->
data = apic;
608 new_extra->
next = *extra_meta;
609 *extra_meta = new_extra;
660 if (taglen < 0 || taglen > len)
709 meta->
next = *extra_meta;
745 while (id3v2_extra_meta_funcs[i].tag3) {
746 if (tag && !memcmp(tag,
747 (isv34 ? id3v2_extra_meta_funcs[i].tag4 :
748 id3v2_extra_meta_funcs[i].tag3),
750 return &id3v2_extra_meta_funcs[i];
765 const char *reason =
NULL;
771 unsigned char *uncompressed_buffer =
NULL;
772 av_unused int uncompressed_buffer_size = 0;
779 reason =
"compression";
797 unsync = flags & 0x80;
799 if (isv34 && flags & 0x40) {
806 reason =
"invalid extended header length";
812 reason =
"extended header too long.";
817 while (len >= taghdrlen) {
818 unsigned int tflags = 0;
843 else if (
check_tag(pb, cur + 2 + tlen, 4) != 1)
860 len -= taghdrlen + tlen;
886 if (tencr || (!CONFIG_ZLIB && tcomp)) {
893 type =
"encrypted and compressed";
898 }
else if (tag[0] ==
'T' ||
899 !memcmp(tag,
"USLT", 4) ||
904 if (unsync || tunsync || tcomp) {
911 if (unsync || tunsync) {
918 if (*(b - 1) == 0xff &&
avio_tell(pb) < end - 1 &&
922 *b++ = val ? val :
avio_r8(pb);
937 av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen);
938 if (!uncompressed_buffer) {
943 if (!(unsync || tunsync)) {
952 err = uncompress(uncompressed_buffer, &dlen, buffer, tlen);
965 else if (!memcmp(tag,
"USLT", 4))
969 extra_func->
read(s, pbx, tlen, tag, extra_meta, isv34);
970 }
else if (!tag[0]) {
982 if (version == 4 && flags & 0x10)
1024 len = ((buf[6] & 0x7f) << 21) |
1025 ((buf[7] & 0x7f) << 14) |
1026 ((buf[8] & 0x7f) << 7) |
1028 id3v2_parse(pb, metadata, s, len, buf[3], buf[5], extra_meta);
1032 }
while (found_header);
1059 next = current->
next;
1071 for (cur = *extra_meta; cur; cur = cur->
next) {
1075 if (strcmp(cur->
tag,
"APIC"))