]> git.sesse.net Git - vlc/blob - doc/intf-cdda.txt
Separate title format string into cases where CDDB is enabled and where
[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-cddb-title-format
169
170 This gives a format used in the playlist title string when CDDB is consulted.
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 The default is
191   Track %T. %t - %p 
192
193 - -
194 cddax-title-format
195
196 This gives a format used in the playlist title string when CDDB is
197 *NOT* consulted.  Similar to the Unix date command, there are format
198 specifiers that start with a percent sign for which various
199 information is filled in dynamically.  The control specifiers are
200 given as below
201
202    %M : The current MRL
203    %m : The CD-DA Media Catalog Number (MCN)
204    %n : The number of tracks on the CD
205    %T : The track number
206    %s : Number of seconds in this track
207    %% : a %
208
209 The default is 
210   %T %M 
211
212 - -
213 cddax-cddb-email
214
215 # email given on cddb requests
216 # string, default: me@home
217
218 - -
219 cddax-cddb-enabled
220
221 # Do we use CDDB to retrieve CD information?
222 # bool, default: 1
223
224 - -
225 cddax-cddb-http
226
227 # Contact CDDB via the HTTP protocol?
228 # bool, default: 0
229
230 - -
231 cddax-cddb-port
232
233 # numeric, default: 8880
234
235 - -
236 cddax-cddb-server
237
238 # The server CDDB contacts to get CD info
239 # string, default: freedb.freedb.org
240
241 - -
242 cddax-debug
243
244 An integer (interpreted as a bit mask) which shows additional
245 debugging information see the section below on debugging for more
246 information about the bits that can be set.
247
248 - - 
249 cddax-device
250
251 What to use if no drive specified. If null, we'll scan for CD
252 drives with a CD-DA loaded in it.
253
254 # string, default: 
255
256 -----------------------------------------------------------------
257 Troubleshooting Guide
258 -----------------------------------------------------------------
259
260 This gives higher-level troubleshooting. More detailed and
261 lower-level information is given in the next section DEBUGGING. 
262
263 Problem: I don't get anything playing. I can't even get a playlist of
264 the CD.
265 Determination: start at step 1.
266
267 Problem: Okay, I something plays menu now. But I don't see information
268 about the CD in the playlist.
269 Determination: start at step 5.
270
271 1. Do you even have the plugin loaded? 
272
273    When you run the vlc GUI, under Settings/Preferences you should see
274    a "plugins" expandable list and under that another "access" list do
275    you see a expandalbe entry under "access" labeled "cddax"? If so,
276    skip on to step 2.
277
278    a) If no "cddax" expandable list, thent the CDDAX plugin isn't
279    loaded. Does a shared object exist?  The plugin shared object is
280    called "libcddax_plugin.so" It should be in the directory that has
281    ...vlc/access. If this isn't around you need to build and install
282    the CDDAX plugin.
283
284    b) if libcddax_plugin.so is in the fileystem, there might be a
285    loader error; perhaps libcdio is not installed or
286    are the wrong version. Use ldd on the file to see that it has all
287    of the libraries dependencies satisfied. Also you might be able
288    check if there was an attempt to load it by tracking system
289    calls. On Linux and other OS's) "strace" can be used to see if the
290    file gets accessed. On Solaris use "truss". 
291
292    For example on Linux, amonst the many line of output when I run
293    "strace -e trace=file vlc" I see this amongst lots of other
294    output:
295
296    ...
297    stat64("/usr/local/lib/vlc/access/libcddax_plugin.so", {st_mode=S_IFREG|0755, st_size=238921, ...}) = 0
298    open("/usr/local/lib/vlc/access/libcddax_plugin.so", O_RDONLY) = 5
299
300    The parameters inside the calls may be different depending on where
301    vlc is installed and what release is installed. If the the file is
302    found and "opened", 
303   
304    There may also be a message may under "setup/logs".
305
306 2. (There plugin was loaded and preferences found).  In the "cddax" tab
307    of preference. An important selection is "cddax-device."  If this is
308    set to the empty string, CDDAX will try to scan your drives for a
309    suitable device if the driver has the capability to scan for
310    drives. However you can set the device to something of your
311    choosing. On GNU/Linux, this may be "/dev/cdrom" and on Solaris it
312    may be "/vol/dev/aliases/cdrom0".  If you set this field, make sure
313    these are correct for your particular setup. For example, I
314    generally play out of the DVD device and this is called /dev/dvd
315    rather than /dev/cdrom.
316
317 3. (CD-DA Setup devices seems correct and there is a CD in the
318    drive).  Bring up the playlist. If you specified only a drive and
319    no track, you should see in the playlist a list of tracks on the CD.
320    
321    a. If not something's wrong like step 2. Another tack may be to try
322    to read a disk image of a CD and thus elimate any problems with
323    hardware. If this works, then this is a hardware problem. 
324
325 4. (You have a list of entries describing the CD-DA or disk-file of
326    a CD-DA image.)
327
328    There should be at least one "track" listed for the CD-DA and track
329    1 will end with the digit 1.  If there are NO tracks listed then
330    there may be a problem with the that particular medium. So as in
331    step 3 you can try a known good sample and perhaps burn a CD from
332    that. 
333
334 5. <<Fill in info about CDDB hacking>>
335
336 -----------------------------------------------------------------
337 Debugging
338 -----------------------------------------------------------------
339
340 **General vlc debugging...
341
342 Before delving to things specific to this plugin, some preparation may
343 be in order. You'll probably want to configure vlc with "--enable-debug".
344 plugin with debug information. Instead of "make'ing" with "make", use
345 "make debug" and instead of installing using "make install" use "make
346 install-debug". 
347
348 I use gdb to debug. Debugging vlc with the entire suite of plugins
349 under gdb is slow because it has to read in symbol tables from all the
350 plugins. There are two ways to make loading faster when debugging. The
351 simplest is just to go to the plugin directory and remove unused
352 plugins. Another approach is create a new directory and make
353 (symbolic) links into the complete plugin directory. Another way to
354 speed up gdb loading is to attach the debugger after vlc has started up
355 via a command like:
356
357   gdb -p *pid-of-vlc-process*
358
359 **cddax debugging...
360
361 It's a fact of life that this plugin may be in an incomplete state
362 and/or will have bugs. So to facilitate tracking down problems we let
363 you see what's going on dynamically. Various debugging settings will
364 cause output to appear on vlc's plugin log and/or "standard error"
365 (assuming you've run vlc in a way that you can capture this).
366
367 You think of debug switches as a bit mask, that you specifiy as an
368 integers the various "bit" values (given in decimal) are listed below.
369
370    name    value  description
371 ---------- -----  -----------
372    META        1  Meta information
373    EVENT       2  Trace keyboard events
374    MRL         4  MRL debugging
375    EXT         8  Calls from external routines
376    CALL       16  all calls
377    LSN        32  LSN changes
378    SEEK       64  Seeks to set location
379    CDIO      128  Debugging from CDIO
380    CDDB      256  CDDB debugging
381
382 **CD debugging...
383
384 The tool cd-info from libcdio can be used to show the contents and
385 analyze the contents of a CD.
386
387 The tool cd-read from libcdio can be used to show the sectors of 
388 the CD or CD image or extract sectors. 
389
390 $Id: intf-cdda.txt,v 1.3 2003/12/02 03:33:22 rocky Exp $