00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _ID3_H
00027 #define _ID3_H
00028
00029 #define TAG_LENGTH 128
00030
00031 #define SIZE_INFO 30
00032 #define SIZE_YEAR 4
00033 #define SIZE_GENRE 1
00034 #define SIZE_TRACK 1
00035
00036 #define OFFSET_TITLE 3
00037 #define OFFSET_ARTIST 33
00038 #define OFFSET_ALBUM 63
00039 #define OFFSET_YEAR 93
00040 #define OFFSET_COMMENT 97
00041 #define OFFSET_TRACK 126
00042 #define OFFSET_GENRE 127
00043
00044 #define GENRE_MAX 147
00045
00046 static const char *genres[] = {
00047 "Blues", "Classic Rock", "Country",
00048 "Dance", "Disco", "Funk",
00049 "Grunge", "Hip-Hop", "Jazz",
00050 "Metal", "New Age", "Oldies",
00051 "Other", "Pop", "R&B",
00052 "Rap", "Reggae", "Rock",
00053 "Techno", "Industrial", "Alternative",
00054 "Ska", "Death Metal", "Pranks",
00055 "Soundtrack", "Euro-Techno", "Ambient",
00056 "Trip-Hop", "Vocal", "Jazz+Funk",
00057 "Fusion", "Trance", "Classical",
00058 "Instrumental", "Acid", "House",
00059 "Game", "Sound Clip", "Gospel",
00060 "Noise", "Alternative Rock", "Bass",
00061 "Punk", "Space", "Meditative",
00062 "Instrumental Pop", "Instrumental Rock", "Ethnic",
00063 "Gothic", "Darkwave", "Techno-Industrial",
00064 "Electronic", "Pop-Folk", "Eurodance",
00065 "Dream", "Southern Rock", "Comedy",
00066 "Cult", "Gangsta", "Top 40",
00067 "Christian Rap", "Pop/Funk", "Jungle",
00068 "Native US", "Cabaret", "New Wave",
00069 "Psychedelic", "Rave", "Showtunes",
00070 "Trailer", "Lo-Fi", "Tribal",
00071 "Acid Punk", "Acid Jazz", "Polka",
00072 "Retro", "Musical", "Rock & Roll",
00073 "Hard Rock", "Folk", "Folk-Rock",
00074 "National Folk", "Swing", "Fast Fusion",
00075 "Bebob", "Latin", "Revival",
00076 "Celtic", "Bluegrass", "Avantgarde",
00077 "Gothic Rock", "Progressive Rock", "Psychedelic Rock",
00078 "Symphonic Rock", "Slow Rock", "Big Band",
00079 "Chorus", "Easy Listening", "Acoustic",
00080 "Humour", "Speech", "Chanson",
00081 "Opera", "Chamber Music", "Sonata",
00082 "Symphony", "Booty Bass", "Primus",
00083 "Porn Groove", "Satire", "Slow Jam",
00084 "Club", "Tango", "Samba",
00085 "Folklore", "Ballad", "Power Ballad",
00086 "Rhythmic Soul", "Freestyle", "Duet",
00087 "Punk Rock", "Drum Solo", "Acappella",
00088 "Euro-House", "Dance Hall", "Goa",
00089 "Drum & Bass", "Club-House", "Hardcore",
00090 "Terror", "Indie", "BritPop",
00091 "Negerpunk", "Polsk Punk", "Beat",
00092 "Christian Gangsta", "Heavy Metal", "Black Metal",
00093 "Crossover", "Contemporary Christian", "Christian Rock",
00094 "Merengue", "Salsa", "Thrash Metal",
00095 "Anime", "JPop", "SynthPop"
00096 };
00097
00098 struct id3 {
00099 char title[31];
00100 char artist[31];
00101 char album[31];
00102 char year[5];
00103 char comment[31];
00104 unsigned char track;
00105 unsigned char genre;
00106 };
00107
00108 int id3_read(const char *_path, struct id3 *_id3);
00109 int id3_write(const char *_path, struct id3 *_id3);
00110 void id3_print(struct id3 *_id3);
00111 int id3_read_tag(const char *_path, char *_tag);
00112 int id3_write_tag(FILE *_fp, struct id3 *_id3);
00113 int id3_check_tag(const char *_tag);
00114 int id3_extract_info(const char *_tag, struct id3 *_id3);
00115 void id3_normalize_info(struct id3 *_id3);
00116 void id3_get_genre_as_string(struct id3 *_id3, char *_genre);
00117 static void remove_trailing_whitespaces(char *_str);
00118 static void write_with_padding(FILE *_fp, const char *_str, size_t _len);
00119
00120 #endif