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
00027
00028
00029
00030
00031
00032
00033 #include "mplib.h"
00034
00035 #ifndef __MPLIB_S_H
00036 #define __MPLIB_S_H
00037
00038 #undef __BEGIN_DECLS
00039 #undef __END_DECLS
00040 #ifdef __cplusplus
00041 # define __BEGIN_DECLS extern "C" {
00042 # define __END_DECLS }
00043 #else
00044 # define __BEGIN_DECLS
00045 # define __END_DECLS
00046 #endif
00047
00048
00049 __BEGIN_DECLS
00050
00051
00052
00053
00054
00055
00056
00057 const static int br_1_1[16] = { -1, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 };
00058 const static int br_1_2[16] = { -1, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 };
00059 const static int br_1_3[16] = { -1, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0 };
00060 const static int br_2_1[16] = { -1, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 };
00061 const static int br_2_2[16] = { -1, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 };
00062 const static int br_2_3[16] = { -1, 8, 16, 24, 32, 64, 80, 56, 64, 128, 160, 112, 128, 256, 320, 0 };
00063
00064 #define GLL 148
00065 const static char *genre_list[GLL] =
00066 { "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz",
00067 "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno",
00068 "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno",
00069 "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental",
00070 "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "Alternative Rock", "Bass", "Soul", "Punk",
00071 "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave",
00072 "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy",
00073 "Cult", "Gangsta Rap", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret",
00074 "New Wave", "Psychedelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk",
00075 "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk", "Folk/Rock",
00076 "National Folk", "Swing", "Fast-Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass",
00077 "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock",
00078 "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson", "Opera",
00079 "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam",
00080 "Club", "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rythmic Soul", "Freestyle",
00081 "Duet", "Punk Rock", "Drum Solo", "A Cappella", "Euro-House", "Dance Hall", "Goa", "Drum & Bass",
00082 "Club-House", "Hardcore", "Terror", "Indie", "BritPop", "Negerpunk", "Polsk Punk", "Beat",
00083 "Christian Gangsta Rap", "Heavy Metal", "Black Metal", "Crossover", "Contemporary Christian",
00084 "Christian Rock", "Merengue", "Salsa", "Trash Metal", "Anime", "JPop", "Synthpop" };
00085
00086
00087
00088
00089
00090
00091 #define frame_is_read_only(id3v2_frame__) ((id3v2_frame__->status_flag >> 4) & 1)
00092 #define frame_preserve_on_tag_altered(id3v2_frame__) ((id3v2_frame__->status_flag >> 6) & 1)
00093 #define frame_preserve_on_file_altered(id3v2_frame__) ((id3v2_frame__->status_flag >> 5) & 1)
00094
00095 #define frame_has_group_information(id3v2_frame__) ((id3v2_frame__->format_flag >> 6) & 1)
00096 #define frame_is_compressed(id3v2_frame__) ((id3v2_frame__->format_flag >> 3) & 1)
00097 #define frame_is_encrypted(id3v2_frame__) ((id3v2_frame__->format_flag >> 2) & 1)
00098 #define frame_is_unsynchronised(id3v2_frame__) ((id3v2_frame__->format_flag >> 1) & 1)
00099 #define frame_has_data_length_indicator(id3v2_frame__) (id3v2_frame__->format_flag & 1)
00100
00101
00102
00103
00104
00105
00106
00107
00108 static id3v1_tag *id3v1_get_tag(size_t (*read_func)(void *, size_t, void *),
00109 off_t (*lseek_func)(off_t, int, void *),
00110 void *arg);
00111 static id3v2_tag *id3v2_get_tag(size_t (*read_func)(void *, size_t, void *),
00112 off_t (*lseek_func)(off_t, int, void *),
00113 void *arg);
00114
00115
00116 static int id3v1_add_tag(int, id3v1_tag*);
00117 static int id3v2_add_tag(int, id3v2_tag*, id3v2_tag*);
00118
00119
00120 static int id3v1_del_tag(int);
00121 static int id3v2_del_tag(int, id3v2_tag*);
00122
00123
00124 static int id3v1_truncate_tag(id3v1_tag*);
00125
00126
00127 static int id3_is_only_space(char*, int);
00128
00129
00130 static char **id3v2_get_names(id3v2_tag*);
00131
00132
00133 static id3_content* id3v2_get_content_at_pos(id3v2_tag*, const char*, int);
00134 static id3_content* id3v1_get_content(id3v1_tag*, int);
00135
00136
00137 static int id3_get_no_frames(id3v2_tag*);
00138
00139
00140
00141
00142
00143 static int id3_remove_frame(id3v2_frame_list *, id3v2_frame *);
00144
00145
00146 static int id3_add_frame(id3v2_frame_list *, char *, char *, int);
00147
00148
00149 static id3v2_frame* id3_lookup_frame(id3v2_frame_list *, const char *, const int);
00150
00151
00152 static long id3_unsync(unsigned char*, long);
00153 static long id3_sync(unsigned char*, long);
00154 static unsigned int id3_unsync32(unsigned char*, int);
00155 static unsigned char* id3_sync32(unsigned int);
00156
00157 static int id3_lseek_syncword(int);
00158 static int id3_lseek_syncword_r(int, unsigned char *, int);
00159
00160
00161 static id3_tag* id3v1_alloc_tag(void);
00162 static id3_tag* id3v2_alloc_tag(void);
00163
00164
00165 static void id3v1_free_tag(id3v1_tag*);
00166 static void id3v2_free_tag(id3v2_tag*);
00167
00168
00169 size_t read_mem(void *dest, size_t nbytes, void *varg);
00170 off_t lseek_mem(off_t offset, int whence, void *varg);
00171
00172
00173 size_t read_file(void *dest, size_t nbytes, void *varg);
00174 off_t lseek_file(off_t offset, int whence, void *varg);
00175
00176 __END_DECLS
00177
00178 #endif