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