audiotools.dvda — the DVD-Audio Input/Output Module

The audiotools.dvda module contains a set of classes for accessing DVD-Audio data.

DVD Objects

class audiotools.dvda.DVDA(audio_ts_path[, cdrom_device])

A DVDA object represents the entire disc. audio_ts_path is the path to the disc’s mounted AUDIO_TS directory, such as /media/cdrom/AUDIO_TS. cdrom_device, if given, is the path to the device the disc is mounted from, such as /dev/cdrom.

If the disc is encrypted and cdrom_device is given, decryption will be performed automatically.

May raise IOError if some error occurs opening the disc.

DVDA.titlesets

The number of title sets on the disc, typically 1.

DVDA.titleset(titleset_number)

Given a title set number, starting from 1, returns that Titleset object. Raises IndexError if that title set is not found on the disc.

Titleset Objects

class audiotools.dvda.Titleset(dvda, titleset_number)

A Titleset object represents a title set on a disc. dvda is a DVDA object and titleset_number is the title set number.

My raise IndexError if the title set is not found on the disc.

Titleset.number

The title set’s number.

Titleset.titles

The number of titles in the title set.

Titleset.title(title_number)

Given a title number, starting from 1, returns that Title object. Raises IndexError if that title is not found on the disc.

Title Objects

class audiotools.dvda.Title(titleset, title_number)

A Title object represents a title in a title set. titleset is a Titleset object and title_number is the title number.

May raise IndexError if the title is not found in the title set.

Title.number

The title’s number.

Title.tracks

The number of tracks in the title.

Title.pts_length

The length of the title in PTS ticks. There are 90000 PTS ticks per second.

Title.track(track_number)

Given a track number, starting from 1, returns that Track object. Raises IndexError if that track is not found in the title.

Track Objects

class audiotools.dvda.Track(title, track_number)

A Track object represents a track in a title. title is a Title object and track_number is the track number.

May raise ValueError if the track is not found in the title.

Track.number

The track’s number.

Track.pts_index

The starting point of the track in the title, in PTS ticks.

Track.pts_length

The length of the track in PTS ticks. There are 90000 PTS ticks per second.

Track.first_sector

The track’s first sector in the stream of .AOB files. Each sector is exactly 2048 bytes long.

Track.last_sector

The track’s last sector in the stream of .AOB files.

Track.reader()

Returns a TrackReader for reading this track’s data. May raise IOError if some error occurs opening the reader.

TrackReader Objects

class audiotools.dvda.TrackReader(track)

TrackReader is a audiotools.PCMReader compatible object for extracting the audio data from a given track. track is a Track object.

May raise IOError if some error occurs opening the reader.

TrackReader.sample_rate

The track’s sample rate, in Hz.

TrackReader.bits_per_sample

The track’s bits-per-sample, either 24 or 16.

TrackReader.channels

The track’s channel count, often 2 or 6.

TrackReader.channel_mask

The track’s channel mask as a 32-bit value.

TrackReader.total_pcm_frames

The track’s total number of PCM frames.

TrackReader.codec

The track’s codec as a string.

TrackReader.read(pcm_frames)

Attempts to read the given number of PCM frames from the track as a audiotools.pcm.FrameList object. May return less than the requested number of PCM frames at the end of the disc.

Attempting to read from a closed stream will raise ValueError.

TrackReader.close()

Closes the stream for further reading.