cdda.c 7.05 KB
Newer Older
gbazin's avatar
   
gbazin committed
1
2
3
/*****************************************************************************
 * cddax.c : CD digital audio input module for vlc using libcdio
 *****************************************************************************
4
 * Copyright (C) 2000,2003 VideoLAN
Rocky Bernstein's avatar
Rocky Bernstein committed
5
 * $Id: cdda.c,v 1.14 2003/12/20 11:56:56 rocky Exp $
gbazin's avatar
   
gbazin committed
6
 *
7
8
 * Authors: Rocky Bernstein <rocky@panix.com> 
 *          Laurent Aimar <fenrir@via.ecp.fr>
gbazin's avatar
   
gbazin committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 *          Gildas Bazin <gbazin@netcourrier.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/

#include <vlc/vlc.h>


33
34
35
36
37
/*****************************************************************************
 * prototypes
 *****************************************************************************/
int  E_(Open)         ( vlc_object_t * );
void E_(Close)        ( vlc_object_t * );
gbazin's avatar
   
gbazin committed
38

39
40
41
42
int  E_(OpenIntf)     ( vlc_object_t * );
void E_(CloseIntf)    ( vlc_object_t * );
int  E_(DemuxOpen)    ( vlc_object_t * p_this);
void E_(DemuxClose)   ( vlc_object_t * p_this);
gbazin's avatar
   
gbazin committed
43

44
45
46
47
48
49
50
int  E_(DebugCB)      ( vlc_object_t *p_this, const char *psz_name,
			vlc_value_t oldval, vlc_value_t val, 
			void *p_data );

int  E_(CDDBEnabledCB)( vlc_object_t *p_this, const char *psz_name,
			vlc_value_t oldval, vlc_value_t val, 
			void *p_data );
gbazin's avatar
   
gbazin committed
51
52

/*****************************************************************************
53
 * Module descriptor
gbazin's avatar
   
gbazin committed
54
55
 *****************************************************************************/

56
/*****************************************************************************
57
 * Option help text
58
59
60
61
 *****************************************************************************/

#define DEBUG_LONGTEXT N_( \
    "This integer when viewed in binary is a debugging mask\n" \
62
63
64
65
66
67
68
69
70
71
    "meta info        1\n" \
    "events           2\n" \
    "MRL              4\n" \
    "external call    8\n" \
    "all calls (10)  16\n" \
    "LSN       (20)  32\n" \
    "seek      (40)  64\n" \
    "libcdio   (80) 128\n" \
    "libcddb  (100) 256\n" )

72
#define CACHING_LONGTEXT N_( \
73
    "Allows you to modify the default caching value for CDDA streams. This " \
74
    "value should be set in millisecond units." )
75

76
#define CDDB_TITLE_FMT_LONGTEXT N_( \
Rocky Bernstein's avatar
Rocky Bernstein committed
77
78
"Format used in the GUI Playlist Title. Similar to the Unix date \n" \
"Format specifiers that start with a percent sign. Specifiers are: \n" \
79
80
81
"   %a : The artist\n" \
"   %A : The album information\n" \
"   %C : Category\n" \
Rocky Bernstein's avatar
Rocky Bernstein committed
82
"   %I : CDDB disk ID\n" \
83
"   %G : Genre\n" \
Rocky Bernstein's avatar
Rocky Bernstein committed
84
85
"   %M : The current MRL\n" \
"   %m : The CD-DA Media Catalog Number (MCN)\n" \
86
"   %n : The number of tracks on the CD\n" \
87
"   %p : The artist/performer/composer in the track\n" \
Rocky Bernstein's avatar
Rocky Bernstein committed
88
"   %T : The track number\n" \
89
"   %s : Number of seconds in this track \n" \
90
91
92
"   %t : The title\n" \
"   %Y : The year 19xx or 20xx\n" \
"   %% : a % \n")
Rocky Bernstein's avatar
Rocky Bernstein committed
93

94
95
96
97
98
99
100
101
102
#define TITLE_FMT_LONGTEXT N_( \
"Format used in the GUI Playlist Title. Similar to the Unix date \n" \
"Format specifiers that start with a percent sign. Specifiers are: \n" \
"   %M : The current MRL\n" \
"   %m : The CD-DA Media Catalog Number (MCN)\n" \
"   %n : The number of tracks on the CD\n" \
"   %T : The track number\n" \
"   %s : Number of seconds in this track \n" \
"   %% : a % \n")
Rocky Bernstein's avatar
Rocky Bernstein committed
103

gbazin's avatar
   
gbazin committed
104
/*****************************************************************************
105
 * Module descriptor
gbazin's avatar
   
gbazin committed
106
 *****************************************************************************/
107

gbazin's avatar
   
gbazin committed
108
vlc_module_begin();
109
    add_usage_hint( N_("cddax://[device-or-file][@[T]num]") );
110
    set_description( _("Compact Disc Digital Audio (CD-DA) input") );
gbazin's avatar
   
gbazin committed
111
    set_capability( "access", 75 /* slightly higher than cdda */ );
112
    set_callbacks( E_(Open), E_(Close) );
gbazin's avatar
   
gbazin committed
113
    add_shortcut( "cdda" );
114
    add_shortcut( "cddax" );
gbazin's avatar
   
gbazin committed
115

116
117
    /* Configuration options */
    add_category_hint( N_("CDX"), NULL, VLC_TRUE );
118

119
    add_integer ( MODULE_STRING "-debug", 0, E_(DebugCB), 
120
		  N_("set debug mask for additional debugging."),
121
                  DEBUG_LONGTEXT, VLC_TRUE );
122
123
124

    add_integer( MODULE_STRING "-caching", 
		 DEFAULT_PTS_DELAY / 1000, NULL, 
125
126
127
		 N_("Caching value in ms"), 
		 CACHING_LONGTEXT, VLC_TRUE );

128
129
130
131
132
    add_string( MODULE_STRING "-author-format", 
		"%A - %a %C %I", NULL, 
		N_("Format to use in playlist 'author' field"),
                TITLE_FMT_LONGTEXT, VLC_TRUE );

133
134
135
    add_string( MODULE_STRING "-title-format", 
		"%T %M", NULL, 
		N_("Format to use in playlist 'title' field when no CDDB"),
Rocky Bernstein's avatar
Rocky Bernstein committed
136
137
                TITLE_FMT_LONGTEXT, VLC_TRUE );

138
#ifdef HAVE_LIBCDDB
139
140
141
142
143
144
    add_string( MODULE_STRING "-cddb-title-format", 
		"Track %T. %t - %p", NULL, 
		N_("Format to use in playlist 'title' field when using CDDB"),
                CDDB_TITLE_FMT_LONGTEXT, VLC_TRUE );

    add_bool( MODULE_STRING "-cddb-enabled", 1, E_(CDDBEnabledCB),
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	      N_("Do CDDB lookups?"),
	      N_("If set, lookup CD-DA track information using the CDDB "
		 "protocol"),
	      VLC_FALSE );

    add_string( MODULE_STRING "-cddb-server", "freedb.freedb.org", NULL, 
		N_("CDDB server"), 
		N_( "Contact this CDDB server look up CD-DA information"),
		 VLC_TRUE );

    add_integer( MODULE_STRING "-cddb-port", 8880, NULL, 
		 N_("CDDB server port"), 
		 N_("CDDB server uses this port number to communicate on"), 
		 VLC_TRUE );

    add_string( MODULE_STRING "-cddb-email", "me@home", NULL, 
		N_("email address reported to CDDB server"), 
		N_("email address reported to CDDB server"), 
		 VLC_TRUE );

    add_bool( MODULE_STRING "-cddb-enable-cache", 1, NULL,
	      N_("Cache CDDB lookups?"),
	      N_("If set cache CDDB information about this CD"),
	      VLC_FALSE );

    add_bool( MODULE_STRING "-cddb-httpd", 0, NULL,
	      N_("Contact CDDB via the HTTP protocol?"),
Rocky Bernstein's avatar
Rocky Bernstein committed
172
	      N_("If set, the CDDB server gets information via the CDDB HTTP "
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
		 "protocol"),
	      VLC_TRUE );

    add_integer( MODULE_STRING "-cddb-timeout", 10, NULL, 
		 N_("CDDB server timeout"), 
		 N_("Time (in seconds) to wait for a response from the "
		    "CDDB server"), 
		 VLC_FALSE );

    add_string( MODULE_STRING "-cddb-cachedir", "~/.cddbslave", NULL, 
		N_("Directory to cache CDDB requests"), 
		N_("Directory to cache CDDB requests"), 
		 VLC_TRUE );

#endif
188

gbazin's avatar
   
gbazin committed
189
190
191
    add_submodule();
        set_description( _("CD Audio demux") );
        set_capability( "demux", 0 );
192
        set_callbacks( E_(DemuxOpen), E_(DemuxClose) );
gbazin's avatar
   
gbazin committed
193
        add_shortcut( "cdda" );
194

gbazin's avatar
   
gbazin committed
195
vlc_module_end();