20.3 cd -- CD-ROM access on SGI systems

Python 2.4

20.3 cd -- CD-ROM access on SGI systems

Availability: IRIX.

This module provides an interface to the Silicon Graphics CD library. It is available only on Silicon Graphics systems.

The way the library works is as follows. A program opens the CD-ROM device with open() and creates a parser to parse the data from the CD with createparser(). The object returned by open() can be used to read data from the CD, but also to get status information for the CD-ROM device, and to get information about the CD, such as the table of contents. Data from the CD is passed to the parser, which parses the frames, and calls any callback functions that have previously been added.

An audio CD is divided into tracks or programs (the terms are used interchangeably). Tracks can be subdivided into indices. An audio CD contains a table of contents which gives the starts of the tracks on the CD. Index 0 is usually the pause before the start of a track. The start of the track as given by the table of contents is normally the start of index 1.

Positions on a CD can be represented in two ways. Either a frame number or a tuple of three values, minutes, seconds and frames. Most functions use the latter representation. Positions can be both relative to the beginning of the CD, and to the beginning of the track.

Module cd defines the following functions and constants:

Create and return an opaque parser object. The methods of the parser object are described below.

Converts a (minutes, seconds, frames) triple representing time in absolute time code into the corresponding CD frame number.

Open the CD-ROM device. The return value is an opaque player object; methods of the player object are described below. The device is the name of the SCSI device file, e.g. '/dev/scsi/sc0d4l0', or None. If omitted or None, the hardware inventory is consulted to locate a CD-ROM drive. The mode, if not omitted, should be the string 'r'.

The module defines the following variables:

Exception raised on various errors.

The size of one frame's worth of audio data. This is the size of the audio data as passed to the callback of type audio.

The size of one uninterpreted frame of audio data.

The following variables are states as returned by getstatus():

The drive is ready for operation loaded with an audio CD.

The drive does not have a CD loaded.

The drive is loaded with a CD-ROM. Subsequent play or read operations will return I/O errors.

An error occurred while trying to read the disc or its table of contents.

The drive is in CD player mode playing an audio CD through its audio jacks.

The drive is in CD layer mode with play paused.

The equivalent of PAUSED on older (non 3301) model Toshiba CD-ROM drives. Such drives have never been shipped by SGI.

Integer constants describing the various types of parser callbacks that can be set by the addcallback() method of CD parser objects (see below).


See About this document... for information on suggesting changes.