GstAudio.AudioCdSrc

g GObject.GInterface GObject.GInterface Gst.URIHandler Gst.URIHandler GObject.GInterface->Gst.URIHandler GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Element Gst.Element GstBase.BaseSrc GstBase.BaseSrc Gst.Element->GstBase.BaseSrc Gst.Object->Gst.Element GstAudio.AudioCdSrc GstAudio.AudioCdSrc Gst.URIHandler->GstAudio.AudioCdSrc GstBase.PushSrc GstBase.PushSrc GstBase.BaseSrc->GstBase.PushSrc GstBase.PushSrc->GstAudio.AudioCdSrc

Subclasses:

None

Methods

Inherited:

GstBase.BaseSrc (23), Gst.Element (82), Gst.Object (27), GObject.Object (37), Gst.URIHandler (4)

Structs:

Gst.ElementClass (10), GObject.ObjectClass (5)

add_track (track)

Virtual Methods

Inherited:

GstBase.PushSrc (3), GstBase.BaseSrc (19), Gst.Element (16), Gst.Object (1), GObject.Object (7), Gst.URIHandler (2)

do_close ()

do_open (device)

do_read_sector (sector)

Properties

Inherited:

GstBase.BaseSrc (5), Gst.Object (2)

Name

Type

Flags

Short Description

device

str

r/w

CD device location

mode

GstAudio.AudioCdSrcMode

r/w

Mode

track

int

r/w

Track

Signals

Inherited:

Gst.Element (3), Gst.Object (1), GObject.Object (1)

Fields

Inherited:

Gst.Element (3), Gst.Object (1), GObject.Object (1)

Name

Type

Access

Description

pushsrc

GstBase.PushSrc

r

tags

Gst.TagList

r

Class Details

class GstAudio.AudioCdSrc(**kwargs)
Bases:

GstBase.PushSrc, Gst.URIHandler

Abstract:

No

Structure:

GstAudio.AudioCdSrcClass

Provides a base class for CD digital audio (CDDA) sources, which handles things like seeking, querying, discid calculation, tags, and buffer timestamping.

Using GstAudio.AudioCdSrc-based elements in applications

GstAudio.AudioCdSrc registers two Gst.Format s of its own, namely the “track” format and the “sector” format. Applications will usually only find the “track” format interesting. You can retrieve that Gst.Format for use in seek events or queries with Gst.Format.get_by_nick(“track”).

In order to query the number of tracks, for example, an application would set the CDDA source element to READY or PAUSED state and then query the the number of tracks via Gst.Element.query_duration() using the track format acquired above. Applications can query the currently playing track in the same way.

Alternatively, applications may retrieve the currently playing track and the total number of tracks from the taglist that will posted on the bus whenever the CD is opened or the currently playing track changes. The taglist will contain Gst.TAG_TRACK_NUMBER and Gst.TAG_TRACK_COUNT tags.

Applications playing back CD audio using playbin and cdda://n URIs should issue a seek command in track format to change between tracks, rather than setting a new cdda://n+1 URI on playbin (as setting a new URI on playbin involves closing and re-opening the CD device, which is much much slower).

Tags and meta-information

CDDA sources will automatically emit a number of tags, details about which can be found in the libgsttag documentation. Those tags are: #GST_TAG_CDDA_CDDB_DISCID, #GST_TAG_CDDA_CDDB_DISCID_FULL, #GST_TAG_CDDA_MUSICBRAINZ_DISCID, #GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL, among others.

Tracks and Table of Contents (TOC)

Applications will be informed of the available tracks via a TOC message on the pipeline’s Gst.Bus. The Gst.Toc will contain a Gst.TocEntry for each track, with information about each track. The duration for each track can be retrieved via the Gst.TAG_DURATION tag from each entry’s tag list, or calculated via Gst.TocEntry.get_start_stop_times(). The track entries in the TOC will be sorted by track number.

add_track(track)[source]
Parameters:

track (GstAudio.AudioCdSrcTrack) – address of GstAudio.AudioCdSrcTrack to add

Returns:

False on error, otherwise True.

Return type:

bool

CDDA sources use this function from their start vfunc to announce the available data and audio tracks to the base source class. The caller should allocate track on the stack, the base source will do a shallow copy of the structure (and take ownership of the taglist if there is one).

do_close() virtual

closing the device

do_open(device) virtual
Parameters:

device (str) –

Return type:

bool

opening the device

do_read_sector(sector) virtual
Parameters:

sector (int) –

Return type:

Gst.Buffer

reading a sector

Property Details

GstAudio.AudioCdSrc.props.device
Name:

device

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

CD device location

GstAudio.AudioCdSrc.props.mode
Name:

mode

Type:

GstAudio.AudioCdSrcMode

Default Value:

GstAudio.AudioCdSrcMode.NORMAL

Flags:

READABLE, WRITABLE

Mode

GstAudio.AudioCdSrc.props.track
Name:

track

Type:

int

Default Value:

1

Flags:

READABLE, WRITABLE

Track