29# ifndef LIBID3TAG_ID3TAG_H
30# define LIBID3TAG_ID3TAG_H
36# define ID3_TAG_VERSION 0x0400
37# define ID3_TAG_VERSION_MAJOR(x) (((x) >> 8) & 0xff)
38# define ID3_TAG_VERSION_MINOR(x) (((x) >> 0) & 0xff)
40typedef unsigned char id3_byte_t;
41typedef unsigned long id3_length_t;
43typedef unsigned long id3_ucs4_t;
45typedef unsigned char id3_latin1_t;
46typedef unsigned short id3_utf16_t;
47typedef signed char id3_utf8_t;
50 unsigned int refcount;
58 id3_length_t paddedsize;
61# define ID3_TAG_QUERYSIZE 10
65# define ID3_FRAME_TITLE "TIT2"
66# define ID3_FRAME_ARTIST "TPE1"
67# define ID3_FRAME_ALBUM "TALB"
68# define ID3_FRAME_TRACK "TRCK"
69# define ID3_FRAME_YEAR "TDRC"
70# define ID3_FRAME_GENRE "TCON"
71# define ID3_FRAME_COMMENT "COMM"
75# define ID3_FRAME_OBSOLETE "ZOBS"
80 ID3_TAG_FLAG_UNSYNCHRONISATION = 0x80,
81 ID3_TAG_FLAG_EXTENDEDHEADER = 0x40,
82 ID3_TAG_FLAG_EXPERIMENTALINDICATOR = 0x20,
83 ID3_TAG_FLAG_FOOTERPRESENT = 0x10,
85 ID3_TAG_FLAG_KNOWNFLAGS = 0xf0
91 ID3_TAG_EXTENDEDFLAG_TAGISANUPDATE = 0x40,
92 ID3_TAG_EXTENDEDFLAG_CRCDATAPRESENT = 0x20,
93 ID3_TAG_EXTENDEDFLAG_TAGRESTRICTIONS = 0x10,
95 ID3_TAG_EXTENDEDFLAG_KNOWNFLAGS = 0x70
101 ID3_TAG_RESTRICTION_TAGSIZE_MASK = 0xc0,
102 ID3_TAG_RESTRICTION_TAGSIZE_128_FRAMES_1_MB = 0x00,
103 ID3_TAG_RESTRICTION_TAGSIZE_64_FRAMES_128_KB = 0x40,
104 ID3_TAG_RESTRICTION_TAGSIZE_32_FRAMES_40_KB = 0x80,
105 ID3_TAG_RESTRICTION_TAGSIZE_32_FRAMES_4_KB = 0xc0
109 ID3_TAG_RESTRICTION_TEXTENCODING_MASK = 0x20,
110 ID3_TAG_RESTRICTION_TEXTENCODING_NONE = 0x00,
111 ID3_TAG_RESTRICTION_TEXTENCODING_LATIN1_UTF8 = 0x20
115 ID3_TAG_RESTRICTION_TEXTSIZE_MASK = 0x18,
116 ID3_TAG_RESTRICTION_TEXTSIZE_NONE = 0x00,
117 ID3_TAG_RESTRICTION_TEXTSIZE_1024_CHARS = 0x08,
118 ID3_TAG_RESTRICTION_TEXTSIZE_128_CHARS = 0x10,
119 ID3_TAG_RESTRICTION_TEXTSIZE_30_CHARS = 0x18
123 ID3_TAG_RESTRICTION_IMAGEENCODING_MASK = 0x04,
124 ID3_TAG_RESTRICTION_IMAGEENCODING_NONE = 0x00,
125 ID3_TAG_RESTRICTION_IMAGEENCODING_PNG_JPEG = 0x04
129 ID3_TAG_RESTRICTION_IMAGESIZE_MASK = 0x03,
130 ID3_TAG_RESTRICTION_IMAGESIZE_NONE = 0x00,
131 ID3_TAG_RESTRICTION_IMAGESIZE_256_256 = 0x01,
132 ID3_TAG_RESTRICTION_IMAGESIZE_64_64 = 0x02,
133 ID3_TAG_RESTRICTION_IMAGESIZE_64_64_EXACT = 0x03
139 ID3_TAG_OPTION_UNSYNCHRONISATION = 0x0001,
140 ID3_TAG_OPTION_COMPRESSION = 0x0002,
141 ID3_TAG_OPTION_CRC = 0x0004,
143 ID3_TAG_OPTION_APPENDEDTAG = 0x0010,
144 ID3_TAG_OPTION_FILEALTERED = 0x0020,
146 ID3_TAG_OPTION_ID3V1 = 0x0100
151 char const *description;
152 unsigned int refcount;
155 int encryption_method;
157 id3_length_t encoded_length;
158 id3_length_t decoded_length;
159 unsigned int nfields;
165 ID3_FRAME_FLAG_TAGALTERPRESERVATION = 0x4000,
166 ID3_FRAME_FLAG_FILEALTERPRESERVATION = 0x2000,
167 ID3_FRAME_FLAG_READONLY = 0x1000,
169 ID3_FRAME_FLAG_STATUSFLAGS = 0xff00,
172 ID3_FRAME_FLAG_GROUPINGIDENTITY = 0x0040,
173 ID3_FRAME_FLAG_COMPRESSION = 0x0008,
174 ID3_FRAME_FLAG_ENCRYPTION = 0x0004,
175 ID3_FRAME_FLAG_UNSYNCHRONISATION = 0x0002,
176 ID3_FRAME_FLAG_DATALENGTHINDICATOR = 0x0001,
178 ID3_FRAME_FLAG_FORMATFLAGS = 0x00ff,
180 ID3_FRAME_FLAG_KNOWNFLAGS = 0x704f
184 ID3_FIELD_TYPE_TEXTENCODING,
185 ID3_FIELD_TYPE_LATIN1,
186 ID3_FIELD_TYPE_LATIN1FULL,
187 ID3_FIELD_TYPE_LATIN1LIST,
188 ID3_FIELD_TYPE_STRING,
189 ID3_FIELD_TYPE_STRINGFULL,
190 ID3_FIELD_TYPE_STRINGLIST,
191 ID3_FIELD_TYPE_LANGUAGE,
192 ID3_FIELD_TYPE_FRAMEID,
195 ID3_FIELD_TYPE_INT16,
196 ID3_FIELD_TYPE_INT24,
197 ID3_FIELD_TYPE_INT32,
198 ID3_FIELD_TYPE_INT32PLUS,
199 ID3_FIELD_TYPE_BINARYDATA
202enum id3_field_textencoding {
203 ID3_FIELD_TEXTENCODING_ISO_8859_1 = 0x00,
204 ID3_FIELD_TEXTENCODING_UTF_16 = 0x01,
205 ID3_FIELD_TEXTENCODING_UTF_16BE = 0x02,
206 ID3_FIELD_TEXTENCODING_UTF_8 = 0x03
210 enum id3_field_type type;
212 enum id3_field_type type;
216 enum id3_field_type type;
220 enum id3_field_type type;
221 unsigned int nstrings;
222 id3_latin1_t **strings;
225 enum id3_field_type type;
229 enum id3_field_type type;
230 unsigned int nstrings;
231 id3_ucs4_t **strings;
234 enum id3_field_type type;
238 enum id3_field_type type;
247 ID3_FILE_MODE_READONLY = 0,
248 ID3_FILE_MODE_READWRITE
251struct id3_file *id3_file_open(
char const *,
enum id3_file_mode);
252struct id3_file *id3_file_fdopen(
int,
enum id3_file_mode);
253int id3_file_close(
struct id3_file *);
257int id3_file_update(
struct id3_file *);
261struct id3_tag *id3_tag_new(
void);
262void id3_tag_delete(
struct id3_tag *);
264unsigned int id3_tag_version(
struct id3_tag const *);
266int id3_tag_options(
struct id3_tag *,
int,
int);
267void id3_tag_setlength(
struct id3_tag *, id3_length_t);
269void id3_tag_clearframes(
struct id3_tag *);
275 char const *,
unsigned int);
277signed long id3_tag_query(id3_byte_t
const *, id3_length_t);
279struct id3_tag *id3_tag_parse(id3_byte_t
const *, id3_length_t);
280id3_length_t id3_tag_render(
struct id3_tag const *, id3_byte_t *);
284struct id3_frame *id3_frame_new(
char const *);
285void id3_frame_delete(
struct id3_frame *);
291enum id3_field_type id3_field_type(
union id3_field const *);
293int id3_field_setint(
union id3_field *,
signed long);
294int id3_field_settextencoding(
union id3_field *,
enum id3_field_textencoding);
295int id3_field_setstrings(
union id3_field *,
unsigned int, id3_ucs4_t **);
296int id3_field_addstring(
union id3_field *, id3_ucs4_t
const *);
297int id3_field_setlanguage(
union id3_field *,
char const *);
298int id3_field_setlatin1(
union id3_field *, id3_latin1_t
const *);
299int id3_field_setfulllatin1(
union id3_field *, id3_latin1_t
const *);
300int id3_field_setstring(
union id3_field *, id3_ucs4_t
const *);
301int id3_field_setfullstring(
union id3_field *, id3_ucs4_t
const *);
302int id3_field_setframeid(
union id3_field *,
char const *);
303int id3_field_setbinarydata(
union id3_field *,
304 id3_byte_t
const *, id3_length_t);
306signed long id3_field_getint(
union id3_field const *);
307enum id3_field_textencoding id3_field_gettextencoding(
union id3_field const *);
308id3_latin1_t
const *id3_field_getlatin1(
union id3_field const *);
309id3_latin1_t
const *id3_field_getfulllatin1(
union id3_field const *);
310id3_ucs4_t
const *id3_field_getstring(
union id3_field const *);
311id3_ucs4_t
const *id3_field_getfullstring(
union id3_field const *);
312unsigned int id3_field_getnstrings(
union id3_field const *);
313id3_ucs4_t
const *id3_field_getstrings(
union id3_field const *,
315char const *id3_field_getframeid(
union id3_field const *);
316id3_byte_t
const *id3_field_getbinarydata(
union id3_field const *,
321id3_ucs4_t
const *id3_genre_index(
unsigned int);
322id3_ucs4_t
const *id3_genre_name(id3_ucs4_t
const *);
323int id3_genre_number(id3_ucs4_t
const *);
327id3_latin1_t *id3_ucs4_latin1duplicate(id3_ucs4_t
const *);
328id3_utf16_t *id3_ucs4_utf16duplicate(id3_ucs4_t
const *);
329id3_utf8_t *id3_ucs4_utf8duplicate(id3_ucs4_t
const *);
331void id3_ucs4_putnumber(id3_ucs4_t *,
unsigned long);
332unsigned long id3_ucs4_getnumber(id3_ucs4_t
const *);
336id3_ucs4_t *id3_latin1_ucs4duplicate(id3_latin1_t
const *);
337id3_ucs4_t *id3_utf16_ucs4duplicate(id3_utf16_t
const *);
338id3_ucs4_t *id3_utf8_ucs4duplicate(id3_utf8_t
const *);
342# define ID3_VERSION_MAJOR 0
343# define ID3_VERSION_MINOR 15
344# define ID3_VERSION_PATCH 1
345# define ID3_VERSION_EXTRA " (beta)"
347# define ID3_VERSION_STRINGIZE(str) #str
348# define ID3_VERSION_STRING(num) ID3_VERSION_STRINGIZE(num)
350# define ID3_VERSION ID3_VERSION_STRING(ID3_VERSION_MAJOR) "." \
351 ID3_VERSION_STRING(ID3_VERSION_MINOR) "." \
352 ID3_VERSION_STRING(ID3_VERSION_PATCH) \
355# define ID3_PUBLISHYEAR "2000-2004"
356# define ID3_AUTHOR "Underbit Technologies, Inc."
357# define ID3_EMAIL "info@underbit.com"
359extern char const id3_version[];
360extern char const id3_copyright[];
361extern char const id3_author[];
362extern char const id3_build[];