Main Page | Class List | Directories | File List | Class Members | File Members

cddb_disc.h

Go to the documentation of this file.
00001 /*
00002     $Id: cddb_disc.h,v 1.20 2005/03/11 21:29:29 airborne Exp $
00003 
00004     Copyright (C) 2003, 2004, 2005 Kris Verbeeck <airborne@advalvas.be>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library 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 GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the
00018     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019     Boston, MA  02111-1307, USA.
00020 */
00021 
00022 #ifndef CDDB_DISC_H
00023 #define CDDB_DISC_H 1
00024 
00025 #ifdef __cplusplus
00026     extern "C" {
00027 #endif
00028 
00029 
00030 #include <cddb/cddb_track.h>
00031 
00032 
00036 #define FRAMES_PER_SECOND 75
00037 
00041 #define FRAMES_TO_SECONDS(f) ((f) / FRAMES_PER_SECOND)
00042 
00046 #define SECONDS_TO_FRAMES(s) ((s) * FRAMES_PER_SECOND)
00047 
00051 typedef enum {
00052     CDDB_CAT_DATA = 0,          
00053     CDDB_CAT_FOLK,              
00054     CDDB_CAT_JAZZ,              
00055     CDDB_CAT_MISC,              
00057     CDDB_CAT_ROCK,              
00058     CDDB_CAT_COUNTRY,           
00059     CDDB_CAT_BLUES,             
00060     CDDB_CAT_NEWAGE,            
00061     CDDB_CAT_REGGAE,            
00062     CDDB_CAT_CLASSICAL,         
00063     CDDB_CAT_SOUNDTRACK,        
00064     CDDB_CAT_INVALID,           
00065     CDDB_CAT_LAST               
00066 } cddb_cat_t;
00067 
00071 extern const char *CDDB_CATEGORY[CDDB_CAT_LAST];
00072 
00077 typedef struct cddb_disc_s
00078 {
00079     unsigned int discid;        
00080     cddb_cat_t category;        
00081     char *genre;                
00082     char *title;                
00083     char *artist;               
00084     int length;                 
00085     int year;                   
00086     char *ext_data;             
00087     int track_cnt;              
00088     cddb_track_t *tracks;       
00089     cddb_track_t *iterator;     
00090 } cddb_disc_t;
00091 
00092 
00093 /* --- construction / destruction */
00094 
00095 
00101 cddb_disc_t *cddb_disc_new(void);
00102 
00109 void cddb_disc_destroy(cddb_disc_t *disc);
00110 
00116 cddb_disc_t *cddb_disc_clone(cddb_disc_t *disc);
00117 
00118 
00119 /* --- track manipulation */
00120 
00121 
00129 void cddb_disc_add_track(cddb_disc_t *disc, cddb_track_t *track);
00130 
00138 cddb_track_t *cddb_disc_get_track(cddb_disc_t *disc, int track_no);
00139 
00150 cddb_track_t *cddb_disc_get_track_first(cddb_disc_t *disc);
00151 
00162 cddb_track_t *cddb_disc_get_track_next(cddb_disc_t *disc);
00163 
00164 
00165 /* --- setters / getters --- */
00166 
00167 
00174 #define cddb_disc_get_discid(disc) (disc)->discid
00175 
00187 #define cddb_disc_set_discid(disc, id) (disc)->discid = id
00188 
00204 #define cddb_disc_get_category(disc) (disc)->category
00205 
00218 #define cddb_disc_set_category(disc, cat) (disc)->category = cat
00219 
00233 const char *cddb_disc_get_category_str(cddb_disc_t *disc);
00234 
00247 void cddb_disc_set_category_str(cddb_disc_t *disc, const char *cat);
00248 
00257 #define cddb_disc_get_genre(disc) (disc)->genre
00258 
00270 void cddb_disc_set_genre(cddb_disc_t *disc, const char *genre);
00271 
00279 #define cddb_disc_get_length(disc) (disc)->length
00280 
00287 #define cddb_disc_set_length(disc, l) (disc)->length = l
00288 
00296 #define cddb_disc_get_year(disc) (disc)->year
00297 
00304 #define cddb_disc_set_year(disc, y) (disc)->year = y
00305 
00312 #define cddb_disc_get_track_count(disc) (disc)->track_cnt
00313 
00321 #define cddb_disc_get_title(disc) (disc)->title
00322 
00332 void cddb_disc_set_title(cddb_disc_t *disc, const char *title);
00333 
00342 void cddb_disc_append_title(cddb_disc_t *disc, const char *title);
00343 
00351 #define cddb_disc_get_artist(disc) (disc)->artist
00352 
00362 void cddb_disc_set_artist(cddb_disc_t *disc, const char *artist);
00363 
00372 void cddb_disc_append_artist(cddb_disc_t *disc, const char *artist);
00373 
00381 #define cddb_disc_get_ext_data(disc) (disc)->ext_data
00382 
00393 void cddb_disc_set_ext_data(cddb_disc_t *disc, const char *ext_data);
00394 
00404 void cddb_disc_append_ext_data(cddb_disc_t *disc, const char *ext_data);
00405 
00406 
00407 /* --- miscellaneous */
00408 
00409 
00420 void cddb_disc_copy(cddb_disc_t *dst, cddb_disc_t *src);
00421 
00432 int cddb_disc_calc_discid(cddb_disc_t *disc);
00433 
00440 void cddb_disc_print(cddb_disc_t *disc);
00441 
00442 
00443 #ifdef __cplusplus
00444     }
00445 #endif
00446 
00447 #endif /* CDDB_DISC_H */

Generated on Thu Apr 21 21:02:15 2005 for libcddb by  doxygen 1.3.9.1