18.3.2 Parser Objects
Python Library Reference
Previous: 18.3.1 Player Objects
Up: 18.3 cd
Next: 18.4 fl
18.3.2 Parser Objects
Parser objects (returned by createparser()) have the
following methods:
addcallback (type, func, arg)
Adds a callback for the parser. The parser has callbacks for eight
different types of data in the digital audio data stream. Constants
for these types are defined at the cd module level (see above).
The callback is called as follows: func(arg, type,
data), where arg is the user supplied argument, type is
the particular type of callback, and data is the data returned
for this type of callback. The type of the data depends on the
type of callback as follows:
Type
Value
audio
String which can be passed unmodified to
al.writesamps().
pnum
Integer giving the program (track) number.
index
Integer giving the index number.
ptime
Tuple consisting of the program time in minutes,
seconds, and frames.
atime
Tuple consisting of the absolute time in minutes,
seconds, and frames.
catalog
String of 13 characters, giving the catalog number
of the CD.
ident
String of 12 characters, giving the ISRC
identification number of the recording. The string consists of two
characters country code, three characters owner code, two characters
giving the year, and five characters giving a serial number.
control
Integer giving the control bits from the CD
subcode data
deleteparser ()
Deletes the parser and frees the memory it was using. The object
should not be used after this call. This call is done automatically
when the last reference to the object is removed.
parseframe (frame)
Parses one or more frames of digital audio data from a CD such as
returned by readda(). It determines which subcodes are
present in the data. If these subcodes have changed since the last
frame, then parseframe() executes a callback of the
appropriate type passing to it the subcode data found in the frame.
Unlike the C function, more than one frame of digital audio data
can be passed to this method.
removecallback (type)
Removes the callback for the given type.
resetparser ()
Resets the fields of the parser used for tracking subcodes to an
initial state. resetparser() should be called after the disc
has been changed.
Python Library Reference
Previous: 18.3.1 Player Objects
Up: 18.3 cd
Next: 18.4 fl
See About this document... for information on suggesting changes.
Wyszukiwarka
Podobne podstrony:
html parser objectsincremental parser objectsstream writer objectsObjectImplBEC CDfunction hwapi object remove110 Amazing Magic Tricks With Everyday Objectswięcej podobnych podstron