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