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