]> git.sesse.net Git - vlc/blob - modules/access/cdda/cdda.c
2d7abf6c8e3dec79ecd8971c00217509992b5608
[vlc] / modules / access / cdda / cdda.c
1 /*****************************************************************************
2  * cdda.c : CD digital audio input module for vlc using libcdio
3  *****************************************************************************
4  * Copyright (C) 2000, 2003, 2004, 2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27
28 #include "callback.h"
29 #include "access.h"
30 #include <cdio/version.h>
31
32 /*****************************************************************************
33  * Module descriptor
34  *****************************************************************************/
35
36 /*****************************************************************************
37  * Option help text
38  *****************************************************************************/
39
40 #if LIBCDIO_VERSION_NUM >= 72
41 static const char *psz_paranoia_list[] = { "none", "overlap", "full" };
42 static const char *psz_paranoia_list_text[] = { N_("none"), N_("overlap"),
43                                           N_("full") };
44 #endif
45
46 #define DEBUG_LONGTEXT N_( \
47     "This integer when viewed in binary is a debugging mask\n" \
48     "meta info          1\n" \
49     "events             2\n" \
50     "MRL                4\n" \
51     "external call      8\n" \
52     "all calls (0x10)  16\n" \
53     "LSN       (0x20)  32\n" \
54     "seek      (0x40)  64\n" \
55     "libcdio   (0x80) 128\n" \
56     "libcddb  (0x100) 256\n" )
57
58 #define CACHING_LONGTEXT N_( \
59     "Caching value for CDDA streams. This " \
60     "value should be set in millisecond units." )
61
62 #define BLOCKS_PER_READ_LONGTEXT N_( \
63     "How many CD blocks to get on a single CD read. " \
64     "Generally on newer/faster CDs, this increases throughput at the " \
65     "expense of a little more memory usage and initial delay. SCSI-MMC " \
66     "limitations generally don't allow for more than 25 blocks per access.")
67
68 #define CDDB_TITLE_FMT_LONGTEXT N_( \
69 "Format used in the GUI Playlist Title. Similar to the Unix date \n" \
70 "Format specifiers that start with a percent sign. Specifiers are: \n" \
71 "   %a : The artist (for the album)\n" \
72 "   %A : The album information\n" \
73 "   %C : Category\n" \
74 "   %e : The extended data (for a track)\n" \
75 "   %I : CDDB disk ID\n" \
76 "   %G : Genre\n" \
77 "   %M : The current MRL\n" \
78 "   %m : The CD-DA Media Catalog Number (MCN)\n" \
79 "   %n : The number of tracks on the CD\n" \
80 "   %p : The artist/performer/composer in the track\n" \
81 "   %T : The track number\n" \
82 "   %s : Number of seconds in this track\n" \
83 "   %S : Number of seconds in the CD\n" \
84 "   %t : The track title or MRL if no title\n" \
85 "   %Y : The year 19xx or 20xx\n" \
86 "   %% : a % \n")
87
88 #define TITLE_FMT_LONGTEXT N_( \
89 "Format used in the GUI Playlist Title. Similar to the Unix date \n" \
90 "Format specifiers that start with a percent sign. Specifiers are: \n" \
91 "   %M : The current MRL\n" \
92 "   %m : The CD-DA Media Catalog Number (MCN)\n" \
93 "   %n : The number of tracks on the CD\n" \
94 "   %T : The track number\n" \
95 "   %s : Number of seconds in this track\n" \
96 "   %S : Number of seconds in the CD\n" \
97 "   %t : The track title or MRL if no title\n" \
98 "   %% : a % \n")
99
100 #define PARANOIA_TEXT N_("Enable CD paranoia?")
101 #define PARANOIA_LONGTEXT N_( \
102         "Select whether to use CD Paranoia for jitter/error correction.\n" \
103         "none: no paranoia - fastest.\n" \
104         "overlap: do only overlap detection - not generally recommended.\n" \
105         "full: complete jitter and error correction detection - slowest.\n" )
106
107 /*****************************************************************************
108  * Module descriptor
109  *****************************************************************************/
110
111 vlc_module_begin();
112     add_usage_hint( N_("cddax://[device-or-file][@[T]track]") );
113     set_description( _("Compact Disc Digital Audio (CD-DA) input") );
114     set_capability( "access2", 10 /* compare with priority of cdda */ );
115     set_shortname( _("Audio Compact Disc"));
116     set_callbacks( CDDAOpen, CDDAClose );
117     add_shortcut( "cddax" );
118     add_shortcut( "cd" );
119     set_category( CAT_INPUT );
120     set_subcategory( SUBCAT_INPUT_ACCESS );
121
122     /* Configuration options */
123     add_integer ( MODULE_STRING "-debug", 0, CDDADebugCB,
124                   N_("Additional debug"),
125                   DEBUG_LONGTEXT, VLC_TRUE );
126
127     add_integer( MODULE_STRING "-caching",
128                  DEFAULT_PTS_DELAY / MILLISECONDS_PER_SEC, NULL,
129                  N_("Caching value in microseconds"),
130                  CACHING_LONGTEXT, VLC_TRUE );
131
132     add_integer( MODULE_STRING "-blocks-per-read",
133                  DEFAULT_BLOCKS_PER_READ, CDDABlocksPerReadCB,
134                  N_("Number of blocks per CD read"),
135                  BLOCKS_PER_READ_LONGTEXT, VLC_TRUE );
136
137     add_string( MODULE_STRING "-title-format",
138                 "Track %T. %t", NULL,
139                 N_("Format to use in playlist \"title\" field when no CDDB"),
140                 TITLE_FMT_LONGTEXT, VLC_TRUE );
141
142 #if LIBCDIO_VERSION_NUM >= 73
143     add_bool( MODULE_STRING "-analog-output", VLC_FALSE, NULL,
144               N_("Use CD audio controls and output?"),
145               N_("If set, audio controls and audio jack output are used"),
146               VLC_FALSE );
147 #endif
148
149     add_bool( MODULE_STRING "-cdtext-enabled", VLC_TRUE, CDTextEnabledCB,
150               N_("Do CD-Text lookups?"),
151               N_("If set, get CD-Text information"),
152               VLC_FALSE );
153
154     add_bool( MODULE_STRING "-navigation-mode", VLC_TRUE, 
155 #if FIXED
156               CDDANavModeCB,
157 #else
158               NULL,
159 #endif
160               N_("Use Navigation-style playback?"),
161               N_("Tracks are navigated via Navagation rather than "
162                  "a playlist entries"),
163               VLC_FALSE );
164
165 #if LIBCDIO_VERSION_NUM >= 72
166       add_string( MODULE_STRING "-paranoia", NULL, NULL,
167                 PARANOIA_TEXT,
168                 PARANOIA_LONGTEXT,
169                 VLC_FALSE );
170       change_string_list( psz_paranoia_list, psz_paranoia_list_text, 0 );
171 #endif /* LIBCDIO_VERSION_NUM >= 72 */
172
173 #ifdef HAVE_LIBCDDB
174     set_section( N_("CDDB" ), 0 );
175     add_string( MODULE_STRING "-cddb-title-format",
176                 "Track %T. %t - %p %A", NULL,
177                 N_("Format to use in playlist \"title\" field when using CDDB"),
178                 CDDB_TITLE_FMT_LONGTEXT, VLC_TRUE );
179
180     add_bool( MODULE_STRING "-cddb-enabled", VLC_TRUE, CDDBEnabledCB,
181               N_("CDDB lookups"),
182               N_("If set, lookup CD-DA track information using the CDDB "
183                  "protocol"),
184               VLC_FALSE );
185
186     add_string( MODULE_STRING "-cddb-server", "freedb.freedb.org", NULL,
187                 N_("CDDB server"),
188                 N_( "Contact this CDDB server look up CD-DA information"),
189                 VLC_TRUE );
190
191     add_integer( MODULE_STRING "-cddb-port", 8880, NULL,
192                  N_("CDDB server port"),
193                  N_("CDDB server uses this port number to communicate on"),
194                  VLC_TRUE );
195
196     add_string( MODULE_STRING "-cddb-email", "me@home", NULL,
197                 N_("email address reported to CDDB server"),
198                 N_("email address reported to CDDB server"),
199                 VLC_TRUE );
200
201     add_bool( MODULE_STRING "-cddb-enable-cache", VLC_TRUE, NULL,
202               N_("Cache CDDB lookups?"),
203               N_("If set cache CDDB information about this CD"),
204               VLC_FALSE );
205
206     add_bool( MODULE_STRING "-cddb-httpd", VLC_FALSE, NULL,
207               N_("Contact CDDB via the HTTP protocol?"),
208               N_("If set, the CDDB server gets information via the CDDB HTTP "
209                  "protocol"),
210               VLC_TRUE );
211
212     add_integer( MODULE_STRING "-cddb-timeout", 10, NULL,
213                  N_("CDDB server timeout"),
214                  N_("Time (in seconds) to wait for a response from the "
215                     "CDDB server"),
216                  VLC_FALSE );
217
218     add_string( MODULE_STRING "-cddb-cachedir", "~/.cddbslave", NULL,
219                 N_("Directory to cache CDDB requests"),
220                 N_("Directory to cache CDDB requests"),
221                 VLC_TRUE );
222
223     add_bool( MODULE_STRING "-cdtext-prefer", VLC_TRUE, CDTextPreferCB,
224               N_("Prefer CD-Text info to CDDB info?"),
225               N_("If set, CD-Text information will be preferred "
226                  "to CDDB information when both are available"),
227               VLC_FALSE );
228 #endif /*HAVE_LIBCDDB*/
229
230 vlc_module_end();