📄 compat.c
字号:
{"TSIZ", OBSOLETE /* Size [obsolete] */},#line 129 "compat.gperf" {"WAS", EQ(WOAS) /* Official audio source webpage */},#line 121 "compat.gperf" {"TXT", EQ(TEXT) /* Lyricist/text writer */},#line 62 "compat.gperf" {"CNT", EQ(PCNT) /* Play counter */},#line 100 "compat.gperf" {"TOF", EQ(TOFN) /* Original filename */},#line 85 "compat.gperf" {"TCO", TX(TCON) /* Content type */},#line 114 "compat.gperf" {"TRK", EQ(TRCK) /* Track number/position in set */},#line 119 "compat.gperf" {"TT2", EQ(TIT2) /* Title/songname/content description */},#line 93 "compat.gperf" {"TIM", OBSOLETE /* Time [obsolete] */},#line 94 "compat.gperf" {"TIME", OBSOLETE /* Time [obsolete] */},#line 103 "compat.gperf" {"TORY", EQ(TDOR) /* Original release year [obsolete] */},#line 91 "compat.gperf" {"TEN", EQ(TENC) /* Encoded by */},#line 118 "compat.gperf" {"TT1", EQ(TIT1) /* Content group description */},#line 127 "compat.gperf" {"WAF", EQ(WOAF) /* Official audio file webpage */},#line 75 "compat.gperf" {"PIC", EQ(APIC) /* Attached picture */},#line 122 "compat.gperf" {"TXX", EQ(TXXX) /* User defined text information frame */},#line 133 "compat.gperf" {"WXX", EQ(WXXX) /* User defined URL link frame */},#line 86 "compat.gperf" {"TCON", TX(TCON) /* Content type */},#line 77 "compat.gperf" {"REV", EQ(RVRB) /* Reverb */},#line 106 "compat.gperf" {"TP2", EQ(TPE2) /* Band/orchestra/accompaniment */},#line 105 "compat.gperf" {"TP1", EQ(TPE1) /* Lead performer(s)/soloist(s) */},#line 61 "compat.gperf" {"BUF", EQ(RBUF) /* Recommended buffer size */},#line 70 "compat.gperf" {"IPL", EQ(TIPL) /* Involved people list */},#line 69 "compat.gperf" {"GEO", EQ(GEOB) /* General encapsulated object */},#line 72 "compat.gperf" {"LNK", EQ(LINK) /* Linked information */},#line 71 "compat.gperf" {"IPLS", EQ(TIPL) /* Involved people list */} }; static const short lookup[] = { -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, -1, -1, 50, -1, 51, 52, -1, 53, 54, 55, 56, -1, 57, 58, 59, 60, -1, 61, -1, 62, -1, -1, 63, -1, 64, -1, -1, 65, -1, 66, -1, -1, -1, -1, -1, 67, -1, 68, -1, 69, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72 }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register int key = hash (str, len); if (key <= MAX_HASH_VALUE && key >= 0) { register int index = lookup[key]; if (index >= 0) { register const char *s = wordlist[index].id; if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') return &wordlist[index]; } } } return 0;}#line 134 "compat.gperf"staticint translate_TCON(struct id3_frame *frame, char const *oldid, id3_byte_t const *data, id3_length_t length){ id3_byte_t const *end; enum id3_field_textencoding encoding; id3_ucs4_t *string = 0, *ptr, *endptr; int result = 0; /* translate old TCON syntax into multiple strings */ assert(frame->nfields == 2); encoding = ID3_FIELD_TEXTENCODING_ISO_8859_1; end = data + length; if (id3_field_parse(&frame->fields[0], &data, end - data, &encoding) == -1) goto fail; string = id3_parse_string(&data, end - data, encoding, 0); if (string == 0) goto fail; ptr = string; while (*ptr == '(') { if (*++ptr == '(') break; endptr = ptr; while (*endptr && *endptr != ')') ++endptr; if (*endptr) *endptr++ = 0; if (id3_field_addstring(&frame->fields[1], ptr) == -1) goto fail; ptr = endptr; } if (*ptr && id3_field_addstring(&frame->fields[1], ptr) == -1) goto fail; if (0) { fail: result = -1; } if (string) free(string); return result;}/* * NAME: compat->fixup() * DESCRIPTION: finish compatibility translations */int id3_compat_fixup(struct id3_tag *tag){ struct id3_frame *frame; unsigned int index; id3_ucs4_t timestamp[17] = { 0 }; int result = 0; /* create a TDRC frame from obsolete TYER/TDAT/TIME frames */ /* * TYE/TYER: YYYY * TDA/TDAT: DDMM * TIM/TIME: HHMM * * TDRC: yyyy-MM-ddTHH:mm */ index = 0; while ((frame = id3_tag_findframe(tag, ID3_FRAME_OBSOLETE, index++))) { char const *id; id3_byte_t const *data, *end; id3_length_t length; enum id3_field_textencoding encoding; id3_ucs4_t *string; id = id3_field_getframeid(&frame->fields[0]); assert(id); if (strcmp(id, "TYER") != 0 && strcmp(id, "YTYE") != 0 && strcmp(id, "TDAT") != 0 && strcmp(id, "YTDA") != 0 && strcmp(id, "TIME") != 0 && strcmp(id, "YTIM") != 0) continue; data = id3_field_getbinarydata(&frame->fields[1], &length); assert(data); if (length < 1) continue; end = data + length; encoding = id3_parse_uint(&data, 1); string = id3_parse_string(&data, end - data, encoding, 0); if (id3_ucs4_length(string) < 4) { free(string); continue; } if (strcmp(id, "TYER") == 0 || strcmp(id, "YTYE") == 0) { timestamp[0] = string[0]; timestamp[1] = string[1]; timestamp[2] = string[2]; timestamp[3] = string[3]; } else if (strcmp(id, "TDAT") == 0 || strcmp(id, "YTDA") == 0) { timestamp[4] = '-'; timestamp[5] = string[2]; timestamp[6] = string[3]; timestamp[7] = '-'; timestamp[8] = string[0]; timestamp[9] = string[1]; } else { /* TIME or YTIM */ timestamp[10] = 'T'; timestamp[11] = string[0]; timestamp[12] = string[1]; timestamp[13] = ':'; timestamp[14] = string[2]; timestamp[15] = string[3]; } free(string); } if (timestamp[0]) { id3_ucs4_t *strings; frame = id3_frame_new("TDRC"); if (frame == 0) goto fail; strings = timestamp; if (id3_field_settextencoding(&frame->fields[0], ID3_FIELD_TEXTENCODING_ISO_8859_1) == -1 || id3_field_setstrings(&frame->fields[1], 1, &strings) == -1 || id3_tag_attachframe(tag, frame) == -1) { id3_frame_delete(frame); goto fail; } } if (0) { fail: result = -1; } return result;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -