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 /* a base class for simple audio srcs.
25 * This base class only requires subclasses to implement a set
26 * of simple functions.
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.
34 * All scheduling of samples and timestamps is done in this
38 #ifndef __GST_AUDIO_SRC_H__
39 #define __GST_AUDIO_SRC_H__
42 #include <gst/audio/gstbaseaudiosrc.h>
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(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SRC))
53 typedef struct _GstAudioSrc GstAudioSrc;
54 typedef struct _GstAudioSrcClass GstAudioSrcClass;
57 GstBaseAudioSrc element;
59 /*< private >*/ /* with LOCK */
63 gpointer _gst_reserved[GST_PADDING];
66 struct _GstAudioSrcClass {
67 GstBaseAudioSrcClass parent_class;
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);
87 gpointer _gst_reserved[GST_PADDING];
90 GType gst_audio_src_get_type(void);
94 #endif /* __GST_AUDIO_SRC_H__ */