2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2005 Wim Taymans <wim@fluendo.com>
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.
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.
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.
23 #ifndef __GST_AUDIO_SRC_H__
24 #define __GST_AUDIO_SRC_H__
27 #include <gst/audio/gstbaseaudiosrc.h>
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))
38 typedef struct _GstAudioSrc GstAudioSrc;
39 typedef struct _GstAudioSrcClass GstAudioSrcClass;
43 * @element: parent class
45 * Base class for simple audio sources.
48 GstBaseAudioSrc element;
50 /*< private >*/ /* with LOCK */
54 gpointer _gst_reserved[GST_PADDING];
59 * @parent_class: the parent class.
60 * @open: open the device with the specified caps
61 * @prepare: configure device with format
62 * @unprepare: undo the configuration
63 * @close: close the device
64 * @read: read samples to the audio device
65 * @delay: the number of samples queued in the device
66 * @reset: unblock a read to the device and reset.
68 * #GstAudioSrc class. Override the vmethod to implement
71 struct _GstAudioSrcClass {
72 GstBaseAudioSrcClass parent_class;
76 /* open the device with given specs */
77 gboolean (*open) (GstAudioSrc *src);
78 /* prepare resources and state to operate with the given specs */
79 gboolean (*prepare) (GstAudioSrc *src, GstRingBufferSpec *spec);
80 /* undo anything that was done in prepare() */
81 gboolean (*unprepare) (GstAudioSrc *src);
82 /* close the device */
83 gboolean (*close) (GstAudioSrc *src);
84 /* read samples from the device */
85 guint (*read) (GstAudioSrc *src, gpointer data, guint length);
86 /* get number of samples queued in the device */
87 guint (*delay) (GstAudioSrc *src);
88 /* reset the audio device, unblock from a write */
89 void (*reset) (GstAudioSrc *src);
92 gpointer _gst_reserved[GST_PADDING];
95 GType gst_audio_src_get_type(void);
99 #endif /* __GST_AUDIO_SRC_H__ */