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