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