id3.h

Go to the documentation of this file.
00001 /*  Copyright (c) 2006-2007, Philip Busch <broesel@studcs.uni-sb.de>
00002  *  All rights reserved.
00003  *
00004  *  Redistribution and use in source and binary forms, with or without
00005  *  modification, are permitted provided that the following conditions are met:
00006  *
00007  *   - Redistributions of source code must retain the above copyright notice,
00008  *     this list of conditions and the following disclaimer.
00009  *   - Redistributions in binary form must reproduce the above copyright
00010  *     notice, this list of conditions and the following disclaimer in the
00011  *     documentation and/or other materials provided with the distribution.
00012  *
00013  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00014  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00015  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00016  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00017  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00018  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00019  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00020  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00021  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00022  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00023  *  POSSIBILITY OF SUCH DAMAGE.
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 /* ! _ID3_H */

Generated on Thu Jul 19 13:36:09 2007 for libv by  doxygen 1.5.1-p1. Thank you, SourceForge.net Logo