# GstAudioCdSrc

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

## Using GstAudioCdSrc-based elements in applications

GstAudioCdSrc registers two GstFormats of its own, namely the "track" format and the "sector" format. Applications will usually only find the "track" format interesting. You can retrieve that GstFormat 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 GstBus. The GstToc will contain a GstTocEntry 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_toc_entry_get_start_stop_times. The track entries in the TOC will be sorted by track number.

## GstAudioCdSrc

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBaseSrc
                        ╰──GstPushSrc
                            ╰──GstAudioCdSrc

### Members

`pushsrc` (GstPushSrc) –
No description available
`tags` (GstTagList *) –
No description available

### Class structure

#### GstAudioCdSrcClass

Audio CD source base class.

##### Fields

`pushsrc_class` (GstPushSrcClass) –

the parent class

### GstAudio.AudioCdSrcClass

Audio CD source base class.

##### Attributes

`pushsrc_class` (GstBase.PushSrcClass) –

the parent class

### GstAudio.AudioCdSrcClass

Audio CD source base class.

##### Attributes

`pushsrc_class` (GstBase.PushSrcClass) –

the parent class

## GstAudio.AudioCdSrc

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstBase.BaseSrc
                        ╰──GstBase.PushSrc
                            ╰──GstAudio.AudioCdSrc

### Members

`pushsrc` (GstBase.PushSrc) –
No description available
`tags` (Gst.TagList) –
No description available

## GstAudio.AudioCdSrc

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstBase.BaseSrc
                        ╰──GstBase.PushSrc
                            ╰──GstAudio.AudioCdSrc

### Members

`pushsrc` (GstBase.PushSrc) –
No description available
`tags` (Gst.TagList) –
No description available

### Methods

#### gst_audio_cd_src_add_track

    gboolean
    gst_audio_cd_src_add_track (GstAudioCdSrc * src,
                                GstAudioCdSrcTrack * track)

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).

Parameters:

`src` –

a GstAudioCdSrc

`track` –

address of GstAudioCdSrcTrack to add

Returns –

FALSE on error, otherwise TRUE.

#### GstAudio.AudioCdSrc.prototype.add_track

    function GstAudio.AudioCdSrc.prototype.add_track(track: GstAudio.AudioCdSrcTrack): {
        // javascript wrapper for 'gst_audio_cd_src_add_track'
    }

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).

Parameters:

`src` (GstAudio.AudioCdSrc) –

a GstAudio.AudioCdSrc

`track` (GstAudio.AudioCdSrcTrack) –

address of GstAudio.AudioCdSrcTrack to add

Returns (Number) –

FALSE on error, otherwise TRUE.

#### GstAudio.AudioCdSrc.add_track

    def GstAudio.AudioCdSrc.add_track (self, track):
        #python wrapper for 'gst_audio_cd_src_add_track'

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).

Parameters:

`src` (GstAudio.AudioCdSrc) –

a GstAudio.AudioCdSrc

`track` (GstAudio.AudioCdSrcTrack) –

address of GstAudio.AudioCdSrcTrack to add

Returns (bool) –

FALSE on error, otherwise TRUE.

### Properties

#### device

    “device” gchar *

Flags : Read / Write

#### device

    “device” String

Flags : Read / Write

#### device

    “self.props.device” str

Flags : Read / Write

#### mode

    “mode” GstAudioCdSrcMode *

Flags : Read / Write

#### mode

    “mode” GstAudio.AudioCdSrcMode

Flags : Read / Write

#### mode

    “self.props.mode” GstAudio.AudioCdSrcMode

Flags : Read / Write

#### track

    “track” guint

Flags : Read / Write

#### track

    “track” Number

Flags : Read / Write

#### track

    “self.props.track” int

Flags : Read / Write

### Virtual Methods

#### close

    close (GstAudioCdSrc * src)

closing the device

Parameters:

`src` –
No description available

#### vfunc_close

    function vfunc_close(src: GstAudio.AudioCdSrc): {
        // javascript implementation of the 'close' virtual method
    }

closing the device

Parameters:

`src` (GstAudio.AudioCdSrc) –
No description available

#### do_close

    def do_close (src):
        #python implementation of the 'close' virtual method

closing the device

Parameters:

`src` (GstAudio.AudioCdSrc) –
No description available

#### open

    gboolean
    open (GstAudioCdSrc * src,
          const gchar * device)

opening the device

Parameters:

`src` –
No description available
`device` –
No description available
Returns –
No description available

#### vfunc_open

    function vfunc_open(src: GstAudio.AudioCdSrc, device: String): {
        // javascript implementation of the 'open' virtual method
    }

opening the device

Parameters:

`src` (GstAudio.AudioCdSrc) –
No description available
`device` (String) –
No description available
Returns (Number) –
No description available

#### do_open

    def do_open (src, device):
        #python implementation of the 'open' virtual method

opening the device

Parameters:

`src` (GstAudio.AudioCdSrc) –
No description available
`device` (str) –
No description available
Returns (bool) –
No description available

#### read_sector

    GstBuffer *
    read_sector (GstAudioCdSrc * src,
                 gint sector)

reading a sector

Parameters:

`src` –
No description available
`sector` –
No description available
Returns –
No description available

#### vfunc_read_sector

    function vfunc_read_sector(src: GstAudio.AudioCdSrc, sector: Number): {
        // javascript implementation of the 'read_sector' virtual method
    }

reading a sector

Parameters:

`src` (GstAudio.AudioCdSrc) –
No description available
`sector` (Number) –
No description available
Returns (Gst.Buffer) –
No description available

#### do_read_sector

    def do_read_sector (src, sector):
        #python implementation of the 'read_sector' virtual method

reading a sector

Parameters:

`src` (GstAudio.AudioCdSrc) –
No description available
`sector` (int) –
No description available
Returns (Gst.Buffer) –
No description available

## GstAudioCdSrcTrack

CD track abstraction to communicate TOC entries to the base class.

This structure is only for use by sub-classed in connection with gst_audio_cd_src_add_track.

Applications will be informed of the available tracks via a TOC message on the pipeline's GstBus instead.

### Members

`is_audio` (gboolean) –

Whether this is an audio track

`num` (guint) –

Track number in TOC (usually starts from 1, but not always)

`start` (guint) –

The first sector of this track (LBA)

`end` (guint) –

The last sector of this track (LBA)

`tags` (GstTagList *) –

Track-specific tags (e.g. from cd-text information), or NULL

## GstAudio.AudioCdSrcTrack

CD track abstraction to communicate TOC entries to the base class.

This structure is only for use by sub-classed in connection with GstAudio.AudioCdSrc.prototype.add_track.

Applications will be informed of the available tracks via a TOC message on the pipeline's Gst.Bus instead.

### Members

`is_audio` (Number) –

Whether this is an audio track

`num` (Number) –

Track number in TOC (usually starts from 1, but not always)

`start` (Number) –

The first sector of this track (LBA)

`end` (Number) –

The last sector of this track (LBA)

`tags` (Gst.TagList) –

Track-specific tags (e.g. from cd-text information), or NULL

## GstAudio.AudioCdSrcTrack

CD track abstraction to communicate TOC entries to the base class.

This structure is only for use by sub-classed in connection with GstAudio.AudioCdSrc.add_track.

Applications will be informed of the available tracks via a TOC message on the pipeline's Gst.Bus instead.

### Members

`is_audio` (bool) –

Whether this is an audio track

`num` (int) –

Track number in TOC (usually starts from 1, but not always)

`start` (int) –

The first sector of this track (LBA)

`end` (int) –

The last sector of this track (LBA)

`tags` (Gst.TagList) –

Track-specific tags (e.g. from cd-text information), or NULL

## Enumerations

### GstAudioCdSrcMode

Mode in which the CD audio source operates. Influences timestamping, EOS handling and seeking.

##### Members

`GST_AUDIO_CD_SRC_MODE_NORMAL` (0) –

each single track is a stream

`GST_AUDIO_CD_SRC_MODE_CONTINUOUS` (1) –

the entire disc is a single stream

### GstAudio.AudioCdSrcMode

Mode in which the CD audio source operates. Influences timestamping, EOS handling and seeking.

##### Members

`GstAudio.AudioCdSrcMode.NORMAL` (0) –

each single track is a stream

`GstAudio.AudioCdSrcMode.CONTINUOUS` (1) –

the entire disc is a single stream

### GstAudio.AudioCdSrcMode

Mode in which the CD audio source operates. Influences timestamping, EOS handling and seeking.

##### Members

`GstAudio.AudioCdSrcMode.NORMAL` (0) –

each single track is a stream

`GstAudio.AudioCdSrcMode.CONTINUOUS` (1) –

the entire disc is a single stream

The results of the search are