cmus-remote: Read command results
[cmus.git] / id3.h
blob829d7de436dd3dd82ebc81568a3404af19957ce4
1 /*
2 * Copyright 2005 Timo Hirvonen
3 */
5 #ifndef _ID3_H
6 #define _ID3_H
8 #include <string.h>
10 /* flags for id3_read_tags */
11 #define ID3_V1 (1 << 0)
12 #define ID3_V2 (1 << 1)
14 enum id3_key {
15 ID3_ARTIST,
16 ID3_ALBUM,
17 ID3_TITLE,
18 ID3_DATE,
19 ID3_GENRE,
20 ID3_DISC,
21 ID3_TRACK,
22 ID3_ALBUMARTIST,
23 ID3_ARTISTSORT,
24 ID3_ALBUMARTISTSORT,
25 ID3_COMPILATION,
26 ID3_RG_TRACK_GAIN,
27 ID3_RG_TRACK_PEAK,
28 ID3_RG_ALBUM_GAIN,
29 ID3_RG_ALBUM_PEAK,
30 NUM_ID3_KEYS
33 struct id3tag {
34 char v1[128];
35 char *v2[NUM_ID3_KEYS];
37 unsigned int has_v1 : 1;
38 unsigned int has_v2 : 1;
41 #define UTF16_IS_LSURROGATE(uch) (0xdc00 <= uch && 0xdfff >= uch)
42 #define UTF16_IS_HSURROGATE(uch) (0xd800 <= uch && 0xdbff >= uch)
43 #define UTF16_IS_BOM(uch) (uch == 0xfeff)
45 extern const char * const id3_key_names[NUM_ID3_KEYS];
47 int id3_tag_size(const char *buf, int buf_size);
49 static inline void id3_init(struct id3tag *id3)
51 memset(id3, 0, sizeof(*id3));
54 void id3_free(struct id3tag *id3);
55 int id3_read_tags(struct id3tag *id3, int fd, unsigned int flags);
56 char *id3_get_comment(struct id3tag *id3, enum id3_key key);
58 #endif