Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / gst-libs / gst / cdda / gstcddabasesrc.h
1 /* GStreamer
2  * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
3  * Copyright (C) 2005 Tim-Philipp Müller <tim centricular net>
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef __GST_CDDA_BASE_SRC_H__
22 #define __GST_CDDA_BASE_SRC_H__
23
24 #include <gst/gst.h>
25 #include <gst/base/gstpushsrc.h>
26
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>
30
31 G_BEGIN_DECLS
32
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))
39
40 typedef struct _GstCddaBaseSrc GstCddaBaseSrc;
41 typedef struct _GstCddaBaseSrcClass GstCddaBaseSrcClass;
42 typedef struct _GstCddaBaseSrcTrack GstCddaBaseSrcTrack;
43
44 /**
45  * GstCddaBaseSrcMode:
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
48  *
49  * Mode in which the CD audio source operates. Influences timestamping,
50  * EOS handling and seeking.
51  */
52 typedef enum {
53   GST_CDDA_BASE_SRC_MODE_NORMAL,          /* stream = one track  */
54   GST_CDDA_BASE_SRC_MODE_CONTINUOUS       /* stream = whole disc */
55 } GstCddaBaseSrcMode;
56
57 #define GST_TYPE_CDDA_BASE_SRC_MODE          (gst_cdda_base_src_mode_get_type ())
58
59 /**
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
66  *
67  * CD track abstraction to communicate TOC entries to the base class.
68  */
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) */
75
76   /*< private >*/
77   guint        _gst_reserved1[GST_PADDING/2];
78   gpointer     _gst_reserved2[GST_PADDING/2];
79 };
80
81 struct _GstCddaBaseSrc {
82   GstPushSrc            pushsrc;
83
84   /*< protected >*/ /* for use by sub-classes only */
85   GstTagList           *tags;            /* tags that apply to all tracks   */
86
87   /*< private >*/
88   GstCddaBaseSrcMode    mode;
89
90   gchar                *device;
91
92   guint                 num_tracks;
93   guint                 num_all_tracks;
94   GstCddaBaseSrcTrack  *tracks;
95
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         */
100
101   gint                  uri_track;
102   gchar                *uri;
103
104   guint32               discid;          /* cddb disc id (for unit test)    */
105   gchar                 mb_discid[32];   /* musicbrainz discid              */
106
107   GstIndex             *index;
108   gint                  index_id;
109
110   gint                  toc_offset;
111   gboolean              toc_bias;
112
113   /*< private >*/
114   guint                 _gst_reserved1[GST_PADDING/2];
115   gpointer              _gst_reserved2[GST_PADDING/2];
116 };
117
118 struct _GstCddaBaseSrcClass {
119   GstPushSrcClass pushsrc_class;
120
121   /* open/close the CD device */
122   gboolean    (*open)               (GstCddaBaseSrc *src, const gchar *device);
123   void        (*close)              (GstCddaBaseSrc *src);
124
125   /* read one sector (LBA) */
126   GstBuffer * (*read_sector)        (GstCddaBaseSrc *src, gint sector);
127
128   /* return default device or NULL (optional) */
129   gchar *     (*get_default_device) (GstCddaBaseSrc *src);
130
131   /* return NULL-terminated string array of CD devices, or NULL (optional) */
132   gchar **    (*probe_devices)      (GstCddaBaseSrc *src);
133
134   /*< private >*/
135   gpointer       _gst_reserved[GST_PADDING];
136 };
137
138 GType    gst_cdda_base_src_get_type (void);
139 GType    gst_cdda_base_src_mode_get_type (void);
140
141 gboolean gst_cdda_base_src_add_track (GstCddaBaseSrc      * src,
142                                       GstCddaBaseSrcTrack * track);
143
144 #if 0
145 /*
146  * GST_TAG_CDDA_TRACK_TAGS:
147  *
148  * Tag details for all available tracks
149  * FiXME: find out which type we want for this!
150  */
151 #define GST_TAG_CDDA_TRACK_TAGS               "track-tags"
152 #endif
153
154 G_END_DECLS
155
156 #endif /* __GST_CDDA_BASE_SRC_H__ */
157