<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <link rel="STYLESHEET" href="lib.css" type='text/css' /> <link rel="SHORTCUT ICON" href="../icons/pyfav.gif" /> <link rel='start' href='../index.html' title='Python Documentation Index' /> <link rel="first" href="lib.html" title='Python Library Reference' /> <link rel='contents' href='contents.html' title="Contents" /> <link rel='index' href='genindex.html' title='Index' /> <link rel='last' href='about.html' title='About this document...' /> <link rel='help' href='about.html' title='About this document...' /> <LINK rel="next" href="module-fl.html"> <LINK rel="prev" href="module-al-constants.html"> <LINK rel="parent" href="sgi.html"> <LINK rel="next" href="player-objects.html"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name='aesop' content='information' /> <META name="description" content="cd -- CD-ROM access on SGI systems"> <META name="keywords" content="lib"> <META name="resource-type" content="document"> <META name="distribution" content="global"> <title>20.3 cd -- CD-ROM access on SGI systems</title> </head> <body> <DIV CLASS="navigation"> <div id='top-navigation-panel'> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <td class='online-navigation'><a rel="prev" title="20.2 AL " href="module-al-constants.html"><img src='../icons/previous.png' border='0' height='32' alt='Previous Page' width='32' /></A></td> <td class='online-navigation'><a rel="parent" title="20. SGI IRIX Specific" href="sgi.html"><img src='../icons/up.png' border='0' height='32' alt='Up One Level' width='32' /></A></td> <td class='online-navigation'><a rel="next" title="20.3.1 Player Objects" href="player-objects.html"><img src='../icons/next.png' border='0' height='32' alt='Next Page' width='32' /></A></td> <td align="center" width="100%">Python Library Reference</td> <td class='online-navigation'><a rel="contents" title="Table of Contents" href="contents.html"><img src='../icons/contents.png' border='0' height='32' alt='Contents' width='32' /></A></td> <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' border='0' height='32' alt='Module Index' width='32' /></a></td> <td class='online-navigation'><a rel="index" title="Index" href="genindex.html"><img src='../icons/index.png' border='0' height='32' alt='Index' width='32' /></A></td> </tr></table> <div class='online-navigation'> <b class="navlabel">Previous:</b> <a class="sectref" rel="prev" href="module-al-constants.html">20.2 AL </A> <b class="navlabel">Up:</b> <a class="sectref" rel="parent" href="sgi.html">20. SGI IRIX Specific</A> <b class="navlabel">Next:</b> <a class="sectref" rel="next" href="player-objects.html">20.3.1 Player Objects</A> </div> <hr /></div> </DIV> <!--End of Navigation Panel--> <H1><A NAME="SECTION0022300000000000000000"> 20.3 <tt class="module">cd</tt> -- CD-ROM access on SGI systems</A> </H1> <P> <A NAME="module-cd"><!--z--></A> <p class="availability">Availability: <span class="platform">IRIX</span>.</p> <P> This module provides an interface to the Silicon Graphics CD library. It is available only on Silicon Graphics systems. <P> The way the library works is as follows. A program opens the CD-ROM device with <tt class="function">open()</tt> and creates a parser to parse the data from the CD with <tt class="function">createparser()</tt>. The object returned by <tt class="function">open()</tt> 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. <P> An audio CD is divided into <i class="dfn">tracks</i> or <i class="dfn">programs</i> (the terms are used interchangeably). Tracks can be subdivided into <i class="dfn">indices</i>. An audio CD contains a <i class="dfn">table of contents</i> 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. <P> 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. <P> Module <tt class="module">cd</tt> defines the following functions and constants: <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4776' class="function">createparser</tt></b>(</nobr></td> <td>)</td></tr></table></dt> <dd> Create and return an opaque parser object. The methods of the parser object are described below. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4777' class="function">msftoframe</tt></b>(</nobr></td> <td><var>minutes, seconds, frames</var>)</td></tr></table></dt> <dd> Converts a <code>(<var>minutes</var>, <var>seconds</var>, <var>frames</var>)</code> triple representing time in absolute time code into the corresponding CD frame number. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4778' class="function">open</tt></b>(</nobr></td> <td><big>[</big><var>device</var><big>[</big><var>, mode</var><big>]</big><big>]</big>)</td></tr></table></dt> <dd> 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. <code>'/dev/scsi/sc0d4l0'</code>, or <code>None</code>. If omitted or <code>None</code>, the hardware inventory is consulted to locate a CD-ROM drive. The <var>mode</var>, if not omited, should be the string <code>'r'</code>. </dl> <P> The module defines the following variables: <P> <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-4779' class="exception">error</tt></b></dt> <dd> Exception raised on various errors. </dd></dl> <P> <dl><dt><b><tt id='l2h-4780'>DATASIZE</tt></b></dt> <dd> 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 <code>audio</code>. </dd></dl> <P> <dl><dt><b><tt id='l2h-4781'>BLOCKSIZE</tt></b></dt> <dd> The size of one uninterpreted frame of audio data. </dd></dl> <P> The following variables are states as returned by <tt class="function">getstatus()</tt>: <P> <dl><dt><b><tt id='l2h-4782'>READY</tt></b></dt> <dd> The drive is ready for operation loaded with an audio CD. </dd></dl> <P> <dl><dt><b><tt id='l2h-4783'>NODISC</tt></b></dt> <dd> The drive does not have a CD loaded. </dd></dl> <P> <dl><dt><b><tt id='l2h-4784'>CDROM</tt></b></dt> <dd> The drive is loaded with a CD-ROM. Subsequent play or read operations will return I/O errors. </dd></dl> <P> <dl><dt><b><tt id='l2h-4785'>ERROR</tt></b></dt> <dd> An error occurred while trying to read the disc or its table of contents. </dd></dl> <P> <dl><dt><b><tt id='l2h-4786'>PLAYING</tt></b></dt> <dd> The drive is in CD player mode playing an audio CD through its audio jacks. </dd></dl> <P> <dl><dt><b><tt id='l2h-4787'>PAUSED</tt></b></dt> <dd> The drive is in CD layer mode with play paused. </dd></dl> <P> <dl><dt><b><tt id='l2h-4788'>STILL</tt></b></dt> <dd> The equivalent of <tt class="constant">PAUSED</tt> on older (non 3301) model Toshiba CD-ROM drives. Such drives have never been shipped by SGI. </dd></dl> <P> <dl><dt><b><tt id='l2h-4789'>audio</tt></b></dt> <dd> <dt><b><tt id='l2h-4790'>pnum</tt></b></dt><dd> <dt><b><tt id='l2h-4791'>index</tt></b></dt><dd> <dt><b><tt id='l2h-4792'>ptime</tt></b></dt><dd> <dt><b><tt id='l2h-4793'>atime</tt></b></dt><dd> <dt><b><tt id='l2h-4794'>catalog</tt></b></dt><dd> <dt><b><tt id='l2h-4795'>ident</tt></b></dt><dd> <dt><b><tt id='l2h-4796'>control</tt></b></dt><dd> Integer constants describing the various types of parser callbacks that can be set by the <tt class="method">addcallback()</tt> method of CD parser objects (see below). </dd></dl> <P> <p><br /></p><hr class='online-navigation' /> <div class='online-navigation'> <!--Table of Child-Links--> <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> <UL CLASS="ChildLinks"> <LI><A href="player-objects.html">20.3.1 Player Objects</a> <LI><A href="cd-parser-objects.html">20.3.2 Parser Objects</a> </ul> <!--End of Table of Child-Links--> </div> <DIV CLASS="navigation"> <div class='online-navigation'><hr /> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <td class='online-navigation'><a rel="prev" title="20.2 AL " rel="prev" title="20.2 AL " href="module-al-constants.html"><img src='../icons/previous.png' border='0' height='32' alt='Previous Page' width='32' /></A></td> <td class='online-navigation'><a rel="parent" title="20. SGI IRIX Specific" rel="parent" title="20. SGI IRIX Specific" href="sgi.html"><img src='../icons/up.png' border='0' height='32' alt='Up One Level' width='32' /></A></td> <td class='online-navigation'><a rel="next" title="20.3.1 Player Objects" rel="next" title="20.3.1 Player Objects" href="player-objects.html"><img src='../icons/next.png' border='0' height='32' alt='Next Page' width='32' /></A></td> <td align="center" width="100%">Python Library Reference</td> <td class='online-navigation'><a rel="contents" title="Table of Contents" rel="contents" title="Table of Contents" href="contents.html"><img src='../icons/contents.png' border='0' height='32' alt='Contents' width='32' /></A></td> <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' border='0' height='32' alt='Module Index' width='32' /></a></td> <td class='online-navigation'><a rel="index" title="Index" rel="index" title="Index" href="genindex.html"><img src='../icons/index.png' border='0' height='32' alt='Index' width='32' /></A></td> </tr></table> <div class='online-navigation'> <b class="navlabel">Previous:</b> <a class="sectref" rel="prev" href="module-al-constants.html">20.2 AL </A> <b class="navlabel">Up:</b> <a class="sectref" rel="parent" href="sgi.html">20. SGI IRIX Specific</A> <b class="navlabel">Next:</b> <a class="sectref" rel="next" href="player-objects.html">20.3.1 Player Objects</A> </div> </div> <hr /> <span class="release-info">Release 2.3.4, documentation updated on May 20, 2004.</span> </DIV> <!--End of Navigation Panel--> <ADDRESS> See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. </ADDRESS> </BODY> </HTML>