1
/*
2
 * Copyright 2008-2011 Various Authors
3
 * Copyright 2005 Timo Hirvonen
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License as
7
 * published by the Free Software Foundation; either version 2 of the
8
 * License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful, but
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
#ifndef _ID3_H
20
#define _ID3_H
21
22
/* flags for id3_read_tags */
23
#define ID3_V1	(1 << 0)
24
#define ID3_V2	(1 << 1)
25
26
enum id3_key {
27
	ID3_ARTIST,
28
	ID3_ALBUM,
29
	ID3_TITLE,
30
	ID3_DATE,
31
	ID3_ORIGINALDATE,
32
	ID3_GENRE,
33
	ID3_DISC,
34
	ID3_TRACK,
35
	ID3_ALBUMARTIST,
36
	ID3_ARTISTSORT,
37
	ID3_ALBUMARTISTSORT,
38
	ID3_ALBUMSORT,
39
	ID3_COMPILATION,
40
	ID3_RG_TRACK_GAIN,
41
	ID3_RG_TRACK_PEAK,
42
	ID3_RG_ALBUM_GAIN,
43
	ID3_RG_ALBUM_PEAK,
44
	ID3_COMPOSER,
45
	ID3_CONDUCTOR,
46
	ID3_LYRICIST,
47
	ID3_REMIXER,
48
	ID3_LABEL,
49
	ID3_PUBLISHER,
50
	ID3_SUBTITLE,
51
	ID3_COMMENT,
52
	ID3_MUSICBRAINZ_TRACKID,
53
	ID3_MEDIA,
54
55
	NUM_ID3_KEYS
56
};
57
58
struct id3tag {
59
	char v1[128];
60
	char *v2[NUM_ID3_KEYS];
61
62
	unsigned int has_v1 : 1;
63
	unsigned int has_v2 : 1;
64
};
65
66
extern const char * const id3_key_names[NUM_ID3_KEYS];
67
68
int id3_tag_size(const char *buf, int buf_size);
69
70
void id3_init(struct id3tag *id3);
71
void id3_free(struct id3tag *id3);
72
73
int id3_read_tags(struct id3tag *id3, int fd, unsigned int flags);
74
char *id3_get_comment(struct id3tag *id3, enum id3_key key);
75
76
#endif