2 * Copyright (C) 2010 Alessandro Decina <alessandro.decina@collabora.co.uk>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef GST_AUDIO_FLINGER_RING_BUFFER_H
21 #define GST_AUDIO_FLINGER_RING_BUFFER_H
25 #include "gstaudiosink.h"
27 GST_DEBUG_CATEGORY_STATIC (gst_audio_sink_debug);
28 #define GST_CAT_DEFAULT gst_audio_sink_debug
30 #define GST_TYPE_AUDIORING_BUFFER \
31 (gst_audioringbuffer_get_type())
32 #define GST_AUDIORING_BUFFER(obj) \
33 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBuffer))
34 #define GST_AUDIORING_BUFFER_CLASS(klass) \
35 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBufferClass))
36 #define GST_AUDIORING_BUFFER_GET_CLASS(obj) \
37 (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIORING_BUFFER, GstAudioRingBufferClass))
38 #define GST_AUDIORING_BUFFER_CAST(obj) \
39 ((GstAudioRingBuffer *)obj)
40 #define GST_IS_AUDIORING_BUFFER(obj) \
41 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIORING_BUFFER))
42 #define GST_IS_AUDIORING_BUFFER_CLASS(klass)\
43 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIORING_BUFFER))
45 typedef struct _GstAudioRingBuffer GstAudioRingBuffer;
46 typedef struct _GstAudioRingBufferClass GstAudioRingBufferClass;
48 #define GST_AUDIORING_BUFFER_GET_COND(buf) (((GstAudioRingBuffer *)buf)->cond)
49 #define GST_AUDIORING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIORING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
50 #define GST_AUDIORING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIORING_BUFFER_GET_COND (buf)))
51 #define GST_AUDIORING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIORING_BUFFER_GET_COND (buf)))
53 struct _GstAudioRingBuffer
63 struct _GstAudioRingBufferClass
65 GstRingBufferClass parent_class;
68 static void gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass);
69 static void gst_audioringbuffer_init (GstAudioRingBuffer * ringbuffer,
70 GstAudioRingBufferClass * klass);
71 static void gst_audioringbuffer_dispose (GObject * object);
72 static void gst_audioringbuffer_finalize (GObject * object);
74 static GstRingBufferClass *ring_parent_class = NULL;
76 static gboolean gst_audioringbuffer_open_device (GstRingBuffer * buf);
77 static gboolean gst_audioringbuffer_close_device (GstRingBuffer * buf);
78 static gboolean gst_audioringbuffer_acquire (GstRingBuffer * buf,
79 GstRingBufferSpec * spec);
80 static gboolean gst_audioringbuffer_release (GstRingBuffer * buf);
81 static gboolean gst_audioringbuffer_start (GstRingBuffer * buf);
82 static gboolean gst_audioringbuffer_pause (GstRingBuffer * buf);
83 static gboolean gst_audioringbuffer_stop (GstRingBuffer * buf);
84 static guint gst_audioringbuffer_delay (GstRingBuffer * buf);
85 static gboolean gst_audioringbuffer_activate (GstRingBuffer * buf,
88 GType gst_audioringbuffer_get_type (void);
90 #endif /* GST_AUDIO_FLINGER_RING_BUFFER_H */