]> git.sesse.net Git - vlc/blob - modules/access/cdda/cdda.c
First attempt to reinstate a libcdio cdda.
[vlc] / modules / access / cdda / cdda.c
1 /*****************************************************************************
2  * cddax.c : CD digital audio input module for vlc using libcdio
3  *****************************************************************************
4  * Copyright (C) 2000,2003 VideoLAN
5  * $Id$
6  *
7  * Authors: Rocky Bernstein <rocky@panix.com>
8  *          Laurent Aimar <fenrir@via.ecp.fr>
9  *          Gildas Bazin <gbazin@netcourrier.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 /*****************************************************************************
27  * Preamble
28  *****************************************************************************/
29
30 #include <vlc/vlc.h>
31
32 /*****************************************************************************
33  * prototypes
34  *****************************************************************************/
35 int  E_(CDDAOpen)     ( vlc_object_t * );
36 void E_(CDDAClose)    ( vlc_object_t * );
37
38 int  E_(CDDADebugCB)  ( vlc_object_t *p_this, const char *psz_name,
39                         vlc_value_t oldval, vlc_value_t val,
40                         void *p_data );
41
42 int  E_(CDDBEnabledCB)( vlc_object_t *p_this, const char *psz_name,
43                         vlc_value_t oldval, vlc_value_t val,
44                         void *p_data );
45
46 /*****************************************************************************
47  * Module descriptor
48  *****************************************************************************/
49
50 /*****************************************************************************
51  * Option help text
52  *****************************************************************************/
53
54 #define DEBUG_LONGTEXT N_( \
55     "This integer when viewed in binary is a debugging mask\n" \
56     "meta info        1\n" \
57     "events           2\n" \
58     "MRL              4\n" \
59     "external call    8\n" \
60     "all calls (10)  16\n" \
61     "LSN       (20)  32\n" \
62     "seek      (40)  64\n" \
63     "libcdio   (80) 128\n" \
64     "libcddb  (100) 256\n" )
65
66 #define CACHING_LONGTEXT N_( \
67     "Allows you to modify the default caching value for CDDA streams. This " \
68     "value should be set in millisecond units." )
69
70 #define CDDB_TITLE_FMT_LONGTEXT N_( \
71 "Format used in the GUI Playlist Title. Similar to the Unix date \n" \
72 "Format specifiers that start with a percent sign. Specifiers are: \n" \
73 "   %a : The artist (for the album)\n" \
74 "   %A : The album information\n" \
75 "   %C : Category\n" \
76 "   %e : The extended data (for a track)\n" \
77 "   %I : CDDB disk ID\n" \
78 "   %G : Genre\n" \
79 "   %M : The current MRL\n" \
80 "   %m : The CD-DA Media Catalog Number (MCN)\n" \
81 "   %n : The number of tracks on the CD\n" \
82 "   %p : The artist/performer/composer in the track\n" \
83 "   %T : The track number\n" \
84 "   %s : Number of seconds in this track \n" \
85 "   %t : The title\n" \
86 "   %Y : The year 19xx or 20xx\n" \
87 "   %% : a % \n")
88
89 #define TITLE_FMT_LONGTEXT N_( \
90 "Format used in the GUI Playlist Title. Similar to the Unix date \n" \
91 "Format specifiers that start with a percent sign. Specifiers are: \n" \
92 "   %M : The current MRL\n" \
93 "   %m : The CD-DA Media Catalog Number (MCN)\n" \
94 "   %n : The number of tracks on the CD\n" \
95 "   %T : The track number\n" \
96 "   %s : Number of seconds in this track \n" \
97 "   %% : a % \n")
98
99 /*****************************************************************************
100  * Module descriptor
101  *****************************************************************************/
102
103 vlc_module_begin();
104     add_usage_hint( N_("cddax://[device-or-file][@[T]track]") );
105     set_description( _("Compact Disc Digital Audio (CD-DA) input") );
106     set_capability( "access2", 10 /* slightly higher than cdda */ );
107     set_callbacks( E_(CDDAOpen), E_(CDDAClose) );
108     add_shortcut( "cddax" );
109     add_shortcut( "cd" );
110
111     /* Configuration options */
112     add_integer ( MODULE_STRING "-debug", 0, E_(CDDADebugCB),
113                   N_("If nonzero, this gives additional debug information."),
114                   DEBUG_LONGTEXT, VLC_TRUE );
115
116     add_integer( MODULE_STRING "-caching",
117                  DEFAULT_PTS_DELAY / 1000, NULL,
118                  N_("Caching value in microseconds"),
119                  CACHING_LONGTEXT, VLC_TRUE );
120
121     add_string( MODULE_STRING "-author-format",
122                 "%A - %a %C %I", NULL,
123                 N_("Format to use in playlist \"author\" field"),
124                 TITLE_FMT_LONGTEXT, VLC_TRUE );
125
126     add_string( MODULE_STRING "-title-format",
127                 "%T %M", NULL,
128                 N_("Format to use in playlist \"title\" field when no CDDB"),
129                 TITLE_FMT_LONGTEXT, VLC_TRUE );
130
131 #ifdef HAVE_LIBCDDB
132     add_string( MODULE_STRING "-cddb-title-format",
133                 "Track %T. %t - %p", NULL,
134                 N_("Format to use in playlist \"title\" field when using CDDB"),
135                 CDDB_TITLE_FMT_LONGTEXT, VLC_TRUE );
136
137     add_bool( MODULE_STRING "-cddb-enabled", 1, E_(CDDBEnabledCB),
138               N_("Do CDDB lookups?"),
139               N_("If set, lookup CD-DA track information using the CDDB "
140                  "protocol"),
141               VLC_FALSE );
142
143     add_string( MODULE_STRING "-cddb-server", "freedb.freedb.org", NULL,
144                 N_("CDDB server"),
145                 N_( "Contact this CDDB server look up CD-DA information"),
146                  VLC_TRUE );
147
148     add_integer( MODULE_STRING "-cddb-port", 8880, NULL,
149                  N_("CDDB server port"),
150                  N_("CDDB server uses this port number to communicate on"),
151                  VLC_TRUE );
152
153     add_string( MODULE_STRING "-cddb-email", "me@home", NULL,
154                 N_("email address reported to CDDB server"),
155                 N_("email address reported to CDDB server"),
156                  VLC_TRUE );
157
158     add_bool( MODULE_STRING "-cddb-enable-cache", 1, NULL,
159               N_("Cache CDDB lookups?"),
160               N_("If set cache CDDB information about this CD"),
161               VLC_FALSE );
162
163     add_bool( MODULE_STRING "-cddb-httpd", 0, NULL,
164               N_("Contact CDDB via the HTTP protocol?"),
165               N_("If set, the CDDB server gets information via the CDDB HTTP "
166                  "protocol"),
167               VLC_TRUE );
168
169     add_integer( MODULE_STRING "-cddb-timeout", 10, NULL,
170                  N_("CDDB server timeout"),
171                  N_("Time (in seconds) to wait for a response from the "
172                     "CDDB server"),
173                  VLC_FALSE );
174
175     add_string( MODULE_STRING "-cddb-cachedir", "~/.cddbslave", NULL,
176                 N_("Directory to cache CDDB requests"),
177                 N_("Directory to cache CDDB requests"),
178                  VLC_TRUE );
179
180 #endif
181
182 vlc_module_end();