2 * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) 2005 Tim-Philipp Müller <tim centricular net>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #ifndef __GST_CDDA_BASE_SRC_H__
22 #define __GST_CDDA_BASE_SRC_H__
25 #include <gst/base/gstpushsrc.h>
27 /* must include this for backwards-compatibility so the
28 * GST_TAG_CDDA_* defines are included. Remove in 0.11 */
29 #include <gst/tag/tag.h>
33 #define GST_TYPE_CDDA_BASE_SRC (gst_cdda_base_src_get_type())
34 #define GST_CDDA_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrc))
35 #define GST_CDDA_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrcClass))
36 #define GST_IS_CDDA_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_CDDA_BASE_SRC))
37 #define GST_IS_CDDA_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_CDDA_BASE_SRC))
38 #define GST_CDDA_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrcClass))
40 typedef struct _GstCddaBaseSrc GstCddaBaseSrc;
41 typedef struct _GstCddaBaseSrcClass GstCddaBaseSrcClass;
42 typedef struct _GstCddaBaseSrcTrack GstCddaBaseSrcTrack;
46 * @GST_CDDA_BASE_SRC_MODE_NORMAL : each single track is a stream
47 * @GST_CDDA_BASE_SRC_MODE_CONTINUOUS : the entire disc is a single stream
49 * Mode in which the CD audio source operates. Influences timestamping,
50 * EOS handling and seeking.
53 GST_CDDA_BASE_SRC_MODE_NORMAL, /* stream = one track */
54 GST_CDDA_BASE_SRC_MODE_CONTINUOUS /* stream = whole disc */
57 #define GST_TYPE_CDDA_BASE_SRC_MODE (gst_cdda_base_src_mode_get_type ())
60 * GstCddaBaseSrcTrack:
61 * @is_audio: Whether this is an audio track
62 * @num: Track number in TOC (usually starts from 1, but not always)
63 * @start: The first sector of this track (LBA)
64 * @end: The last sector of this track (LBA)
65 * @tags: Track-specific tags (e.g. from cd-text information), or NULL
67 * CD track abstraction to communicate TOC entries to the base class.
69 struct _GstCddaBaseSrcTrack {
70 gboolean is_audio; /* TRUE if this is an audio track */
71 guint num; /* real track number (usually starts from 1) */
72 guint start; /* first sector of track (LBA, not LSN!) */
73 guint end; /* last sector of track (LBA, not LSN!) */
74 GstTagList *tags; /* NULL or tags for track (e.g. from cd-text) */
77 guint _gst_reserved1[GST_PADDING/2];
78 gpointer _gst_reserved2[GST_PADDING/2];
81 struct _GstCddaBaseSrc {
84 /*< protected >*/ /* for use by sub-classes only */
85 GstTagList *tags; /* tags that apply to all tracks */
88 GstCddaBaseSrcMode mode;
94 GstCddaBaseSrcTrack *tracks;
96 gint cur_track; /* current track (starting from 0) */
97 gint prev_track; /* current track last time */
98 gint cur_sector; /* current sector */
99 gint seek_sector; /* -1 or sector to seek to */
104 guint32 discid; /* cddb disc id (for unit test) */
105 gchar mb_discid[32]; /* musicbrainz discid */
114 guint _gst_reserved1[GST_PADDING/2];
115 gpointer _gst_reserved2[GST_PADDING/2];
118 struct _GstCddaBaseSrcClass {
119 GstPushSrcClass pushsrc_class;
121 /* open/close the CD device */
122 gboolean (*open) (GstCddaBaseSrc *src, const gchar *device);
123 void (*close) (GstCddaBaseSrc *src);
125 /* read one sector (LBA) */
126 GstBuffer * (*read_sector) (GstCddaBaseSrc *src, gint sector);
128 /* return default device or NULL (optional) */
129 gchar * (*get_default_device) (GstCddaBaseSrc *src);
131 /* return NULL-terminated string array of CD devices, or NULL (optional) */
132 gchar ** (*probe_devices) (GstCddaBaseSrc *src);
135 gpointer _gst_reserved[GST_PADDING];
138 GType gst_cdda_base_src_get_type (void);
139 GType gst_cdda_base_src_mode_get_type (void);
141 gboolean gst_cdda_base_src_add_track (GstCddaBaseSrc * src,
142 GstCddaBaseSrcTrack * track);
146 * GST_TAG_CDDA_TRACK_TAGS:
148 * Tag details for all available tracks
149 * FiXME: find out which type we want for this!
151 #define GST_TAG_CDDA_TRACK_TAGS "track-tags"
156 #endif /* __GST_CDDA_BASE_SRC_H__ */