Initialize Tizen 2.3
[framework/multimedia/gst-plugins-base0.10.git] / gst-libs / gst / audio / gstaudiosrc.h
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 #ifndef __GST_AUDIO_SRC_H__
24 #define __GST_AUDIO_SRC_H__
25
26 #include <gst/gst.h>
27 #include <gst/audio/gstbaseaudiosrc.h>
28
29 G_BEGIN_DECLS
30
31 #define GST_TYPE_AUDIO_SRC              (gst_audio_src_get_type())
32 #define GST_AUDIO_SRC(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SRC,GstAudioSrc))
33 #define GST_AUDIO_SRC_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
34 #define GST_AUDIO_SRC_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
35 #define GST_IS_AUDIO_SRC(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SRC))
36 #define GST_IS_AUDIO_SRC_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SRC))
37
38 typedef struct _GstAudioSrc GstAudioSrc;
39 typedef struct _GstAudioSrcClass GstAudioSrcClass;
40
41 /**
42  * GstAudioSrc:
43  *
44  * Base class for simple audio sources.
45  */
46 struct _GstAudioSrc {
47   GstBaseAudioSrc        element;
48
49   /*< private >*/ /* with LOCK */
50   GThread   *thread;
51
52   /*< private >*/
53   gpointer _gst_reserved[GST_PADDING];
54 };
55
56 /**
57  * GstAudioSrcClass:
58  * @parent_class: the parent class.
59  * @open: open the device with the specified caps
60  * @prepare: configure device with format
61  * @unprepare: undo the configuration
62  * @close: close the device
63  * @read: read samples to the audio device
64  * @delay: the number of samples queued in the device
65  * @reset: unblock a read to the device and reset.
66  *
67  * #GstAudioSrc class. Override the vmethod to implement
68  * functionality.
69  */
70 struct _GstAudioSrcClass {
71   GstBaseAudioSrcClass parent_class;
72
73   /* vtable */
74
75   /* open the device with given specs */
76   gboolean (*open)      (GstAudioSrc *src);
77   /* prepare resources and state to operate with the given specs */
78   gboolean (*prepare)   (GstAudioSrc *src, GstRingBufferSpec *spec);
79   /* undo anything that was done in prepare() */
80   gboolean (*unprepare) (GstAudioSrc *src);
81   /* close the device */
82   gboolean (*close)     (GstAudioSrc *src);
83   /* read samples from the device */
84   guint    (*read)      (GstAudioSrc *src, gpointer data, guint length);
85   /* get number of samples queued in the device */
86   guint    (*delay)     (GstAudioSrc *src);
87   /* reset the audio device, unblock from a write */
88   void     (*reset)     (GstAudioSrc *src);
89
90   /*< private >*/
91   gpointer _gst_reserved[GST_PADDING];
92 };
93
94 GType gst_audio_src_get_type(void);
95
96 G_END_DECLS
97
98 #endif /* __GST_AUDIO_SRC_H__ */