libcdio  0.90
cdtext.h
Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2004, 2005, 2008, 2012 Rocky Bernstein <rocky@gnu.org>
00003     adapted from cuetools
00004     Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm>
00005 
00006     This program is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00026 
00027 #ifndef CDIO_CDTEXT_H_
00028 #define CDIO_CDTEXT_H_
00029 
00030 #include <cdio/types.h>
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif /* __cplusplus */
00035 
00036 #define MIN_CDTEXT_FIELD          0
00037 #define MAX_CDTEXT_FIELDS         10
00038 
00040 typedef enum {
00041   CDTEXT_FIELD_TITLE          =  0,   
00042   CDTEXT_FIELD_PERFORMER      =  1,   
00043   CDTEXT_FIELD_SONGWRITER     =  2,   
00044   CDTEXT_FIELD_COMPOSER       =  3,   
00045   CDTEXT_FIELD_MESSAGE        =  4,   
00046   CDTEXT_FIELD_ARRANGER       =  5,   
00047   CDTEXT_FIELD_ISRC           =  6,   
00048   CDTEXT_FIELD_UPC_EAN        =  7,   
00049   CDTEXT_FIELD_GENRE          =  8,   
00050   CDTEXT_FIELD_DISCID         =  9,   
00051   CDTEXT_FIELD_INVALID        =  MAX_CDTEXT_FIELDS 
00052 } cdtext_field_t;
00053 
00055 typedef enum {
00056   CDTEXT_GENRE_UNUSED         =  0,   
00057   CDTEXT_GENRE_UNDEFINED      =  1,   
00058   CDTEXT_GENRE_ADULT_CONTEMP  =  2,   
00059   CDTEXT_GENRE_ALT_ROCK       =  3,   
00060   CDTEXT_GENRE_CHILDRENS      =  4,   
00061   CDTEXT_GENRE_CLASSIC        =  5,   
00062   CDTEXT_GENRE_CHRIST_CONTEMP =  6,   
00063   CDTEXT_GENRE_COUNTRY        =  7,   
00064   CDTEXT_GENRE_DANCE          =  8,   
00065   CDTEXT_GENRE_EASY_LISTENING =  9,   
00066   CDTEXT_GENRE_EROTIC         = 10,   
00067   CDTEXT_GENRE_FOLK           = 11,   
00068   CDTEXT_GENRE_GOSPEL         = 12,   
00069   CDTEXT_GENRE_HIPHOP         = 13,   
00070   CDTEXT_GENRE_JAZZ           = 14,   
00071   CDTEXT_GENRE_LATIN          = 15,   
00072   CDTEXT_GENRE_MUSICAL        = 16,   
00073   CDTEXT_GENRE_NEWAGE         = 17,   
00074   CDTEXT_GENRE_OPERA          = 18,   
00075   CDTEXT_GENRE_OPERETTA       = 19,   
00076   CDTEXT_GENRE_POP            = 20,   
00077   CDTEXT_GENRE_RAP            = 21,   
00078   CDTEXT_GENRE_REGGAE         = 22,   
00079   CDTEXT_GENRE_ROCK           = 23,   
00080   CDTEXT_GENRE_RYTHMANDBLUES  = 24,   
00081   CDTEXT_GENRE_SOUNDEFFECTS   = 25,   
00082   CDTEXT_GENRE_SOUNDTRACK     = 26,   
00083   CDTEXT_GENRE_SPOKEN_WORD    = 27,   
00084   CDTEXT_GENRE_WORLD_MUSIC    = 28    
00085 } cdtext_genre_t;
00086 
00092 typedef enum {
00093   CDTEXT_LANGUAGE_UNKNOWN     = 0x00,
00094   CDTEXT_LANGUAGE_ALBANIAN    = 0x01,
00095   CDTEXT_LANGUAGE_BRETON      = 0x02,
00096   CDTEXT_LANGUAGE_CATALAN     = 0x03,
00097   CDTEXT_LANGUAGE_CROATIAN    = 0x04,
00098   CDTEXT_LANGUAGE_WELSH       = 0x05,
00099   CDTEXT_LANGUAGE_CZECH       = 0x06,
00100   CDTEXT_LANGUAGE_DANISH      = 0x07,
00101   CDTEXT_LANGUAGE_GERMAN      = 0x08,
00102   CDTEXT_LANGUAGE_ENGLISH     = 0x09,
00103   CDTEXT_LANGUAGE_SPANISH     = 0x0A,
00104   CDTEXT_LANGUAGE_ESPERANTO   = 0x0B,
00105   CDTEXT_LANGUAGE_ESTONIAN    = 0x0C,
00106   CDTEXT_LANGUAGE_BASQUE      = 0x0D,
00107   CDTEXT_LANGUAGE_FAROESE     = 0x0E,
00108   CDTEXT_LANGUAGE_FRENCH      = 0x0F,
00109   CDTEXT_LANGUAGE_FRISIAN     = 0x10,
00110   CDTEXT_LANGUAGE_IRISH       = 0x11,
00111   CDTEXT_LANGUAGE_GAELIC      = 0x12,
00112   CDTEXT_LANGUAGE_GALICIAN    = 0x13,
00113   CDTEXT_LANGUAGE_ICELANDIC   = 0x14,
00114   CDTEXT_LANGUAGE_ITALIAN     = 0x15,
00115   CDTEXT_LANGUAGE_LAPPISH     = 0x16,
00116   CDTEXT_LANGUAGE_LATIN       = 0x17,
00117   CDTEXT_LANGUAGE_LATVIAN     = 0x18,
00118   CDTEXT_LANGUAGE_LUXEMBOURGIAN = 0x19,
00119   CDTEXT_LANGUAGE_LITHUANIAN  = 0x1A,
00120   CDTEXT_LANGUAGE_HUNGARIAN   = 0x1B,
00121   CDTEXT_LANGUAGE_MALTESE     = 0x1C,
00122   CDTEXT_LANGUAGE_DUTCH       = 0x1D,
00123   CDTEXT_LANGUAGE_NORWEGIAN   = 0x1E,
00124   CDTEXT_LANGUAGE_OCCITAN     = 0x1F,
00125   CDTEXT_LANGUAGE_POLISH      = 0x20,
00126   CDTEXT_LANGUAGE_PORTUGUESE  = 0x21,
00127   CDTEXT_LANGUAGE_ROMANIAN    = 0x22,
00128   CDTEXT_LANGUAGE_ROMANSH     = 0x23,
00129   CDTEXT_LANGUAGE_SERBIAN     = 0x24,
00130   CDTEXT_LANGUAGE_SLOVAK      = 0x25,
00131   CDTEXT_LANGUAGE_SLOVENIAN   = 0x26,
00132   CDTEXT_LANGUAGE_FINNISH     = 0x27,
00133   CDTEXT_LANGUAGE_SWEDISH     = 0x28,
00134   CDTEXT_LANGUAGE_TURKISH     = 0x29,
00135   CDTEXT_LANGUAGE_FLEMISH     = 0x2A,
00136   CDTEXT_LANGUAGE_WALLON      = 0x2B,
00137   CDTEXT_LANGUAGE_ZULU        = 0x45,
00138   CDTEXT_LANGUAGE_VIETNAMESE  = 0x46,
00139   CDTEXT_LANGUAGE_UZBEK       = 0x47,
00140   CDTEXT_LANGUAGE_URDU        = 0x48,
00141   CDTEXT_LANGUAGE_UKRAINIAN   = 0x49,
00142   CDTEXT_LANGUAGE_THAI        = 0x4A,
00143   CDTEXT_LANGUAGE_TELUGU      = 0x4B,
00144   CDTEXT_LANGUAGE_TATAR       = 0x4C,
00145   CDTEXT_LANGUAGE_TAMIL       = 0x4D,
00146   CDTEXT_LANGUAGE_TADZHIK     = 0x4E,
00147   CDTEXT_LANGUAGE_SWAHILI     = 0x4F,
00148   CDTEXT_LANGUAGE_SRANANTONGO = 0x50,
00149   CDTEXT_LANGUAGE_SOMALI      = 0x51,
00150   CDTEXT_LANGUAGE_SINHALESE   = 0x52,
00151   CDTEXT_LANGUAGE_SHONA       = 0x53,
00152   CDTEXT_LANGUAGE_SERBO_CROAT = 0x54,
00153   CDTEXT_LANGUAGE_RUTHENIAN   = 0x55,
00154   CDTEXT_LANGUAGE_RUSSIAN     = 0x56,
00155   CDTEXT_LANGUAGE_QUECHUA     = 0x57,
00156   CDTEXT_LANGUAGE_PUSHTU      = 0x58,
00157   CDTEXT_LANGUAGE_PUNJABI     = 0x59,
00158   CDTEXT_LANGUAGE_PERSIAN     = 0x5A,
00159   CDTEXT_LANGUAGE_PAPAMIENTO  = 0x5B,
00160   CDTEXT_LANGUAGE_ORIYA       = 0x5C,
00161   CDTEXT_LANGUAGE_NEPALI      = 0x5D,
00162   CDTEXT_LANGUAGE_NDEBELE     = 0x5E,
00163   CDTEXT_LANGUAGE_MARATHI     = 0x5F,
00164   CDTEXT_LANGUAGE_MOLDAVIAN   = 0x60,
00165   CDTEXT_LANGUAGE_MALAYSIAN   = 0x61,
00166   CDTEXT_LANGUAGE_MALAGASAY   = 0x62,
00167   CDTEXT_LANGUAGE_MACEDONIAN  = 0x63,
00168   CDTEXT_LANGUAGE_LAOTIAN     = 0x64,
00169   CDTEXT_LANGUAGE_KOREAN      = 0x65,
00170   CDTEXT_LANGUAGE_KHMER       = 0x66,
00171   CDTEXT_LANGUAGE_KAZAKH      = 0x67,
00172   CDTEXT_LANGUAGE_KANNADA     = 0x68,
00173   CDTEXT_LANGUAGE_JAPANESE    = 0x69,
00174   CDTEXT_LANGUAGE_INDONESIAN  = 0x6A,
00175   CDTEXT_LANGUAGE_HINDI       = 0x6B,
00176   CDTEXT_LANGUAGE_HEBREW      = 0x6C,
00177   CDTEXT_LANGUAGE_HAUSA       = 0x6D,
00178   CDTEXT_LANGUAGE_GURANI      = 0x6E,
00179   CDTEXT_LANGUAGE_GUJURATI    = 0x6F,
00180   CDTEXT_LANGUAGE_GREEK       = 0x70,
00181   CDTEXT_LANGUAGE_GEORGIAN    = 0x71,
00182   CDTEXT_LANGUAGE_FULANI      = 0x72,
00183   CDTEXT_LANGUAGE_DARI        = 0x73,
00184   CDTEXT_LANGUAGE_CHURASH     = 0x74,
00185   CDTEXT_LANGUAGE_CHINESE     = 0x75,
00186   CDTEXT_LANGUAGE_BURMESE     = 0x76,
00187   CDTEXT_LANGUAGE_BULGARIAN   = 0x77,
00188   CDTEXT_LANGUAGE_BENGALI     = 0x78,
00189   CDTEXT_LANGUAGE_BIELORUSSIAN = 0x79,
00190   CDTEXT_LANGUAGE_BAMBORA     = 0x7A,
00191   CDTEXT_LANGUAGE_AZERBAIJANI = 0x7B,
00192   CDTEXT_LANGUAGE_ASSAMESE    = 0x7C,
00193   CDTEXT_LANGUAGE_ARMENIAN    = 0x7D,
00194   CDTEXT_LANGUAGE_ARABIC      = 0x7E,
00195   CDTEXT_LANGUAGE_AMHARIC     = 0x7F
00196 } cdtext_lang_t;
00197 
00201 typedef struct cdtext_s cdtext_t;
00202 
00206 const char *cdtext_genre2str (cdtext_genre_t i);
00207 
00211 const char *cdtext_lang2str (cdtext_lang_t i);
00212 
00216 const char *cdtext_field2str (cdtext_field_t i);
00217 
00224 cdtext_t *cdtext_init (void);
00225 
00235 int cdtext_data_init(cdtext_t *p_cdtext, uint8_t *wdata, size_t i_data);
00236 
00242 void cdtext_destroy (cdtext_t *p_cdtext);
00243 
00250 char *cdtext_get (const cdtext_t *p_cdtext, cdtext_field_t key, track_t track);
00251 
00262 const char *cdtext_get_const (const cdtext_t *p_cdtext, cdtext_field_t field, 
00263                               track_t track);
00264 
00270 cdtext_genre_t cdtext_get_genre (const cdtext_t *p_cdtext);
00271 
00277 cdtext_lang_t cdtext_get_language (const cdtext_t *p_cdtext);
00278 
00287 bool cdtext_select_language(cdtext_t *p_cdtext, cdtext_lang_t language);
00288 
00289 /*
00290   Returns a list of available languages or NULL.
00291 
00292   Internally the list is stored in a static array.
00293 
00294   @param p_cdtext the CD-TEXT object
00295 */
00296 cdtext_lang_t *cdtext_list_languages (const cdtext_t *p_cdtext);
00297 
00309 void cdtext_set (cdtext_t *p_cdtext, cdtext_field_t key, const uint8_t *value, track_t track, const char *charset);
00310 
00311 #ifdef __cplusplus
00312 }
00313 #endif /* __cplusplus */
00314 
00315 #endif /* CDIO_CDTEXT_H_ */
00316 
00317 /* 
00318  * Local variables:
00319  *  c-file-style: "gnu"
00320  *  tab-width: 8
00321  *  indent-tabs-mode: nil
00322  * End:
00323  */