Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

include/id3/globals.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* $Id: globals.h,v 1.44 2001/08/07 11:58:23 shadrack Exp $
00003 
00004  * id3lib: a C++ library for creating and manipulating id3v1/v2 tags Copyright
00005  * 1999, 2000 Scott Thomas Haug
00006 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Library General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or (at your
00010  * option) any later version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00015  * License for more details.
00016  * 
00017  * You should have received a copy of the GNU Library General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 
00021  * The id3lib authors encourage improvements and optimisations to be sent to
00022  * the id3lib coordinator.  Please see the README file for details on where to
00023  * send such submissions.  See the AUTHORS file for a list of people who have
00024  * contributed to id3lib.  See the ChangeLog file for a list of changes to
00025  * id3lib.  These files are distributed with id3lib at
00026  * http://download.sourceforge.net/id3lib/ 
00027  */
00028 
00033 #ifndef _ID3LIB_GLOBALS_H_
00034 #define _ID3LIB_GLOBALS_H_
00035 
00036 #include <stdlib.h>
00037 #include <id3/sized_types.h>
00038 
00039 /* id3lib version.
00040  * we prefix variable declarations so they can
00041  * properly get exported in windows dlls.
00042  * (borrowed from glib.h http://www.gtk.org)
00043  */
00044 #ifdef WIN32
00045 #  ifdef ID3LIB_COMPILATION
00046 #    define ID3_C_EXPORT extern _declspec(dllexport)
00047 #    define ID3_CPP_EXPORT __declspec(dllexport)
00048 #  else /* !ID3LIB_COMPILATION */
00049 #    define ID3_C_EXPORT extern _declspec(dllimport)
00050 #    define ID3_CPP_EXPORT __declspec(dllimport)
00051 #  endif /* !ID3LIB_COMPILATION */
00052 #else /* !WIN32 */
00053 #  define ID3_C_EXPORT
00054 #  define ID3_CPP_EXPORT
00055 #endif /* !WIN32 */
00056 #define ID3_C_VAR extern
00057 
00058 #ifndef __cplusplus
00059 
00060 typedef int bool;
00061 #  define false (0)
00062 #  define true (!false)
00063 
00064 #endif /* __cplusplus */
00065 
00066 ID3_C_VAR const char * const ID3LIB_NAME;
00067 ID3_C_VAR const char * const ID3LIB_RELEASE;
00068 ID3_C_VAR const char * const ID3LIB_FULL_NAME;
00069 ID3_C_VAR const int          ID3LIB_MAJOR_VERSION;
00070 ID3_C_VAR const int          ID3LIB_MINOR_VERSION;
00071 ID3_C_VAR const int          ID3LIB_PATCH_VERSION;
00072 ID3_C_VAR const int          ID3LIB_INTERFACE_AGE;
00073 ID3_C_VAR const int          ID3LIB_BINARY_AGE;
00074 
00075 #define ID3_TAGID               "ID3"
00076 #define ID3_TAGIDSIZE           (3)
00077 #define ID3_TAGHEADERSIZE       (10)
00078 
00084 #define STR_V1_COMMENT_DESC "ID3v1 Comment"
00085 
00086 
00087 typedef       unsigned char   uchar;
00088 typedef short   signed int    ssint;
00089 typedef short unsigned int    suint;
00090 typedef long    signed int    lsint;
00091 typedef long  unsigned int    luint;
00092 typedef long           double ldoub;
00093 
00094 typedef uint16                unicode_t;
00095 typedef uint16                flags_t;
00096 /* this needs to be done for compatibility with Sun Solaris */
00097 #if !defined index_t
00098 #  define index_t               size_t
00099 #endif
00100 
00101 #define NULL_UNICODE ((unicode_t) '\0')
00102 
00103 /* These macros are used to make the C and C++ declarations for enums and
00104  * structs have the same syntax.  Basically, it allows C users to refer to an
00105  * enum or a struct without prepending enum/struct.
00106  */
00107 #ifdef __cplusplus
00108 #  define ID3_ENUM(E)   enum   E
00109 #  define ID3_STRUCT(S) struct S
00110 #else
00111 #  define ID3_ENUM(E)   typedef enum   _ ## E E; enum   _ ## E
00112 #  define ID3_STRUCT(S) typedef struct _ ## S S; struct _ ## S
00113 #endif
00114 
00118 ID3_ENUM(ID3_TextEnc)
00119 {
00120   ID3TE_NONE = -1,
00121   ID3TE_ISO8859_1,
00122   ID3TE_UTF16,
00123   ID3TE_UTF16BE,
00124   ID3TE_UTF8,
00125   ID3TE_NUMENCODINGS,
00126   ID3TE_ASCII = ID3TE_ISO8859_1,
00127   ID3TE_UNICODE = ID3TE_UTF16
00128 };
00129 
00132 ID3_ENUM(ID3_V1Spec)
00133 {
00134   ID3V1_0 = 0,
00135   ID3V1_1,
00136   ID3V1_NUMSPECS
00137 };
00138 
00139 ID3_ENUM(ID3_V2Spec)
00140 {
00141   ID3V2_UNKNOWN = -1,
00142   ID3V2_2_0 = 0,
00143   ID3V2_2_1,
00144   ID3V2_3_0,
00145   ID3V2_4_0,
00146   ID3V2_EARLIEST = ID3V2_2_0,
00147   ID3V2_LATEST = ID3V2_3_0  
00148 };
00149 
00152 ID3_ENUM(ID3_TagType)
00153 {
00154   ID3TT_NONE       =      0,   
00155   ID3TT_ID3V1      = 1 << 0,   
00156   ID3TT_ID3V2      = 1 << 1,   
00157   ID3TT_LYRICS3    = 1 << 2,   
00158   ID3TT_LYRICS3V2  = 1 << 3,   
00159   ID3TT_MUSICMATCH = 1 << 4,   
00161   ID3TT_LYRICS     = ID3TT_LYRICS3,
00163   ID3TT_ID3        = ID3TT_ID3V1 | ID3TT_ID3V2,
00165   ID3TT_ALL        = ~ID3TT_NONE,
00167   ID3TT_PREPENDED  = ID3TT_ID3V2,
00169   ID3TT_APPENDED   = ID3TT_ALL & ~ID3TT_ID3V2
00170 };
00171 
00175 ID3_ENUM(ID3_FieldID)
00176 {
00177   ID3FN_NOFIELD = 0,    
00178   ID3FN_TEXTENC,        
00179   ID3FN_TEXT,           
00180   ID3FN_URL,            
00181   ID3FN_DATA,           
00182   ID3FN_DESCRIPTION,    
00183   ID3FN_OWNER,          
00184   ID3FN_EMAIL,          
00185   ID3FN_RATING,         
00186   ID3FN_FILENAME,       
00187   ID3FN_LANGUAGE,       
00188   ID3FN_PICTURETYPE,    
00189   ID3FN_IMAGEFORMAT,    
00190   ID3FN_MIMETYPE,       
00191   ID3FN_COUNTER,        
00192   ID3FN_ID,             
00193   ID3FN_VOLUMEADJ,      
00194   ID3FN_NUMBITS,        
00195   ID3FN_VOLCHGRIGHT,    
00196   ID3FN_VOLCHGLEFT,     
00197   ID3FN_PEAKVOLRIGHT,   
00198   ID3FN_PEAKVOLLEFT,    
00199   ID3FN_TIMESTAMPFORMAT,
00200   ID3FN_CONTENTTYPE,    
00201   ID3FN_LASTFIELDID     
00202 };
00203 
00207 ID3_ENUM(ID3_FrameID)
00208 {
00209   /* ???? */ ID3FID_NOFRAME = 0,       
00210   /* AENC */ ID3FID_AUDIOCRYPTO,       
00211   /* APIC */ ID3FID_PICTURE,           
00212   /* COMM */ ID3FID_COMMENT,           
00213   /* COMR */ ID3FID_COMMERCIAL,        
00214   /* ENCR */ ID3FID_CRYPTOREG,         
00215   /* EQUA */ ID3FID_EQUALIZATION,      
00216   /* ETCO */ ID3FID_EVENTTIMING,       
00217   /* GEOB */ ID3FID_GENERALOBJECT,     
00218   /* GRID */ ID3FID_GROUPINGREG,       
00219   /* IPLS */ ID3FID_INVOLVEDPEOPLE,    
00220   /* LINK */ ID3FID_LINKEDINFO,        
00221   /* MCDI */ ID3FID_CDID,              
00222   /* MLLT */ ID3FID_MPEGLOOKUP,        
00223   /* OWNE */ ID3FID_OWNERSHIP,         
00224   /* PRIV */ ID3FID_PRIVATE,           
00225   /* PCNT */ ID3FID_PLAYCOUNTER,       
00226   /* POPM */ ID3FID_POPULARIMETER,     
00227   /* POSS */ ID3FID_POSITIONSYNC,      
00228   /* RBUF */ ID3FID_BUFFERSIZE,        
00229   /* RVAD */ ID3FID_VOLUMEADJ,         
00230   /* RVRB */ ID3FID_REVERB,            
00231   /* SYLT */ ID3FID_SYNCEDLYRICS,      
00232   /* SYTC */ ID3FID_SYNCEDTEMPO,       
00233   /* TALB */ ID3FID_ALBUM,             
00234   /* TBPM */ ID3FID_BPM,               
00235   /* TCOM */ ID3FID_COMPOSER,          
00236   /* TCON */ ID3FID_CONTENTTYPE,       
00237   /* TCOP */ ID3FID_COPYRIGHT,         
00238   /* TDAT */ ID3FID_DATE,              
00239   /* TDLY */ ID3FID_PLAYLISTDELAY,     
00240   /* TENC */ ID3FID_ENCODEDBY,         
00241   /* TEXT */ ID3FID_LYRICIST,          
00242   /* TFLT */ ID3FID_FILETYPE,          
00243   /* TIME */ ID3FID_TIME,              
00244   /* TIT1 */ ID3FID_CONTENTGROUP,      
00245   /* TIT2 */ ID3FID_TITLE,             
00246   /* TIT3 */ ID3FID_SUBTITLE,          
00247   /* TKEY */ ID3FID_INITIALKEY,        
00248   /* TLAN */ ID3FID_LANGUAGE,          
00249   /* TLEN */ ID3FID_SONGLEN,           
00250   /* TMED */ ID3FID_MEDIATYPE,         
00251   /* TOAL */ ID3FID_ORIGALBUM,         
00252   /* TOFN */ ID3FID_ORIGFILENAME,      
00253   /* TOLY */ ID3FID_ORIGLYRICIST,      
00254   /* TOPE */ ID3FID_ORIGARTIST,        
00255   /* TORY */ ID3FID_ORIGYEAR,          
00256   /* TOWN */ ID3FID_FILEOWNER,         
00257   /* TPE1 */ ID3FID_LEADARTIST,        
00258   /* TPE2 */ ID3FID_BAND,              
00259   /* TPE3 */ ID3FID_CONDUCTOR,         
00260   /* TPE4 */ ID3FID_MIXARTIST,         
00261   /* TPOS */ ID3FID_PARTINSET,         
00262   /* TPUB */ ID3FID_PUBLISHER,         
00263   /* TRCK */ ID3FID_TRACKNUM,          
00264   /* TRDA */ ID3FID_RECORDINGDATES,    
00265   /* TRSN */ ID3FID_NETRADIOSTATION,   
00266   /* TRSO */ ID3FID_NETRADIOOWNER,     
00267   /* TSIZ */ ID3FID_SIZE,              
00268   /* TSRC */ ID3FID_ISRC,              
00269   /* TSSE */ ID3FID_ENCODERSETTINGS,   
00270   /* TXXX */ ID3FID_USERTEXT,          
00271   /* TYER */ ID3FID_YEAR,              
00272   /* UFID */ ID3FID_UNIQUEFILEID,      
00273   /* USER */ ID3FID_TERMSOFUSE,        
00274   /* USLT */ ID3FID_UNSYNCEDLYRICS,    
00275   /* WCOM */ ID3FID_WWWCOMMERCIALINFO, 
00276   /* WCOP */ ID3FID_WWWCOPYRIGHT,      
00277   /* WOAF */ ID3FID_WWWAUDIOFILE,      
00278   /* WOAR */ ID3FID_WWWARTIST,         
00279   /* WOAS */ ID3FID_WWWAUDIOSOURCE,    
00280   /* WORS */ ID3FID_WWWRADIOPAGE,      
00281   /* WPAY */ ID3FID_WWWPAYMENT,        
00282   /* WPUB */ ID3FID_WWWPUBLISHER,      
00283   /* WXXX */ ID3FID_WWWUSER,           
00284   /*      */ ID3FID_METACRYPTO,        
00285   /*      */ ID3FID_METACOMPRESSION,   
00286   /* >>>> */ ID3FID_LASTFRAMEID        
00287 };
00288 
00289 ID3_ENUM(ID3_V1Lengths)
00290 {
00291   ID3_V1_LEN         = 128,
00292   ID3_V1_LEN_ID      =   3,
00293   ID3_V1_LEN_TITLE   =  30,
00294   ID3_V1_LEN_ARTIST  =  30,
00295   ID3_V1_LEN_ALBUM   =  30,
00296   ID3_V1_LEN_YEAR    =   4,
00297   ID3_V1_LEN_COMMENT =  30,
00298   ID3_V1_LEN_GENRE   =   1
00299 };
00300 
00301 ID3_ENUM(ID3_FieldFlags)
00302 {
00303   ID3FF_NONE       =      0,
00304   ID3FF_CSTR       = 1 << 0,
00305   ID3FF_LIST       = 1 << 1,
00306   ID3FF_ENCODABLE  = 1 << 2,
00307   ID3FF_TEXTLIST   = ID3FF_CSTR | ID3FF_LIST | ID3FF_ENCODABLE
00308 };
00309 
00311 ID3_ENUM(ID3_FieldType)
00312 {
00313   ID3FTY_NONE           = -1,
00314   ID3FTY_INTEGER        = 0,
00315   ID3FTY_BINARY,
00316   ID3FTY_TEXTSTRING,
00317   ID3FTY_NUMTYPES
00318 };
00319 
00323 ID3_ENUM(ID3_Err)
00324 {
00325   ID3E_NoError = 0,             
00326   ID3E_NoMemory,                
00327   ID3E_NoData,                  
00328   ID3E_BadData,                 
00329   ID3E_NoBuffer,                
00330   ID3E_SmallBuffer,             
00331   ID3E_InvalidFrameID,          
00332   ID3E_FieldNotFound,           
00333   ID3E_UnknownFieldType,        
00334   ID3E_TagAlreadyAttached,      
00335   ID3E_InvalidTagVersion,       
00336   ID3E_NoFile,                  
00337   ID3E_ReadOnly,                
00338   ID3E_zlibError                
00339 };
00340 
00341 ID3_ENUM(ID3_ContentType)
00342 {
00343   ID3CT_OTHER = 0,
00344   ID3CT_LYRICS,
00345   ID3CT_TEXTTRANSCRIPTION,
00346   ID3CT_MOVEMENT,
00347   ID3CT_EVENTS,
00348   ID3CT_CHORD,
00349   ID3CT_TRIVIA
00350 };
00351 
00352 ID3_ENUM(ID3_TimeStampFormat)
00353 {
00354   ID3TSF_FRAME  = 1,
00355   ID3TSF_MS
00356 };
00357 
00358 #define MASK(bits) ((1 << (bits)) - 1)
00359 #define MASK1 MASK(1)
00360 #define MASK2 MASK(2)
00361 #define MASK3 MASK(3)
00362 #define MASK4 MASK(4)
00363 #define MASK5 MASK(5)
00364 #define MASK6 MASK(6)
00365 #define MASK7 MASK(7)
00366 #define MASK8 MASK(8)
00367 
00368 /*
00369  * The following is borrowed from glib.h (http://www.gtk.org)
00370  */
00371 #ifdef WIN32
00372 
00373 /* On native Win32, directory separator is the backslash, and search path
00374  * separator is the semicolon.
00375  */
00376 #  define ID3_DIR_SEPARATOR '\\'
00377 #  define ID3_DIR_SEPARATOR_S "\\"
00378 #  define ID3_SEARCHPATH_SEPARATOR ';'
00379 #  define ID3_SEARCHPATH_SEPARATOR_S ";"
00380 
00381 #else  /* !WIN32 */
00382 
00383 #  ifndef _EMX_
00384 /* Unix */
00385 
00386 #    define ID3_DIR_SEPARATOR '/'
00387 #    define ID3_DIR_SEPARATOR_S "/"
00388 #    define ID3_SEARCHPATH_SEPARATOR ':'
00389 #    define ID3_SEARCHPATH_SEPARATOR_S ":"
00390 
00391 #  else
00392 /* EMX/OS2 */
00393 
00394 #    define ID3_DIR_SEPARATOR '/'
00395 #    define ID3_DIR_SEPARATOR_S "/"
00396 #    define ID3_SEARCHPATH_SEPARATOR ';'
00397 #    define ID3_SEARCHPATH_SEPARATOR_S ";"
00398 
00399 #  endif
00400 
00401 #endif /* !WIN32 */
00402 
00403 #ifndef NULL
00404 #  define NULL ((void*) 0)
00405 #endif
00406 
00407 #endif /* _ID3LIB_GLOBALS_H_ */

Generated at Sat Sep 8 15:51:07 2001 for id3lib by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001