00001 /***************************************************************************** 00002 * cdda.h : CD-DA input module header for vlc using libcdio. 00003 ***************************************************************************** 00004 * Copyright (C) 2003 the VideoLAN team 00005 * $Id$ 00006 * 00007 * Author: Rocky Bernstein <rocky@panix.com> 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00022 *****************************************************************************/ 00023 00024 #include <vlc_input.h> 00025 #include <vlc_access.h> 00026 #include <cdio/cdio.h> 00027 #include <cdio/cdtext.h> 00028 #if LIBCDIO_VERSION_NUM >= 73 00029 #include <cdio/audio.h> 00030 #include <cdio/mmc.h> 00031 #endif 00032 00033 #include <vlc_meta.h> 00034 #include <vlc_codecs.h> 00035 00036 #ifdef HAVE_LIBCDDB 00037 #include <cddb/cddb.h> 00038 #endif 00039 00040 00041 #define CDDA_MRL_PREFIX "cddax://" 00042 00043 /* Frequency of sample in bits per second. */ 00044 #define CDDA_FREQUENCY_SAMPLE 44100 00045 00046 /***************************************************************************** 00047 * Debugging 00048 *****************************************************************************/ 00049 #define INPUT_DBG_META 1 /* Meta information */ 00050 #define INPUT_DBG_EVENT 2 /* Trace keyboard events */ 00051 #define INPUT_DBG_MRL 4 /* MRL debugging */ 00052 #define INPUT_DBG_EXT 8 /* Calls from external routines */ 00053 #define INPUT_DBG_CALL 16 /* all calls */ 00054 #define INPUT_DBG_LSN 32 /* LSN changes */ 00055 #define INPUT_DBG_SEEK 64 /* Seeks to set location */ 00056 #define INPUT_DBG_CDIO 128 /* Debugging from CDIO */ 00057 #define INPUT_DBG_CDDB 256 /* CDDB debugging */ 00058 00059 #define INPUT_DEBUG 1 00060 #if INPUT_DEBUG 00061 #define dbg_print(mask, s, args...) \ 00062 if (p_cdda->i_debug & mask) \ 00063 msg_Dbg(p_access, "%s: "s, __func__ , ##args) 00064 #else 00065 #define dbg_print(mask, s, args...) 00066 #endif 00067 00068 #if LIBCDIO_VERSION_NUM >= 72 00069 #include <cdio/cdda.h> 00070 #include <cdio/paranoia.h> 00071 #else 00072 #define CdIo_t CdIo 00073 #endif 00074 00075 /***************************************************************************** 00076 * cdda_data_t: CD audio information 00077 *****************************************************************************/ 00078 typedef struct cdda_data_s 00079 { 00080 CdIo_t *p_cdio; /* libcdio CD device */ 00081 track_t i_tracks; /* # of tracks */ 00082 track_t i_first_track; /* # of first track */ 00083 track_t i_titles; /* # of titles in playlist */ 00084 00085 /* Current position */ 00086 track_t i_track; /* Current track */ 00087 lsn_t i_lsn; /* Current Logical Sector Number */ 00088 00089 lsn_t first_frame; /* LSN of first frame of this track */ 00090 lsn_t last_frame; /* LSN of last frame of this track */ 00091 lsn_t last_disc_frame; /* LSN of last frame on CD */ 00092 int i_blocks_per_read; /* # blocks to get in a read */ 00093 int i_debug; /* Debugging mask */ 00094 00095 /* Information about CD */ 00096 vlc_meta_t *p_meta; 00097 char * psz_mcn; /* Media Catalog Number */ 00098 char * psz_source; /* CD drive or CD image filename */ 00099 input_title_t *p_title[CDIO_CD_MAX_TRACKS]; /* This *is* 0 origin, not 00100 track number origin */ 00101 00102 #if LIBCDIO_VERSION_NUM >= 72 00103 /* Paranoia support */ 00104 paranoia_mode_t e_paranoia; /* Use cd paranoia for reads? */ 00105 cdrom_drive_t *paranoia_cd; /* Place to store drive 00106 handle given by paranoia. */ 00107 cdrom_paranoia_t *paranoia; 00108 00109 #endif 00110 00111 #ifdef HAVE_LIBCDDB 00112 bool b_cddb_enabled; /* Use CDDB at all? */ 00113 struct { 00114 bool have_info; /* True if we have any info */ 00115 cddb_disc_t *disc; /* libcdio uses this to get disc 00116 info */ 00117 int disc_length; /* Length in frames of cd. Used 00118 in CDDB lookups */ 00119 } cddb; 00120 #endif 00121 00122 bool b_audio_ctl; /* Use CD-Text audio controls and 00123 audio output? */ 00124 00125 bool b_cdtext; /* Use CD-Text at all? If not, 00126 cdtext_preferred is meaningless. */ 00127 bool b_cdtext_prefer; /* Prefer CD-Text info over 00128 CDDB? If no CDDB, the issue 00129 is moot. */ 00130 00131 const cdtext_t *p_cdtext[CDIO_CD_MAX_TRACKS]; /* CD-Text info. Origin is NOT 00132 0 origin but origin of track 00133 number (usually 1). 00134 */ 00135 00136 WAVEHEADER waveheader; /* Wave header for the output data */ 00137 bool b_header; 00138 bool b_nav_mode; /* If false we view the entire CD as 00139 as a unit rather than each track 00140 as a unit. If b_nav_mode then the 00141 slider area represents the Disc rather 00142 than a track 00143 */ 00144 00145 input_thread_t *p_input; 00146 00147 } cdda_data_t; 00148 00149 /* FIXME: This variable is a hack. Would be nice to eliminate. */ 00150 extern access_t *p_cdda_input;
1.5.6