![]() |
![]() |
![]() |
GStreamer Base Plugins 0.10 Library Reference Manual | ![]() |
---|---|---|---|---|
#include <gst/cdda/gstcddabasesrc.h> GstCddaBaseSrc; GstCddaBaseSrcClass; GstCddaBaseSrcTrack; enum GstCddaBaseSrcMode; gboolean gst_cdda_base_src_add_track (GstCddaBaseSrc *src, GstCddaBaseSrcTrack *track);
GObject +----GstObject +----GstElement +----GstBaseSrc +----GstPushSrc +----GstCddaBaseSrc
"device" gchararray : Read / Write "mode" GstCddaBaseSrcMode : Read / Write "track" guint : Read / Write
Provides a base class for CDDA sources, which handles things like seeking, querying, discid calculation, tags, and buffer timestamping.
GstCddaBaseSrc 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).
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.
typedef struct { GstPushSrcClass pushsrc_class; /* open/close the CD device */ gboolean (*open) (GstCddaBaseSrc *src, const gchar *device); void (*close) (GstCddaBaseSrc *src); /* read one sector (LBA) */ GstBuffer * (*read_sector) (GstCddaBaseSrc *src, gint sector); /* return default device or NULL (optional) */ gchar * (*get_default_device) (GstCddaBaseSrc *src); /* return NULL-terminated string array of CD devices, or NULL (optional) */ gchar ** (*probe_devices) (GstCddaBaseSrc *src); } GstCddaBaseSrcClass;
typedef struct { gboolean is_audio; /* TRUE if this is an audio track */ guint num; /* real track number (usually starts from 1) */ guint start; /* first sector of track (LBA, not LSN!) */ guint end; /* last sector of track (LBA, not LSN!) */ GstTagList *tags; /* NULL or tags for track (e.g. from cd-text) */ } GstCddaBaseSrcTrack;
CD track abstraction to communicate TOC entries to the base class.
is_audio
;gbooleanis_audio
Whether this is an audio track
Whether this is an audio track
guint num
;guintnum
Track number in TOC (usually starts from 1, but not always)
Track number in TOC (usually starts from 1, but not always)
guint start
;guintstart
The first sector of this track (LBA)
The first sector of this track (LBA)
guint end
;guintend
The last sector of this track (LBA)
The last sector of this track (LBA)
GstTagList *tags
;GstTagListtags
Track-specific tags (e.g. from cd-text information), or NULL
Track-specific tags (e.g. from cd-text information), or NULL
gboolean is_audio ; |
Whether this is an audio track |
guint num ; |
Track number in TOC (usually starts from 1, but not always) |
guint start ; |
The first sector of this track (LBA) |
guint end ; |
The last sector of this track (LBA) |
GstTagList *tags ; |
Track-specific tags (e.g. from cd-text information), or NULL |
typedef enum { GST_CDDA_BASE_SRC_MODE_NORMAL, /* stream = one track */ GST_CDDA_BASE_SRC_MODE_CONTINUOUS /* stream = whole disc */ } GstCddaBaseSrcMode;
Mode in which the CD audio source operates. Influences timestamping, EOS handling and seeking.
GST_CDDA_BASE_SRC_MODE_NORMAL
GST_CDDA_BASE_SRC_MODE_NORMAL
each single track is a stream
each single track is a stream
GST_CDDA_BASE_SRC_MODE_CONTINUOUS
GST_CDDA_BASE_SRC_MODE_CONTINUOUS
the entire disc is a single stream
the entire disc is a single stream
GST_CDDA_BASE_SRC_MODE_NORMAL |
each single track is a stream |
GST_CDDA_BASE_SRC_MODE_CONTINUOUS |
the entire disc is a single stream |
gboolean gst_cdda_base_src_add_track (GstCddaBaseSrc *src, GstCddaBaseSrcTrack *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).
src
:src
a GstCddaBaseSrc
a GstCddaBaseSrc
GstCddaBaseSrcGstCddaBaseSrctrack
:track
address of GstCddaBaseSrcTrack to add
address of GstCddaBaseSrcTrack to add
GstCddaBaseSrcTrackGstCddaBaseSrcTrackReturns :Returns FALSE on error, otherwise TRUE.
FALSE on error, otherwise TRUE.
src : |
a GstCddaBaseSrc |
track : |
address of GstCddaBaseSrcTrack to add |
Returns : | FALSE on error, otherwise TRUE. |
mode
" property"mode" GstCddaBaseSrcMode : Read / Write
Mode.
Default value: Stream consists of a single track