]> git.sesse.net Git - vlc/blob - modules/access/cdda/cdda.h
configure.ac: reinstate libcdio CD-DA and VCD plugins (on demand)
[vlc] / modules / access / cdda / cdda.h
1 /*****************************************************************************
2  * cdda.h : CD-DA input module header for vlc using libcdio.
3  *****************************************************************************
4  * Copyright (C) 2003 VideoLAN
5  * $Id$
6  *
7  * Author: Rocky Bernstein <rocky@panix.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #include <vlc/input.h>
25 #include <cdio/cdio.h>
26 #include <cdio/cdtext.h>
27 #include "vlc_meta.h"
28 #include "codecs.h"
29
30 #ifdef HAVE_LIBCDDB
31 #include <cddb/cddb.h>
32 #endif
33
34 #define CDDA_MRL_PREFIX "cddax://"
35
36 /* Frequency of sample in bits per second. */
37 #define CDDA_FREQUENCY_SAMPLE 44100
38
39 /*****************************************************************************
40  * Debugging
41  *****************************************************************************/
42 #define INPUT_DBG_META        1 /* Meta information */
43 #define INPUT_DBG_EVENT       2 /* Trace keyboard events */
44 #define INPUT_DBG_MRL         4 /* MRL debugging */
45 #define INPUT_DBG_EXT         8 /* Calls from external routines */
46 #define INPUT_DBG_CALL       16 /* all calls */
47 #define INPUT_DBG_LSN        32 /* LSN changes */
48 #define INPUT_DBG_SEEK       64 /* Seeks to set location */
49 #define INPUT_DBG_CDIO      128 /* Debugging from CDIO */
50 #define INPUT_DBG_CDDB      256 /* CDDB debugging  */
51
52 #define INPUT_DEBUG 1
53 #if INPUT_DEBUG
54 #define dbg_print(mask, s, args...) \
55    if (p_cdda->i_debug & mask) \
56      msg_Dbg(p_access, "%s: "s, __func__ , ##args)
57 #else
58 #define dbg_print(mask, s, args...)
59 #endif
60
61 #if LIBCDIO_VERSION_NUM >= 72
62 #include <cdio/cdda.h>
63 #else
64 #define CdIo_t CdIo
65 #endif    
66
67 /*****************************************************************************
68  * cdda_data_t: CD audio information
69  *****************************************************************************/
70 typedef struct cdda_data_s
71 {
72   CdIo_t         *p_cdio;                   /* libcdio CD device */
73   track_t        i_tracks;                 /* # of tracks */
74   track_t        i_first_track;            /* # of first track */
75   track_t        i_titles;                 /* # of titles in playlist */
76   
77   /* Current position */
78   track_t        i_track;                  /* Current track */
79   lsn_t          i_lsn;                    /* Current Logical Sector Number */
80   
81   int            i_blocks_per_read;        /* # blocks to get in a read */
82   int            i_debug;                  /* Debugging mask */
83
84   /* Information about CD */
85   vlc_meta_t    *p_meta;
86   char *         psz_mcn;                  /* Media Catalog Number */
87   char *         psz_source;               /* CD drive or CD image filename */
88   input_title_t *p_title[CDIO_CD_MAX_TRACKS]; /* This *is* 0 origin, not
89                                                  track number origin */
90
91 #if LIBCDIO_VERSION_NUM >= 72
92   /* Paranoia support */
93   vlc_bool_t     b_paranoia_enabled;       /* Use cd paranoia for reads? */
94   cdrom_drive_t *paranoia_cd;              /* Place to store drive
95                                               handle given by paranoia. */
96   cdrom_paranoia_t *paranoia;
97
98 #endif    
99   
100 #ifdef HAVE_LIBCDDB
101   vlc_bool_t     b_cddb_enabled;      /* Use CDDB at all? */
102   struct  {
103     vlc_bool_t   have_info;           /* True if we have any info */
104     cddb_disc_t *disc;                /* libcdio uses this to get disc
105                                          info */
106     int          disc_length;         /* Length in frames of cd. Used
107                                          in CDDB lookups */
108   } cddb;
109 #endif
110
111   vlc_bool_t   b_cdtext_enabled;      /* Use CD-Text at all? If not,
112                                          cdtext_preferred is meaningless. */
113   vlc_bool_t   b_cdtext_prefer;       /* Prefer CD-Text info over
114                                          CDDB? If no CDDB, the issue
115                                          is moot. */
116
117   const cdtext_t *p_cdtext[CDIO_CD_MAX_TRACKS]; /* CD-Text info. Origin is NOT 
118                                                    0 origin but origin of track
119                                                    number (usually 1).
120                                                  */
121
122   WAVEHEADER   waveheader;            /* Wave header for the output data  */
123   vlc_bool_t   b_header;
124   vlc_bool_t   b_nav_mode;
125   
126   input_thread_t *p_input;
127   
128 } cdda_data_t;
129
130 /* FIXME: This variable is a hack. Would be nice to eliminate. */
131 extern access_t *p_cdda_input;