seek: Ceil position to duration - 5s
[cmus.git] / id3.h
blob0da58e155591a3bbd79ce18fa389ff5f4c65562c
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_RG_TRACK_GAIN,
26 ID3_RG_TRACK_PEAK,
27 ID3_RG_ALBUM_GAIN,
28 ID3_RG_ALBUM_PEAK,
29 NUM_ID3_KEYS
32 struct id3tag {
33 char v1[128];
34 char *v2[NUM_ID3_KEYS];
36 unsigned int has_v1 : 1;
37 unsigned int has_v2 : 1;
40 #define UTF16_IS_LSURROGATE(uch) (0xdc00 <= uch && 0xdfff >= uch)
41 #define UTF16_IS_HSURROGATE(uch) (0xd800 <= uch && 0xdbff >= uch)
42 #define UTF16_IS_BOM(uch) (uch == 0xfeff)
44 extern const char * const id3_key_names[NUM_ID3_KEYS];
46 int id3_tag_size(const char *buf, int buf_size);
48 static inline void id3_init(struct id3tag *id3)
50 memset(id3, 0, sizeof(*id3));
53 void id3_free(struct id3tag *id3);
54 int id3_read_tags(struct id3tag *id3, int fd, unsigned int flags);
55 char *id3_get_comment(struct id3tag *id3, enum id3_key key);
57 #endif