View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Tassilo von Parseval > Linux-CDROM-0.02 > Linux::CDROM



Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  


Linux::CDROM cookbook - common recipes featuring your CDROM drive as its main ingredient


There's a gazillion ways of reading the disc inside your CDROM drive. The most high-level ones would be mounting your CD and using it as a normal directory or - in case of an Audio-CD - using a player to play tracks. This is boring stuff and you don't need Linux::CDROM for any of that.

But when you want to write your own CD-player or -grabber, this is more like it. You can even get at a lower level than that.


Linux::CDROM offers a couple of methods dealing with that. For starting playback, you will use either Linux::CDROM::play_ti (ti == track index) or Linux::CDROM::play_msf (msf == minute, second and frame).

All playing operations happen non-blockingly. That means, you start playback and your program does not wait till the playback is done. Instead if will proceed with the next line.


Grabbing audio data happens through Linux::CDROM::read_audio. It returns a string of CD_FRAMESIZE_RAW bytes. These data are simply PCM-encoded samples as you find them in WAV files.

However, simply dumping these data to a file wont give you a playable WAV file. The file is lacking an appropriate WAV header that would tell your player how to interpret the PCM-data (as for number of channels, bitrate, sampling-frequency). Linux::CDROM contains the static method Linux::CDROM::Format->wav_header to write a header suitable for these PCM data.


The most common scenario is making an ISO-image from a CD. The first thing to understand is that one iso-image doesn't necessarily represent the whole CD. An ISO-image represent always one session on a CD so that only a single-session data CD fits into one image. If you have a multisession CD, you'd create an image for each session.


Linux::CDROM offers a fairly generous subset of what your kernel permits. There are however a few things not (yet) implemented. For instance, DVD-handling and some of the more obscure things.


Device::CDROM for a reference to all methods and classes.


Tassilo von Parseval, <>


Copyright (C) 2004 by Tassilo von Parseval

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: