]> git.sesse.net Git - vlc/blob - doc/intf-cdda.txt
Go over for spelling and acurracy.
[vlc] / doc / intf-cdda.txt
1 This file documents the ``Extended'' VLC CD-DA Plugin
2
3 Copyright (C) 2003 Rocky Bernstein (rocky@panix.com)
4
5 Permission is granted to copy, distribute and/or modify this document
6 under the terms of the GNU Free Documentation License, Version 1.1 or
7 any later version published by the Free Software Foundation; with the
8 Invariant Sections being ``Free Software'' and ``Free Software Needs
9 Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
10 and with the Back-Cover Texts as in (a) below.
11
12 (a) The Free Software Foundation's Back-Cover Text is: ``You have
13 freedom to copy and modify this GNU Manual, like GNU software.  Copies
14 published by the Free Software Foundation raise funds for GNU
15 development.''
16
17 - - - - - -
18
19 Features over the older VLC CD-DA plugin
20
21 Internally I think this is much much cleaner. It uses the 
22 libcdio for disk reading and libcddb to get CDDB information.
23
24 MRL handling: 
25 -  Can specify device as well as track.
26 -  Because we use the libcdio library, the "device" can be a disk image
27    to be burned (e.g. a cdrdao bin/cue pair and some primitive Nero
28    support)
29
30 Features:
31 -  Can customize the what to show in the play-list title and author. 
32 -  Duration of each track is shown
33 -  Media information is shown using CDDB
34 -  Dynamic debugging
35 -  Will scan for a CD-ROM drive with a CD-DA loaded in it.
36
37 -----------------------------------------------------------------
38 General Info
39 -----------------------------------------------------------------
40
41 Much of what I write in this section can be found elsewhere. See for
42 example http://www.pctechguide.com/08cd-rom.htm, or the libcdio
43 documentation.
44
45 The Sony and Philips Corporations invented and Compact Disc (CD) in
46 the early 1980s. The specifications for the layout is often referred
47 to by the color of the cover on the specification. 
48
49 The first type of CD specification that was produced was the Compact
50 Disc Digital Audio (CD-DA) or just plain ``audio CD'' and is commonly
51 called the ``Red Book''. Music CD's are recorded in this format which
52 basically allows for around 74 minutes of audio per disc and for that
53 information to be split up into *tracks*. Tracks are broken up into
54 "sectors" and each sector contains 2,352 bytes. To play one 44.1 kHz
55 CD-DA sampled audio second, 75 sectors are used.
56
57 A CD can hold at most 99 such tracks. Between the tracks CD
58 specifications require a ``2 second'' in gap (called a @term{lead-in
59 gap}. This is unused space with no ``data'' similar to the space
60 between tracks on an old phonograph. The word ``second'' here really
61 refers to a measure of space and not really necessarily an amount of
62 time. However in the special case here where you have an audio CD, the
63 amount of time to play a gap of this size will take 2 seconds. Note
64 this is independent of how fast your CD drive can read a sector.
65
66 The beginning (or inner edge) of the CD is supposed to have a ``2
67 second'' lead-in gap and there is supposed to be another ``2 second''
68 *lead-out* gap at the end (or outer edge) of the CD.
69
70 CD-DA ``Red Book'' Specification
71
72 One can create and then write or "burn" a CD in the CD-DA format
73 and in this process sometimes one writes the bytes that will appear as
74 a file on a hard disk. This is called a "CD disk image". This
75 plugin may be able to play this file just the same as if it were
76 burned onto a CD.
77
78 As there are a number of CD-burning programs, there are a number of
79 CD-image formats. This plugin uses libcdio which currently understands
80 the BIN/CUE disk-image format used by a popular DOS/Window mastering
81 tool and a limited subset of the proprietary and unpublished form at
82 used by the Nero burning software. Over time however perhaps more
83 disk-image formats will be recognized.
84
85 Audio CD Identification Information (CDDB)
86
87 The Philips Red-Book specification allows for a Compact Disc to have a
88 Media Catalog Number or MCN written on it, and probably this
89 was how they CD's would be identified. Alas, very few audio discs
90 actually have a Medium Catalog Number on the box, and the way the code
91 is written on CD is *not* uniform across all discs!
92
93 However the listening community wanted a way to identify an audio CD,
94 so a database of CD information was gathered by basically making a
95 ``signature'' or hash from the number of tracks on a disk and a
96 checksum of the bytes of the tracks. This is referred to as CDDB
97 information. Using the hash the database gives information about the
98 titles of the tracks, the CD album name, year it was published and so
99 on. This plugin has the ability to show this information courtesy of
100 libcddb written by Kris Verbeeck.
101
102
103 -----------------------------------------------------------------
104 MRLS:
105 -----------------------------------------------------------------
106
107 the vlc CD-DA plugin, identifies itself in the vlc GUI as CDDAX. It
108 also registers itelf to handle a class of MRL's that start with
109 cddax://.
110
111 The CDDAX MRL takes the following form:
112
113   cddax://[path to file or CD-DA device][@[Tt]number]]
114
115 A simple cddax:// runs the default item: track 1 using the default CD
116 device (perhaps /dev/cdrom). The default default device is
117 user-configurable.
118
119 It is however also possible to specify both Compact Disc device/filename
120 and item explicitly in the MRL.
121
122 For example cddax://dev/cdrom2 specifies using device /dev/cdrom2 which
123 might useful if as I have /dev/cdrom is a burner and the /dev/cdrom2
124 is a read-only device. And cddax://test_cdda.cue specifies the
125 "cuesheet" file for a CD-DA image on disk created say with cdrdao.
126 (test_cdda.bin is the corresponding bin file, but using that won't
127 work.)
128
129 After the optional device name or file name, you can name the track
130 number unit which preceded by a @ or an @ and T in either case. A MRL
131 which ends in an @ is like not adding it at all.
132
133 Some examples of MRLS are given below. In the examples, we assume the
134 following configuration setting:
135
136 cdda.default_device:/dev/cdrom
137
138     cddax://                   - track 1 of device: /dev/cdrom
139     cddax://@                  - same as above
140     cddax:///dev/cdrom         - probably same as above
141     cddax:///dev/cdrom2        - track 1 of /dev/cdrom2
142     cddax:///dev/cdrom2@       - same as above
143     cddax://dev/cdrom2@53      - track 53 from /dev/cdrom2
144     cddax://dev/cdrom2@T53     - Same as above
145     cddax://dev/cdrom2@t53     - Same as above
146     cddax://@2                 - track 2 from default device
147     cddax://3                  - track 3 from default device
148     cddax:///tmp/ntsc.cue      - track 1 from /tmp/ntsc.bin, (a bin/cue
149                                  disk image)
150     cddax:///tmp/ntsc.cue@     - same as above
151     cddax://tmp/ntsc.cue@      - track 1 of tmp/ntsc.bin. NOT the
152                                  the same as above unless the cwd is /.
153     cddax://ntsc.nrg           - track 1 of ntsc.nrg (a nero disk image)
154     cddax://tmp/ntsc.nrg@5     - track 5 of /tmp/ntsc.nrg
155
156   Bad MRL's
157     cddax://@x                  - x is not a number
158     cddax/tmp                   - no colon
159     cddax:/                     - must start cddax://
160
161 -----------------------------------------------------------------
162 Configuration settings:
163 -----------------------------------------------------------------
164
165 Configuration settings in vlc are generally put in ~/.vlc/vlcrc. A
166 description of the ones specific to CDDAX are listed below.
167
168 - -
169 cddax-cddb-title-format
170
171 This gives a format used in the playlist title string when CDDB is consulted.
172 Similar to the Unix date command, there are format specifiers
173 that start with a percent sign for which various information is filled
174 in dynamically.  The control specifiers are given as below
175
176    %a : The album artist
177    %A : The album information
178    %C : Category
179    %I : CDDB disk ID
180    %G : Genre
181    %M : The current MRL
182    %m : The CD-DA Media Catalog Number (MCN)
183    %n : The number of tracks on the CD
184    %p : The artist/performer/composer in the track
185    %T : The track number
186    %s : Number of seconds in this track
187    %t : The name
188    %Y : The year 19xx or 20xx
189    %% : a %
190
191 The default is
192   Track %T. %t - %p 
193
194 - -
195 cddax-title-format
196
197 This gives a format used in the playlist title string when CDDB is
198 *NOT* consulted.  Similar to the Unix date command, there are format
199 specifiers that start with a percent sign for which various
200 information is filled in dynamically.  The control specifiers are
201 given as below
202
203    %M : The current MRL
204    %m : The CD-DA Media Catalog Number (MCN)
205    %n : The number of tracks on the CD
206    %T : The track number
207    %s : Number of seconds in this track
208    %% : a %
209
210 The default is 
211   %T %M 
212
213 - -
214 cddax-cddb-email
215
216 # email given on cddb requests
217 # string, default: me@home
218
219 - -
220 cddax-cddb-enabled
221
222 # Do we use CDDB to retrieve CD information?
223 # bool, default: 1
224
225 - -
226 cddax-cddb-http
227
228 # Contact CDDB via the HTTP protocol?
229 # bool, default: 0
230
231 - -
232 cddax-cddb-port
233
234 # numeric, default: 8880
235
236 - -
237 cddax-cddb-server
238
239 # The server CDDB contacts to get CD info
240 # string, default: freedb.freedb.org
241
242 - -
243 cddax-debug
244
245 An integer (interpreted as a bit mask) which shows additional
246 debugging information see the section below on debugging for more
247 information about the bits that can be set.
248
249 - - 
250 cddax-device
251
252 What to use if no drive specified. If null, we'll scan for CD
253 drives with a CD-DA loaded in it.
254
255 # string, default: 
256
257 -----------------------------------------------------------------
258 Troubleshooting Guide
259 -----------------------------------------------------------------
260
261 This gives higher-level troubleshooting. More detailed and
262 lower-level information is given in the next section DEBUGGING. 
263
264 Problem: I don't get anything playing. I can't even get a playlist of
265 the CD.
266 Determination: start at step 1.
267
268 Problem: Okay, I something plays menu now. But I don't see information
269 about the CD in the playlist.
270 Determination: start at step 5.
271
272 1. Do you even have the plugin loaded? 
273
274    When you run the vlc GUI, under Settings/Preferences you should see
275    a "plugins" expandable list and under that another "access" list do
276    you see a expandable entry under "access" labeled "cddax"? If so,
277    skip on to step 2.
278
279    a) If no "cddax" expandable list, then the CDDAX plugin isn't
280    loaded. Does a shared object exist?  The plugin shared object is
281    called "libcddax_plugin.so" It should be in the directory that has
282    ...vlc/access. If this isn't around you need to build and install
283    the CDDAX plugin.
284
285    b) if libcddax_plugin.so is in the filesystem, there might be a
286    loader error; perhaps libcdio is not installed or
287    are the wrong version. Use ldd on the file to see that it has all
288    of the libraries dependencies satisfied. Also you might be able
289    check if there was an attempt to load it by tracking system
290    calls. On Linux and other OS's) "strace" can be used to see if the
291    file gets accessed. On Solaris use "truss". 
292
293    For example on Linux, among the many line of output when I run
294    "strace -e trace=file vlc" I see this along with a lot of other
295    output:
296
297    ...
298    stat64("/usr/local/lib/vlc/access/libcddax_plugin.so", {st_mode=S_IFREG|0755, st_size=238921, ...}) = 0
299    open("/usr/local/lib/vlc/access/libcddax_plugin.so", O_RDONLY) = 5
300
301    The parameters inside the calls may be different depending on where
302    vlc is installed and what release is installed. If the the file is
303    found and "opened", 
304   
305    There may also be a message may under "setup/logs".
306
307 2. (There plugin was loaded and preferences found).  In the "cddax" tab
308    of preference. An important selection is "cddax-device."  If this is
309    set to the empty string, CDDAX will try to scan your drives for a
310    suitable device if the driver has the capability to scan for
311    drives. However you can set the device to something of your
312    choosing. On GNU/Linux, this may be "/dev/cdrom" and on Solaris it
313    may be "/vol/dev/aliases/cdrom0".  If you set this field, make sure
314    these are correct for your particular setup. For example, I
315    generally play out of the DVD device and this is called /dev/dvd
316    rather than /dev/cdrom.
317
318 3. (CD-DA Setup devices seems correct and there is a CD in the
319    drive).  Bring up the playlist. If you specified only a drive and
320    no track, you should see in the playlist a list of tracks on the CD.
321    
322    a. If not something's wrong like step 2. Another tack may be to try
323    to read a disk image of a CD and thus eliminate any problems with
324    hardware. If this works, then this is a hardware problem. 
325
326 4. (You have a list of entries describing the CD-DA or disk-file of
327    a CD-DA image.)
328
329    There should be at least one "track" listed for the CD-DA and track
330    1 will end with the digit 1.  If there are NO tracks listed then
331    there may be a problem with the that particular medium. So as in
332    step 3 you can try a known good sample and perhaps burn a CD from
333    that. 
334
335 5. <<Fill in info about CDDB hacking>>
336
337 -----------------------------------------------------------------
338 Debugging
339 -----------------------------------------------------------------
340
341 **General vlc debugging...
342
343 Before delving to things specific to this plugin, some preparation may
344 be in order. You'll probably want to configure vlc with "--enable-debug".
345 plugin with debug information. Instead of "make'ing" with "make", use
346 "make debug" and instead of installing using "make install" use "make
347 install-debug". 
348
349 I use gdb to debug. Debugging vlc with the entire suite of plugins
350 under gdb is slow because it has to read in symbol tables from all the
351 plugins. There are two ways to make loading faster when debugging. The
352 simplest is just to go to the plugin directory and remove unused
353 plugins. Another approach is create a new directory and make
354 (symbolic) links into the complete plugin directory. Another way to
355 speed up gdb loading is to attach the debugger after vlc has started up
356 via a command like:
357
358   gdb -p *pid-of-vlc-process*
359
360 **cddax debugging...
361
362 It's a fact of life that this plugin may be in an incomplete state
363 and/or will have bugs. So to facilitate tracking down problems we let
364 you see what's going on dynamically. Various debugging settings will
365 cause output to appear on vlc's plugin log and/or "standard error"
366 (assuming you've run vlc in a way that you can capture this).
367
368 You think of debug switches as a bit mask, that you specify as an
369 integers the various "bit" values (given in decimal) are listed below.
370
371    name    value  description
372 ---------- -----  -----------
373    META        1  Meta information
374    EVENT       2  Trace keyboard events
375    MRL         4  MRL debugging
376    EXT         8  Calls from external routines
377    CALL       16  all calls
378    LSN        32  LSN changes
379    SEEK       64  Seeks to set location
380    CDIO      128  Debugging from CDIO library routines
381    CDDB      256  debugging from CDDB library routines
382
383 **CD debugging...
384
385 The tool cd-info from libcdio can be used to show the contents and
386 analyze the contents of a CD.
387
388 The tool cd-read from libcdio can be used to show the sectors of 
389 the CD or CD image or extract sectors. 
390
391 $Id: intf-cdda.txt,v 1.4 2003/12/18 12:35:26 rocky Exp $