libcdio: Previous Work

1 
1 2 The problem and previous work
1 *******************************
1 
1 If around the year 2002 you were to look at the code for a number of
1 free software CD or media players that work on several platforms such as
1 vlc, MPlayer, xine, or xmms to name but a few, you'd find the code to
1 read a CD sprinkled with conditional compilation for this or that
1 platform.  That is there was _no_ OS-independent programmer library for
1 CD reading and control even though the technology was over 10 years old;
1 yet there are media players which strive for OS independence.
1 
1 One early CD player, 'xmcd' by Ti Kan, was I think a bit better than
1 most in that it tried to _encapsulate_ the kinds of CD control
1 mechanisms, e.g.\ SCSI, Linux ioctl, Toshiba, in a "CD Audio Device
1 Interface Library" called 'libdi'.  However this library is for Audio
1 CD's only and I don't believe this library has been used outside of
1 xmcd.
1 
1 Another project, Simple DirectMedia Layer also encapsulates CD reading.
1 
1      SDL is a library that allows you portable low-level access to a
1      video framebuffer, audio output, mouse, and keyboard.  With SDL, it
1      is easy to write portable games which run on ...
1 
1 Many of the media players mentioned above do in fact can make use of the
1 SDL library but for _video_ output only.  Because the encapsulation is
1 over _many_ kinds of I/O (video, joysticks, mice, as well as CD's), I
1 believe that the level of control provided for CD a little bit limited.
1 (However to be fair, it may have only been intended for games and may be
1 suitable for that).  Applications that just want the CD reading and
1 control portion I think will find quite a bit overhead.
1 
1 Another related project is Jo"rg Schilling's SCSI library.  You can use
1 that to make a non-SCSI CD-ROM act like one that understands SCSI MMC
1 commands which is a neat thing to do.  However it is a little weird to
1 have to install drivers just so you can run a particular user-level
1 program.  Installing drivers often requires special privileges and
1 permissions and it is pervasive on a system.  It is a little sad that
1 along the way to creating such a SCSI library a library similar to
1 'libcdio' wasn't created which could be used.  Were that the case, this
1 library certainly never would have been written.
1 
1 At the OS level there is the "A Linux CD-ROM Standard" by David van
1 Leeuwen from around 1999.  This defines a set of definitions and ioctl's
1 that mask hardware differences of various Compact Disc hardware.  It is
1 a great idea, however this "standard" lacked adoption on OS's other than
1 GNU/Linux.  Or maybe it's the case that the standard on other OS's
1 lacked adoption on GNU/Linux.  For example on FreeBSD there is a "Common
1 Access Method" (CAM) used for all SCSI access which seems not to be
1 adopted in GNU/Linux.(1)
1 
1 Finally at the hardware level where a similar chaos exists, there has
1 been an attempt to do something similar with the MMC (multimedia
1 commands).  This attempts to provide a uniform command set for CD
1 devices like PostScript does for printer commands.(2)  In contrast to
1 PostScript where there one in theory can write a PostScript program in a
1 uniform ASCII representation and send that to a printer, for MMC
1 although there are common internal structures defined, there is no
1 common syntax for representing the structures or an OS-independent
1 library or API for issuing MMC-commands which a programmer would need to
1 use.  Instead each Operating System has its own interface.  For example
1 Adaptec's ASPI or Microsoft's DeviceIoControl on Microsoft Windows, or
1 IOKit for Apple's OS/X, or FreeBSD's CAM. I've been positively awed at
1 how many different variations and differing levels of complexity there
1 are for doing basically the same thing.  How easy it is to issue an MMC
1 command from a program varies from easy to very difficult.  And
1 mastering the boilerplate code to issue an MMC command on one OS really
1 doesn't help much in figuring out how to do it on another OS. So in
1 'libcdio' we provide a common (and hopefully simple) API to issue MMC
1 commands.
1 
1    ---------- Footnotes ----------
1 
1    (1) And I'm thankful for that since, at least for MMC commands, it is
1 inordinately complicated and in some places arcane.
1 
1    (2) I wrote "attempts" because over time the command set has changed
1 and now there are several different commands to do a particular function
1 like read a CD table of contents and some hardware understands some of
1 the version of the commands set but might not others
1