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);
175 return (((size) & (0x7f << 0)) >> 0) +
176 (((
size) & (0x7f << 8)) >> 1) +
177 (((
size) & (0x7f << 16)) >> 2) +
178 (((
size) & (0x7f << 24)) >> 3);
189 if ((buf[len] <
'A' ||
265 if ((left -= 2) < 0) {
286 while ((left > 1) && ch) {
287 GET_UTF16(ch, ((left -= 2) >= 0 ?
get(pb) : 0),
break;)
330 if (
decode_str(s, pb, encoding, &dst, &taglen) < 0) {
335 if (!(strcmp(key,
"TCON") && strcmp(key,
"TCO")) &&
336 (sscanf(dst,
"(%d)", &genre) == 1 || sscanf(dst,
"%d", &genre) == 1) &&
340 }
else if (!(strcmp(key,
"TXXX") && strcmp(key,
"TXX"))) {
343 if (
decode_str(s, pb, encoding, &dst, &taglen) < 0) {
407 if (!geob_data->
data) {
413 "Error reading GEOB frame, data truncated.\n");
416 geob_data->
data = NULL;
421 new_extra->
tag =
"GEOB";
422 new_extra->
data = geob_data;
423 new_extra->
next = *extra_meta;
424 *extra_meta = new_extra;
437 while (*str >=
'0' && *str <=
'9')
454 char date[17] = { 0 };
473 snprintf(date + 10,
sizeof(date) - 10,
507 if (!new_extra || !apic)
515 taglen -=
avio_get_str(pb, taglen, mimetype,
sizeof(mimetype));
529 "Unknown attached picture mimetype: %s, skipping.\n", mimetype);
547 "Error decoding attached picture description.\n");
556 new_extra->
tag =
"APIC";
557 new_extra->
data = apic;
558 new_extra->
next = *extra_meta;
559 *extra_meta = new_extra;
610 if (taglen < 0 || taglen > len)
659 meta->
next = *extra_meta;
694 while (id3v2_extra_meta_funcs[i].tag3) {
695 if (tag && !memcmp(tag,
696 (isv34 ? id3v2_extra_meta_funcs[i].tag4 :
697 id3v2_extra_meta_funcs[i].tag3),
699 return &id3v2_extra_meta_funcs[i];
714 const char *reason = NULL;
717 unsigned char *
buffer = NULL;
720 unsigned char *uncompressed_buffer = NULL;
721 av_unused int uncompressed_buffer_size = 0;
728 reason =
"compression";
746 unsync = flags & 0x80;
748 if (isv34 && flags & 0x40) {
755 reason =
"invalid extended header length";
761 reason =
"extended header too long.";
766 while (len >= taghdrlen) {
767 unsigned int tflags = 0;
792 else if (
check_tag(pb, cur + 2 + tlen, 4) != 1)
809 len -= taghdrlen + tlen;
835 if (tencr || (!CONFIG_ZLIB && tcomp)) {
842 type =
"encrypted and compressed";
847 }
else if (tag[0] ==
'T' ||
852 if (unsync || tunsync || tcomp) {
859 if (unsync || tunsync) {
866 if (*(b - 1) == 0xff &&
avio_tell(pb) < end - 1 &&
870 *b++ = val ? val :
avio_r8(pb);
885 av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen);
886 if (!uncompressed_buffer) {
891 if (!(unsync || tunsync)) {
900 err = uncompress(uncompressed_buffer, &dlen, buffer, tlen);
905 ffio_init_context(&pb_local, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL);
915 extra_func->
read(s, pbx, tlen, tag, extra_meta, isv34);
916 }
else if (!tag[0]) {
928 if (version == 4 && flags & 0x10)
970 len = ((buf[6] & 0x7f) << 21) |
971 ((buf[7] & 0x7f) << 14) |
972 ((buf[8] & 0x7f) << 7) |
974 id3v2_parse(pb, metadata, s, len, buf[3], buf[5], extra_meta);
978 }
while (found_header);
1005 next = current->
next;
1017 for (cur = *extra_meta; cur; cur = cur->
next) {
1021 if (strcmp(cur->
tag,
"APIC"))