|
1 /* GStreamer |
|
2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> |
|
3 * 2005 Wim Taymans <wim@fluendo.com> |
|
4 * |
|
5 * gstaudiosrc.h: |
|
6 * |
|
7 * This library is free software; you can redistribute it and/or |
|
8 * modify it under the terms of the GNU Library General Public |
|
9 * License as published by the Free Software Foundation; either |
|
10 * version 2 of the License, or (at your option) any later version. |
|
11 * |
|
12 * This library is distributed in the hope that it will be useful, |
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 * Library General Public License for more details. |
|
16 * |
|
17 * You should have received a copy of the GNU Library General Public |
|
18 * License along with this library; if not, write to the |
|
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
20 * Boston, MA 02111-1307, USA. |
|
21 */ |
|
22 |
|
23 /* a base class for simple audio srcs. |
|
24 * |
|
25 * This base class only requires subclasses to implement a set |
|
26 * of simple functions. |
|
27 * |
|
28 * - open: open the device with the specified caps |
|
29 * - read: read samples to the audio device |
|
30 * - close: close the device |
|
31 * - delay: the number of samples queued in the device |
|
32 * - reset: unblock a read to the device and reset. |
|
33 * |
|
34 * All scheduling of samples and timestamps is done in this |
|
35 * base class. |
|
36 */ |
|
37 |
|
38 #ifndef __GST_AUDIO_SRC_H__ |
|
39 #define __GST_AUDIO_SRC_H__ |
|
40 |
|
41 #include <gst/gst.h> |
|
42 #include <gst/audio/gstbaseaudiosrc.h> |
|
43 |
|
44 G_BEGIN_DECLS |
|
45 |
|
46 #define GST_TYPE_AUDIO_SRC (gst_audio_src_get_type()) |
|
47 #define GST_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SRC,GstAudioSrc)) |
|
48 #define GST_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SRC,GstAudioSrcClass)) |
|
49 #define GST_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SRC,GstAudioSrcClass)) |
|
50 #define GST_IS_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SRC)) |
|
51 #define GST_IS_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SRC)) |
|
52 |
|
53 typedef struct _GstAudioSrc GstAudioSrc; |
|
54 typedef struct _GstAudioSrcClass GstAudioSrcClass; |
|
55 |
|
56 struct _GstAudioSrc { |
|
57 GstBaseAudioSrc element; |
|
58 |
|
59 /*< private >*/ /* with LOCK */ |
|
60 GThread *thread; |
|
61 |
|
62 /*< private >*/ |
|
63 gpointer _gst_reserved[GST_PADDING]; |
|
64 }; |
|
65 |
|
66 struct _GstAudioSrcClass { |
|
67 GstBaseAudioSrcClass parent_class; |
|
68 |
|
69 /* vtable */ |
|
70 |
|
71 /* open the device with given specs */ |
|
72 gboolean (*open) (GstAudioSrc *src); |
|
73 /* prepare resources and state to operate with the given specs */ |
|
74 gboolean (*prepare) (GstAudioSrc *src, GstRingBufferSpec *spec); |
|
75 /* undo anything that was done in prepare() */ |
|
76 gboolean (*unprepare) (GstAudioSrc *src); |
|
77 /* close the device */ |
|
78 gboolean (*close) (GstAudioSrc *src); |
|
79 /* read samples from the device */ |
|
80 guint (*read) (GstAudioSrc *src, gpointer data, guint length); |
|
81 /* get number of samples queued in the device */ |
|
82 guint (*delay) (GstAudioSrc *src); |
|
83 /* reset the audio device, unblock from a write */ |
|
84 void (*reset) (GstAudioSrc *src); |
|
85 |
|
86 /*< private >*/ |
|
87 gpointer _gst_reserved[GST_PADDING]; |
|
88 }; |
|
89 #ifdef __SYMBIAN32__ |
|
90 IMPORT_C |
|
91 #endif |
|
92 |
|
93 |
|
94 GType gst_audio_src_get_type(void); |
|
95 |
|
96 G_END_DECLS |
|
97 |
|
98 #endif /* __GST_AUDIO_SRC_H__ */ |