Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / lib / module-cd.html
<!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.png" type="image/png" />
<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 name='aesop' content='information' />
<title>20.3 cd -- CD-ROM access on SGI systems</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml: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"></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-5067' xml:id='l2h-5067' class="function">createparser</tt></b>(</nobr></td>
<td><var></var>)</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-5068' xml:id='l2h-5068' 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-5069' xml:id='l2h-5069' class="function">open</tt></b>(</nobr></td>
<td><var></var><big>[</big><var>device</var><big>[</big><var>, mode</var><big>]</big><var></var><big>]</big><var></var>)</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 omitted,
should be the string <code>'r'</code>.
</dl>
<P>
The module defines the following variables:
<P>
<dl><dt><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-5070' xml:id='l2h-5070' class="exception">error</tt></b></dt>
<dd>
Exception raised on various errors.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-5071' xml:id='l2h-5071'>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-5072' xml:id='l2h-5072'>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-5073' xml:id='l2h-5073'>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-5074' xml:id='l2h-5074'>NODISC</tt></b></dt>
<dd>
The drive does not have a CD loaded.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-5075' xml:id='l2h-5075'>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-5076' xml:id='l2h-5076'>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-5077' xml:id='l2h-5077'>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-5078' xml:id='l2h-5078'>PAUSED</tt></b></dt>
<dd>
The drive is in CD layer mode with play paused.
</dd></dl>
<P>
<dl><dt><b><tt id='l2h-5079' xml:id='l2h-5079'>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-5080' xml:id='l2h-5080'>audio</tt></b></dt>
<dd>
<dt><b><tt id='l2h-5081' xml:id='l2h-5081'>pnum</tt></b></dt><dd>
<dt><b><tt id='l2h-5082' xml:id='l2h-5082'>index</tt></b></dt><dd>
<dt><b><tt id='l2h-5083' xml:id='l2h-5083'>ptime</tt></b></dt><dd>
<dt><b><tt id='l2h-5084' xml:id='l2h-5084'>atime</tt></b></dt><dd>
<dt><b><tt id='l2h-5085' xml:id='l2h-5085'>catalog</tt></b></dt><dd>
<dt><b><tt id='l2h-5086' xml:id='l2h-5086'>ident</tt></b></dt><dd>
<dt><b><tt id='l2h-5087' xml:id='l2h-5087'>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'>
<p></p><hr />
<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>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</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>