1/* GStreamer Audio CD Source Base Class
2 * Copyright (C) 2005 Tim-Philipp Müller <tim centricular net>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#ifndef __GST_AUDIO_AUDIO_H__
21#include <gst/audio/audio.h>
22#endif
23
24#ifndef __GST_AUDIO_CD_SRC_H__
25#define __GST_AUDIO_CD_SRC_H__
26
27#include <gst/gst.h>
28#include <gst/base/gstpushsrc.h>
29
30G_BEGIN_DECLS
31
32#define GST_TYPE_AUDIO_CD_SRC (gst_audio_cd_src_get_type())
33#define GST_AUDIO_CD_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrc))
34#define GST_AUDIO_CD_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrcClass))
35#define GST_IS_AUDIO_CD_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AUDIO_CD_SRC))
36#define GST_IS_AUDIO_CD_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AUDIO_CD_SRC))
37#define GST_AUDIO_CD_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrcClass))
38
39typedef struct _GstAudioCdSrc GstAudioCdSrc;
40typedef struct _GstAudioCdSrcClass GstAudioCdSrcClass;
41typedef struct _GstAudioCdSrcTrack GstAudioCdSrcTrack;
42typedef struct _GstAudioCdSrcPrivate GstAudioCdSrcPrivate;
43
44/**
45 * GstAudioCdSrcMode:
46 * @GST_AUDIO_CD_SRC_MODE_NORMAL : each single track is a stream
47 * @GST_AUDIO_CD_SRC_MODE_CONTINUOUS : the entire disc is a single stream
48 *
49 * Mode in which the CD audio source operates. Influences timestamping,
50 * EOS handling and seeking.
51 */
52typedef enum {
53 GST_AUDIO_CD_SRC_MODE_NORMAL, /* stream = one track */
54 GST_AUDIO_CD_SRC_MODE_CONTINUOUS /* stream = whole disc */
55} GstAudioCdSrcMode;
56
57/**
58 * GstAudioCdSrcTrack:
59 * @is_audio: Whether this is an audio track
60 * @num: Track number in TOC (usually starts from 1, but not always)
61 * @start: The first sector of this track (LBA)
62 * @end: The last sector of this track (LBA)
63 * @tags: Track-specific tags (e.g. from cd-text information), or NULL
64 *
65 * CD track abstraction to communicate TOC entries to the base class.
66 *
67 * This structure is only for use by sub-classed in connection with
68 * gst_audio_cd_src_add_track().
69 *
70 * Applications will be informed of the available tracks via a TOC message
71 * on the pipeline's #GstBus instead.
72 */
73/* FIXME 2.0: remove this struct and pass values directly to _add_track() */
74struct _GstAudioCdSrcTrack {
75 gboolean is_audio; /* TRUE if this is an audio track */
76 guint num; /* real track number (usually starts from 1) */
77 guint start; /* first sector of track (LBA, not LSN!) */
78 guint end; /* last sector of track (LBA, not LSN!) */
79 GstTagList *tags; /* NULL or tags for track (e.g. from cd-text) */
80
81 /*< private >*/
82 guint _gst_reserved1[GST_PADDING/2];
83 gpointer _gst_reserved2[GST_PADDING/2];
84};
85
86struct _GstAudioCdSrc {
87 GstPushSrc pushsrc;
88
89 /*< protected >*/ /* for use by sub-classes only */
90 GstTagList *tags; /* tags that apply to all tracks */
91
92 /*< private >*/
93 GstAudioCdSrcPrivate *priv;
94
95 /*< private >*/
96 guint _gst_reserved1[GST_PADDING/2];
97 gpointer _gst_reserved2[GST_PADDING/2];
98};
99
100/**
101 * GstAudioCdSrcClass:
102 * @pushsrc_class: the parent class
103 * @open: opening the device
104 * @close: closing the device
105 * @read_sector: reading a sector
106 * @get_default_device: getting the default device
107 * @probe_devices: probing possible devices
108 *
109 * Audio CD source base class.
110 */
111struct _GstAudioCdSrcClass {
112 GstPushSrcClass pushsrc_class;
113
114 /* open/close the CD device */
115 gboolean (*open) (GstAudioCdSrc *src, const gchar *device);
116 void (*close) (GstAudioCdSrc *src);
117
118 /* read one sector (LBA) */
119 GstBuffer * (*read_sector) (GstAudioCdSrc *src, gint sector);
120
121#if 0
122 /* return default device or NULL (optional) */
123 gchar * (*get_default_device) (GstAudioCdSrc *src);
124
125 /* return NULL-terminated string array of CD devices, or NULL (optional) */
126 /* FIXME 0.11: reconsider for new probing/device discovery API, remove if in doubt */
127 gchar ** (*probe_devices) (GstAudioCdSrc *src);
128#endif
129
130 /*< private >*/
131 gpointer _gst_reserved[GST_PADDING_LARGE];
132};
133
134GST_AUDIO_API
135GType gst_audio_cd_src_get_type (void);
136
137GST_AUDIO_API
138gboolean gst_audio_cd_src_add_track (GstAudioCdSrc * src,
139 GstAudioCdSrcTrack * track);
140
141G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioCdSrc, gst_object_unref)
142
143G_END_DECLS
144
145#endif /* __GST_AUDIO_CD_SRC_H__ */
146

source code of include/gstreamer-1.0/gst/audio/gstaudiocdsrc.h