1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/* GStreamer
* Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) 2005 Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CDDA_BASE_SRC_H__
#define __GST_CDDA_BASE_SRC_H__
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
/* must include this for backwards-compatibility so the
* GST_TAG_CDDA_* defines are included. Remove in 0.11 */
#include <gst/tag/tag.h>
G_BEGIN_DECLS
#define GST_TYPE_CDDA_BASE_SRC (gst_cdda_base_src_get_type())
#define GST_CDDA_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrc))
#define GST_CDDA_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrcClass))
#define GST_IS_CDDA_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_CDDA_BASE_SRC))
#define GST_IS_CDDA_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_CDDA_BASE_SRC))
#define GST_CDDA_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrcClass))
typedef struct _GstCddaBaseSrc GstCddaBaseSrc;
typedef struct _GstCddaBaseSrcClass GstCddaBaseSrcClass;
typedef struct _GstCddaBaseSrcTrack GstCddaBaseSrcTrack;
/**
* GstCddaBaseSrcMode:
* @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
*
* Mode in which the CD audio source operates. Influences timestamping,
* EOS handling and seeking.
*/
typedef enum {
GST_CDDA_BASE_SRC_MODE_NORMAL, /* stream = one track */
GST_CDDA_BASE_SRC_MODE_CONTINUOUS /* stream = whole disc */
} GstCddaBaseSrcMode;
#define GST_TYPE_CDDA_BASE_SRC_MODE (gst_cdda_base_src_mode_get_type ())
/**
* GstCddaBaseSrcTrack:
* @is_audio: Whether this is an audio track
* @num: Track number in TOC (usually starts from 1, but not always)
* @start: The first sector of this track (LBA)
* @end: The last sector of this track (LBA)
* @tags: Track-specific tags (e.g. from cd-text information), or NULL
*
* CD track abstraction to communicate TOC entries to the base class.
*/
struct _GstCddaBaseSrcTrack {
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) */
/*< private >*/
guint _gst_reserved1[GST_PADDING/2];
gpointer _gst_reserved2[GST_PADDING/2];
};
struct _GstCddaBaseSrc {
GstPushSrc pushsrc;
/*< protected >*/ /* for use by sub-classes only */
GstTagList *tags; /* tags that apply to all tracks */
/*< private >*/
GstCddaBaseSrcMode mode;
gchar *device;
guint num_tracks;
guint num_all_tracks;
GstCddaBaseSrcTrack *tracks;
gint cur_track; /* current track (starting from 0) */
gint prev_track; /* current track last time */
gint cur_sector; /* current sector */
gint seek_sector; /* -1 or sector to seek to */
gint uri_track;
gchar *uri;
guint32 discid; /* cddb disc id (for unit test) */
gchar mb_discid[32]; /* musicbrainz discid */
GstIndex *index;
gint index_id;
gint toc_offset;
gboolean toc_bias;
/*< private >*/
guint _gst_reserved1[GST_PADDING/2];
gpointer _gst_reserved2[GST_PADDING/2];
};
struct _GstCddaBaseSrcClass {
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);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_cdda_base_src_get_type (void);
GType gst_cdda_base_src_mode_get_type (void);
gboolean gst_cdda_base_src_add_track (GstCddaBaseSrc * src,
GstCddaBaseSrcTrack * track);
#if 0
/*
* GST_TAG_CDDA_TRACK_TAGS:
*
* Tag details for all available tracks
* FiXME: find out which type we want for this!
*/
#define GST_TAG_CDDA_TRACK_TAGS "track-tags"
#endif
G_END_DECLS
#endif /* __GST_CDDA_BASE_SRC_H__ */
|