]> git.sesse.net Git - vlc/blob - modules/access/cdda/cdda.h
Add CD-DA CDDB support via libcddb.
[vlc] / modules / access / cdda / cdda.h
1 /*****************************************************************************
2  * cdda.h : CD-DA input module header for vlc
3  *          using libcdio, libvcd and libvcdinfo
4  *****************************************************************************
5  * Copyright (C) 2003 VideoLAN
6  * $Id: cdda.h,v 1.2 2003/11/30 18:14:20 rocky Exp $
7  *
8  * Authors: Rocky Bernstein <rocky@panix.com> 
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 #include "../vcdx/cdrom.h"
26
27 #ifdef HAVE_LIBCDDB
28 #include <cddb/cddb.h>
29 #endif
30
31 /*****************************************************************************
32  * Debugging 
33  *****************************************************************************/
34 #define INPUT_DBG_META        1 /* Meta information */
35 #define INPUT_DBG_EVENT       2 /* Trace keyboard events */
36 #define INPUT_DBG_MRL         4 /* MRL debugging */
37 #define INPUT_DBG_EXT         8 /* Calls from external routines */
38 #define INPUT_DBG_CALL       16 /* all calls */
39 #define INPUT_DBG_LSN        32 /* LSN changes */
40 #define INPUT_DBG_SEEK       64 /* Seeks to set location */
41 #define INPUT_DBG_CDIO      128 /* Debugging from CDIO */
42 #define INPUT_DBG_CDDB      256 /* CDDB debugging  */
43
44 #define INPUT_DEBUG 1
45 #if INPUT_DEBUG
46 #define dbg_print(mask, s, args...) \
47    if (p_cdda->i_debug & mask) \
48      msg_Dbg(p_input, "%s: "s, __func__ , ##args)
49 #else
50 #define dbg_print(mask, s, args...) 
51 #endif
52
53 /*****************************************************************************
54  * cdda_data_t: CD audio information
55  *****************************************************************************/
56 typedef struct cdda_data_s
57 {
58     cddev_t     *p_cddev;                           /* CD device descriptor */
59     int         i_nb_tracks;                        /* Nb of tracks (titles) */
60     int         i_track;                                    /* Current track */
61     lsn_t       i_sector;                                  /* Current Sector */
62     lsn_t *     p_sectors;                                  /* Track sectors */
63     vlc_bool_t  b_end_of_track;           /* If the end of track was reached */
64     int         i_debug;                  /* Debugging mask */
65     intf_thread_t *p_intf;
66
67 #ifdef HAVE_LIBCDDB
68   struct  {
69     bool             have_info;      /* True if we have any info */
70     cddb_disc_t     *disc;           /* libcdio uses this to get disc info */
71     char            *cdiscid;
72     char            *disc_title;
73     char             disc_year[5];   /* Year. Probably 19XX or 20XX */
74     char            *disc_artist;
75     char            *disc_genre;
76     cddb_cat_t       disc_category;  /* CDDB category */
77     int              disc_seconds;   /* Length in seconds listed in CDDB
78                                         catalog. May or may not match
79                                         length below.
80                                      */
81
82     int              disc_length;    /* Length in frames of cd. Used in 
83                                         CDDB lookups */
84     unsigned int     disc_id;        /* This along with the length and 
85                                         num_tracks below is what CDDB uses
86                                         to look up CD info */
87   } cddb;
88 #endif
89
90
91 } cdda_data_t;
92
93 /*****************************************************************************
94  * CDDAPlay: Arrange things so we play the specified track.
95  * VLC_TRUE is returned if there was no error.
96  *****************************************************************************/
97 vlc_bool_t  CDDAPlay         ( input_thread_t *, int );