switch (get_byte(pb)) { /* encoding type */
- case 0: /* ISO-8859-1 (0 - 255 maps directly into unicode) */
+ case ID3v2_ENCODING_ISO8859:
q = dst;
while (taglen-- && q - dst < dstlen - 7) {
uint8_t tmp;
*q = 0;
break;
- case 1: /* UTF-16 with BOM */
+ case ID3v2_ENCODING_UTF16BOM:
taglen -= 2;
switch (get_be16(pb)) {
case 0xfffe:
}
// fall-through
- case 2: /* UTF-16BE without BOM */
+ case ID3v2_ENCODING_UTF16BE:
q = dst;
while (taglen > 1 && q - dst < dstlen - 7) {
uint32_t ch;
*q = 0;
break;
- case 3: /* UTF-8 */
+ case ID3v2_ENCODING_UTF8:
len = FFMIN(taglen, dstlen);
get_buffer(pb, dst, len);
dst[len] = 0;
#define ID3v2_FLAG_ENCRYPTION 0x0004
#define ID3v2_FLAG_COMPRESSION 0x0008
+enum ID3v2Encoding {
+ ID3v2_ENCODING_ISO8859 = 0,
+ ID3v2_ENCODING_UTF16BOM = 1,
+ ID3v2_ENCODING_UTF16BE = 2,
+ ID3v2_ENCODING_UTF8 = 3,
+};
+
/**
* Detect ID3v2 Header.
* @param buf must be ID3v2_HEADER_SIZE byte long