From 6511f36fdb9396999df9aa56468397fa1b186d08 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 11 Nov 2011 11:21:41 +0100 Subject: [PATCH] audio: GstRingBuffer -> GstAudioRingBuffer --- docs/libs/gst-plugins-base-libs-sections.txt | 101 ++++--- docs/libs/gst-plugins-base-libs.types | 2 +- ext/alsa/gstalsasink.c | 6 +- ext/alsa/gstalsasrc.c | 6 +- gst-libs/gst/audio/gstaudioiec61937.c | 4 +- gst-libs/gst/audio/gstaudioiec61937.h | 4 +- gst-libs/gst/audio/gstaudiosink.c | 78 +++--- gst-libs/gst/audio/gstaudiosink.h | 2 +- gst-libs/gst/audio/gstaudiosrc.c | 67 ++--- gst-libs/gst/audio/gstaudiosrc.h | 2 +- gst-libs/gst/audio/gstbaseaudiosink.c | 124 ++++----- gst-libs/gst/audio/gstbaseaudiosink.h | 53 ++-- gst-libs/gst/audio/gstbaseaudiosrc.c | 64 ++--- gst-libs/gst/audio/gstbaseaudiosrc.h | 21 +- gst-libs/gst/audio/gstringbuffer.c | 376 ++++++++++++++------------- gst-libs/gst/audio/gstringbuffer.h | 217 ++++++++-------- 16 files changed, 570 insertions(+), 557 deletions(-) diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt index 6d77f0f..39fa087 100644 --- a/docs/libs/gst-plugins-base-libs-sections.txt +++ b/docs/libs/gst-plugins-base-libs-sections.txt @@ -134,7 +134,6 @@ _GST_AUDIO_FORMAT_NE GstAudioClock GstAudioClockGetTimeFunc gst_audio_clock_new -gst_audio_clock_new_full gst_audio_clock_adjust gst_audio_clock_get_time gst_audio_clock_reset @@ -360,69 +359,69 @@ gst_audio_channel_position_get_type
gstringbuffer gst/audio/gstringbuffer.h -GstRingBuffer -GstRingBufferClass -GstRingBufferSpec -GstRingBufferCallback -GstRingBufferSegState -GstRingBufferState +GstAudioRingBuffer +GstAudioRingBufferClass +GstAudioRingBufferSpec +GstAudioRingBufferCallback +GstAudioRingBufferSegState +GstAudioRingBufferState GstBufferFormatType -GST_RING_BUFFER_BROADCAST -GST_RING_BUFFER_GET_COND -GST_RING_BUFFER_SIGNAL -GST_RING_BUFFER_WAIT +GST_AUDIO_RING_BUFFER_BROADCAST +GST_AUDIO_RING_BUFFER_GET_COND +GST_AUDIO_RING_BUFFER_SIGNAL +GST_AUDIO_RING_BUFFER_WAIT -gst_ring_buffer_set_callback +gst_audio_ring_buffer_set_callback -gst_ring_buffer_acquire -gst_ring_buffer_release -gst_ring_buffer_is_acquired +gst_audio_ring_buffer_acquire +gst_audio_ring_buffer_release +gst_audio_ring_buffer_is_acquired -gst_ring_buffer_activate -gst_ring_buffer_is_active +gst_audio_ring_buffer_activate +gst_audio_ring_buffer_is_active -gst_ring_buffer_start -gst_ring_buffer_pause -gst_ring_buffer_stop +gst_audio_ring_buffer_start +gst_audio_ring_buffer_pause +gst_audio_ring_buffer_stop -gst_ring_buffer_delay -gst_ring_buffer_samples_done -gst_ring_buffer_set_sample -gst_ring_buffer_commit -gst_ring_buffer_commit_full -gst_ring_buffer_convert +gst_audio_ring_buffer_delay +gst_audio_ring_buffer_samples_done +gst_audio_ring_buffer_set_sample +gst_audio_ring_buffer_commit +gst_audio_ring_buffer_commit_full +gst_audio_ring_buffer_convert -gst_ring_buffer_prepare_read -gst_ring_buffer_read -gst_ring_buffer_clear -gst_ring_buffer_clear_all -gst_ring_buffer_advance +gst_audio_ring_buffer_prepare_read +gst_audio_ring_buffer_read +gst_audio_ring_buffer_clear +gst_audio_ring_buffer_clear_all +gst_audio_ring_buffer_advance -gst_ring_buffer_close_device -gst_ring_buffer_open_device -gst_ring_buffer_device_is_open +gst_audio_ring_buffer_close_device +gst_audio_ring_buffer_open_device +gst_audio_ring_buffer_device_is_open -gst_ring_buffer_may_start -gst_ring_buffer_parse_caps -gst_ring_buffer_set_flushing +gst_audio_ring_buffer_may_start +gst_audio_ring_buffer_parse_caps +gst_audio_ring_buffer_set_flushing -GST_TYPE_RING_BUFFER -GST_RING_BUFFER -GST_RING_BUFFER_CLASS -GST_RING_BUFFER_GET_CLASS -GST_IS_RING_BUFFER -GST_IS_RING_BUFFER_CLASS -GST_RING_BUFFER_CAST -gst_ring_buffer_get_type -GST_TYPE_RING_BUFFER_SEG_STATE -gst_ring_buffer_seg_state_get_type -GST_TYPE_RING_BUFFER_STATE -gst_ring_buffer_state_get_type +GST_TYPE_AUDIO_RING_BUFFER +GST_AUDIO_RING_BUFFER +GST_AUDIO_RING_BUFFER_CLASS +GST_AUDIO_RING_BUFFER_GET_CLASS +GST_IS_AUDIO_RING_BUFFER +GST_IS_AUDIO_RING_BUFFER_CLASS +GST_AUDIO_RING_BUFFER_CAST +gst_audio_ring_buffer_get_type +GST_TYPE_AUDIO_RING_BUFFER_SEG_STATE +gst_audio_ring_buffer_seg_state_get_type +GST_TYPE_AUDIO_RING_BUFFER_STATE +gst_audio_ring_buffer_state_get_type -gst_ring_buffer_debug_spec_buff -gst_ring_buffer_debug_spec_caps +gst_audio_ring_buffer_debug_spec_buff +gst_audio_ring_buffer_debug_spec_caps
diff --git a/docs/libs/gst-plugins-base-libs.types b/docs/libs/gst-plugins-base-libs.types index 41e5c62..5ef43da 100644 --- a/docs/libs/gst-plugins-base-libs.types +++ b/docs/libs/gst-plugins-base-libs.types @@ -18,7 +18,7 @@ gst_base_audio_sink_get_type #include gst_base_audio_src_get_type #include -gst_ring_buffer_get_type +gst_audio_ring_buffer_get_type #include diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index 8b1e627..e9295e1 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -83,7 +83,7 @@ static GstCaps *gst_alsasink_getcaps (GstBaseSink * bsink, GstCaps * filter); static gboolean gst_alsasink_open (GstAudioSink * asink); static gboolean gst_alsasink_prepare (GstAudioSink * asink, - GstRingBufferSpec * spec); + GstAudioRingBufferSpec * spec); static gboolean gst_alsasink_unprepare (GstAudioSink * asink); static gboolean gst_alsasink_close (GstAudioSink * asink); static gint gst_alsasink_write (GstAudioSink * asink, gpointer data, @@ -588,7 +588,7 @@ set_sw_params: } static gboolean -alsasink_parse_spec (GstAlsaSink * alsa, GstRingBufferSpec * spec) +alsasink_parse_spec (GstAlsaSink * alsa, GstAudioRingBufferSpec * spec) { /* Initialize our boolean */ alsa->iec958 = FALSE; @@ -754,7 +754,7 @@ open_error: } static gboolean -gst_alsasink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec) +gst_alsasink_prepare (GstAudioSink * asink, GstAudioRingBufferSpec * spec) { GstAlsaSink *alsa; gint err; diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index 5312db0..64e9319 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -81,7 +81,7 @@ static GstCaps *gst_alsasrc_getcaps (GstBaseSrc * bsrc, GstCaps * filter); static gboolean gst_alsasrc_open (GstAudioSrc * asrc); static gboolean gst_alsasrc_prepare (GstAudioSrc * asrc, - GstRingBufferSpec * spec); + GstAudioRingBufferSpec * spec); static gboolean gst_alsasrc_unprepare (GstAudioSrc * asrc); static gboolean gst_alsasrc_close (GstAudioSrc * asrc); static guint gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length); @@ -657,7 +657,7 @@ set_sw_params: } static gboolean -alsasrc_parse_spec (GstAlsaSrc * alsa, GstRingBufferSpec * spec) +alsasrc_parse_spec (GstAlsaSrc * alsa, GstAudioRingBufferSpec * spec) { switch (spec->type) { case GST_BUFTYPE_RAW: @@ -816,7 +816,7 @@ open_error: } static gboolean -gst_alsasrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec) +gst_alsasrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec) { GstAlsaSrc *alsa; gint err; diff --git a/gst-libs/gst/audio/gstaudioiec61937.c b/gst-libs/gst/audio/gstaudioiec61937.c index 0001525..821a6b2 100644 --- a/gst-libs/gst/audio/gstaudioiec61937.c +++ b/gst-libs/gst/audio/gstaudioiec61937.c @@ -72,7 +72,7 @@ caps_get_string_field (const GstCaps * caps, const gchar * field) * Since: 0.10.36 */ guint -gst_audio_iec61937_frame_size (const GstRingBufferSpec * spec) +gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec) { switch (spec->type) { case GST_BUFTYPE_AC3: @@ -149,7 +149,7 @@ gst_audio_iec61937_frame_size (const GstRingBufferSpec * spec) */ gboolean gst_audio_iec61937_payload (const guint8 * src, guint src_n, guint8 * dst, - guint dst_n, const GstRingBufferSpec * spec) + guint dst_n, const GstAudioRingBufferSpec * spec) { guint i, tmp; #if G_BYTE_ORDER == G_BIG_ENDIAN diff --git a/gst-libs/gst/audio/gstaudioiec61937.h b/gst-libs/gst/audio/gstaudioiec61937.h index b33297a..44a88c0 100644 --- a/gst-libs/gst/audio/gstaudioiec61937.h +++ b/gst-libs/gst/audio/gstaudioiec61937.h @@ -24,8 +24,8 @@ #include -guint gst_audio_iec61937_frame_size (const GstRingBufferSpec * spec); +guint gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec); gboolean gst_audio_iec61937_payload (const guint8 * src, guint src_n, - guint8 * dst, guint dst_n, const GstRingBufferSpec * spec); + guint8 * dst, guint dst_n, const GstAudioRingBufferSpec * spec); #endif /* __GST_AUDIO_IEC61937_H__ */ diff --git a/gst-libs/gst/audio/gstaudiosink.c b/gst-libs/gst/audio/gstaudiosink.c index dbca3dd..7b6fce5 100644 --- a/gst-libs/gst/audio/gstaudiosink.c +++ b/gst-libs/gst/audio/gstaudiosink.c @@ -23,7 +23,7 @@ /** * SECTION:gstaudiosink * @short_description: Simple base class for audio sinks - * @see_also: #GstBaseAudioSink, #GstRingBuffer, #GstAudioSink. + * @see_also: #GstBaseAudioSink, #GstAudioRingBuffer, #GstAudioSink. * * This is the most simple base class for audio sinks that only requires * subclasses to implement a set of simple functions: @@ -62,7 +62,7 @@ * * All scheduling of samples and timestamps is done in this base class * together with #GstBaseAudioSink using a default implementation of a - * #GstRingBuffer that uses threads. + * #GstAudioRingBuffer that uses threads. * * Last reviewed on 2006-09-27 (0.10.12) */ @@ -99,7 +99,7 @@ typedef struct _GstAudioSinkRingBufferClass GstAudioSinkRingBufferClass; struct _GstAudioSinkRingBuffer { - GstRingBuffer object; + GstAudioRingBuffer object; gboolean running; gint queuedseg; @@ -109,7 +109,7 @@ struct _GstAudioSinkRingBuffer struct _GstAudioSinkRingBufferClass { - GstRingBufferClass parent_class; + GstAudioRingBufferClass parent_class; }; static void gst_audio_sink_ring_buffer_class_init (GstAudioSinkRingBufferClass * @@ -119,18 +119,20 @@ static void gst_audio_sink_ring_buffer_init (GstAudioSinkRingBuffer * static void gst_audio_sink_ring_buffer_dispose (GObject * object); static void gst_audio_sink_ring_buffer_finalize (GObject * object); -static GstRingBufferClass *ring_parent_class = NULL; - -static gboolean gst_audio_sink_ring_buffer_open_device (GstRingBuffer * buf); -static gboolean gst_audio_sink_ring_buffer_close_device (GstRingBuffer * buf); -static gboolean gst_audio_sink_ring_buffer_acquire (GstRingBuffer * buf, - GstRingBufferSpec * spec); -static gboolean gst_audio_sink_ring_buffer_release (GstRingBuffer * buf); -static gboolean gst_audio_sink_ring_buffer_start (GstRingBuffer * buf); -static gboolean gst_audio_sink_ring_buffer_pause (GstRingBuffer * buf); -static gboolean gst_audio_sink_ring_buffer_stop (GstRingBuffer * buf); -static guint gst_audio_sink_ring_buffer_delay (GstRingBuffer * buf); -static gboolean gst_audio_sink_ring_buffer_activate (GstRingBuffer * buf, +static GstAudioRingBufferClass *ring_parent_class = NULL; + +static gboolean gst_audio_sink_ring_buffer_open_device (GstAudioRingBuffer * + buf); +static gboolean gst_audio_sink_ring_buffer_close_device (GstAudioRingBuffer * + buf); +static gboolean gst_audio_sink_ring_buffer_acquire (GstAudioRingBuffer * buf, + GstAudioRingBufferSpec * spec); +static gboolean gst_audio_sink_ring_buffer_release (GstAudioRingBuffer * buf); +static gboolean gst_audio_sink_ring_buffer_start (GstAudioRingBuffer * buf); +static gboolean gst_audio_sink_ring_buffer_pause (GstAudioRingBuffer * buf); +static gboolean gst_audio_sink_ring_buffer_stop (GstAudioRingBuffer * buf); +static guint gst_audio_sink_ring_buffer_delay (GstAudioRingBuffer * buf); +static gboolean gst_audio_sink_ring_buffer_activate (GstAudioRingBuffer * buf, gboolean active); /* ringbuffer abstract base class */ @@ -154,8 +156,8 @@ gst_audio_sink_ring_buffer_get_type (void) }; ringbuffer_type = - g_type_register_static (GST_TYPE_RING_BUFFER, "GstAudioSinkRingBuffer", - &ringbuffer_info, 0); + g_type_register_static (GST_TYPE_AUDIO_RING_BUFFER, + "GstAudioSinkRingBuffer", &ringbuffer_info, 0); } return ringbuffer_type; } @@ -164,10 +166,10 @@ static void gst_audio_sink_ring_buffer_class_init (GstAudioSinkRingBufferClass * klass) { GObjectClass *gobject_class; - GstRingBufferClass *gstringbuffer_class; + GstAudioRingBufferClass *gstringbuffer_class; gobject_class = (GObjectClass *) klass; - gstringbuffer_class = (GstRingBufferClass *) klass; + gstringbuffer_class = (GstAudioRingBufferClass *) klass; ring_parent_class = g_type_class_peek_parent (klass); @@ -205,7 +207,7 @@ typedef gint (*WriteFunc) (GstAudioSink * sink, gpointer data, guint length); * The start/stop methods control the thread. */ static void -audioringbuffer_thread_func (GstRingBuffer * buf) +audioringbuffer_thread_func (GstAudioRingBuffer * buf) { GstAudioSink *sink; GstAudioSinkClass *csink; @@ -242,7 +244,7 @@ audioringbuffer_thread_func (GstRingBuffer * buf) gint readseg; /* buffer must be started */ - if (gst_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) { + if (gst_audio_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) { gint written; left = len; @@ -263,16 +265,16 @@ audioringbuffer_thread_func (GstRingBuffer * buf) } while (left > 0); /* clear written samples */ - gst_ring_buffer_clear (buf, readseg); + gst_audio_ring_buffer_clear (buf, readseg); /* we wrote one segment */ - gst_ring_buffer_advance (buf, 1); + gst_audio_ring_buffer_advance (buf, 1); } else { GST_OBJECT_LOCK (abuf); if (!abuf->running) goto stop_running; if (G_UNLIKELY (g_atomic_int_get (&buf->state) == - GST_RING_BUFFER_STATE_STARTED)) { + GST_AUDIO_RING_BUFFER_STATE_STARTED)) { GST_OBJECT_UNLOCK (abuf); continue; } @@ -338,7 +340,7 @@ gst_audio_sink_ring_buffer_finalize (GObject * object) } static gboolean -gst_audio_sink_ring_buffer_open_device (GstRingBuffer * buf) +gst_audio_sink_ring_buffer_open_device (GstAudioRingBuffer * buf) { GstAudioSink *sink; GstAudioSinkClass *csink; @@ -363,7 +365,7 @@ could_not_open: } static gboolean -gst_audio_sink_ring_buffer_close_device (GstRingBuffer * buf) +gst_audio_sink_ring_buffer_close_device (GstAudioRingBuffer * buf) { GstAudioSink *sink; GstAudioSinkClass *csink; @@ -388,8 +390,8 @@ could_not_close: } static gboolean -gst_audio_sink_ring_buffer_acquire (GstRingBuffer * buf, - GstRingBufferSpec * spec) +gst_audio_sink_ring_buffer_acquire (GstAudioRingBuffer * buf, + GstAudioRingBufferSpec * spec) { GstAudioSink *sink; GstAudioSinkClass *csink; @@ -420,7 +422,7 @@ could_not_prepare: } static gboolean -gst_audio_sink_ring_buffer_activate (GstRingBuffer * buf, gboolean active) +gst_audio_sink_ring_buffer_activate (GstAudioRingBuffer * buf, gboolean active) { GstAudioSink *sink; GstAudioSinkRingBuffer *abuf; @@ -470,7 +472,7 @@ thread_failed: /* function is called with LOCK */ static gboolean -gst_audio_sink_ring_buffer_release (GstRingBuffer * buf) +gst_audio_sink_ring_buffer_release (GstAudioRingBuffer * buf) { GstAudioSink *sink; GstAudioSinkClass *csink; @@ -501,7 +503,7 @@ could_not_unprepare: } static gboolean -gst_audio_sink_ring_buffer_start (GstRingBuffer * buf) +gst_audio_sink_ring_buffer_start (GstAudioRingBuffer * buf) { GstAudioSink *sink; @@ -514,7 +516,7 @@ gst_audio_sink_ring_buffer_start (GstRingBuffer * buf) } static gboolean -gst_audio_sink_ring_buffer_pause (GstRingBuffer * buf) +gst_audio_sink_ring_buffer_pause (GstAudioRingBuffer * buf) { GstAudioSink *sink; GstAudioSinkClass *csink; @@ -533,7 +535,7 @@ gst_audio_sink_ring_buffer_pause (GstRingBuffer * buf) } static gboolean -gst_audio_sink_ring_buffer_stop (GstRingBuffer * buf) +gst_audio_sink_ring_buffer_stop (GstAudioRingBuffer * buf) { GstAudioSink *sink; GstAudioSinkClass *csink; @@ -559,7 +561,7 @@ gst_audio_sink_ring_buffer_stop (GstRingBuffer * buf) } static guint -gst_audio_sink_ring_buffer_delay (GstRingBuffer * buf) +gst_audio_sink_ring_buffer_delay (GstAudioRingBuffer * buf) { GstAudioSink *sink; GstAudioSinkClass *csink; @@ -592,7 +594,7 @@ enum G_DEFINE_TYPE_WITH_CODE (GstAudioSink, gst_audio_sink, GST_TYPE_BASE_AUDIO_SINK, _do_init); -static GstRingBuffer *gst_audio_sink_create_ringbuffer (GstBaseAudioSink * +static GstAudioRingBuffer *gst_audio_sink_create_ringbuffer (GstBaseAudioSink * sink); static void @@ -613,10 +615,10 @@ gst_audio_sink_init (GstAudioSink * audiosink) { } -static GstRingBuffer * +static GstAudioRingBuffer * gst_audio_sink_create_ringbuffer (GstBaseAudioSink * sink) { - GstRingBuffer *buffer; + GstAudioRingBuffer *buffer; GST_DEBUG_OBJECT (sink, "creating ringbuffer"); buffer = g_object_new (GST_TYPE_AUDIO_SINK_RING_BUFFER, NULL); diff --git a/gst-libs/gst/audio/gstaudiosink.h b/gst-libs/gst/audio/gstaudiosink.h index 71fe5e4..b513b5a 100644 --- a/gst-libs/gst/audio/gstaudiosink.h +++ b/gst-libs/gst/audio/gstaudiosink.h @@ -77,7 +77,7 @@ struct _GstAudioSinkClass { /* open the device with given specs */ gboolean (*open) (GstAudioSink *sink); /* prepare resources and state to operate with the given specs */ - gboolean (*prepare) (GstAudioSink *sink, GstRingBufferSpec *spec); + gboolean (*prepare) (GstAudioSink *sink, GstAudioRingBufferSpec *spec); /* undo anything that was done in prepare() */ gboolean (*unprepare) (GstAudioSink *sink); /* close the device */ diff --git a/gst-libs/gst/audio/gstaudiosrc.c b/gst-libs/gst/audio/gstaudiosrc.c index 34ee7dd..6806f7f 100644 --- a/gst-libs/gst/audio/gstaudiosrc.c +++ b/gst-libs/gst/audio/gstaudiosrc.c @@ -23,7 +23,7 @@ /** * SECTION:gstaudiosrc * @short_description: Simple base class for audio sources - * @see_also: #GstBaseAudioSrc, #GstRingBuffer, #GstAudioSrc. + * @see_also: #GstBaseAudioSrc, #GstAudioRingBuffer, #GstAudioSrc. * * This is the most simple base class for audio sources that only requires * subclasses to implement a set of simple functions: @@ -62,7 +62,7 @@ * * All scheduling of samples and timestamps is done in this base class * together with #GstBaseAudioSrc using a default implementation of a - * #GstRingBuffer that uses threads. + * #GstAudioRingBuffer that uses threads. * * Last reviewed on 2006-09-27 (0.10.12) */ @@ -97,7 +97,7 @@ typedef struct _GstAudioSrcRingBufferClass GstAudioSrcRingBufferClass; struct _GstAudioSrcRingBuffer { - GstRingBuffer object; + GstAudioRingBuffer object; gboolean running; gint queuedseg; @@ -107,7 +107,7 @@ struct _GstAudioSrcRingBuffer struct _GstAudioSrcRingBufferClass { - GstRingBufferClass parent_class; + GstAudioRingBufferClass parent_class; }; static void gst_audio_src_ring_buffer_class_init (GstAudioSrcRingBufferClass * @@ -117,16 +117,18 @@ static void gst_audio_src_ring_buffer_init (GstAudioSrcRingBuffer * ringbuffer, static void gst_audio_src_ring_buffer_dispose (GObject * object); static void gst_audio_src_ring_buffer_finalize (GObject * object); -static GstRingBufferClass *ring_parent_class = NULL; +static GstAudioRingBufferClass *ring_parent_class = NULL; -static gboolean gst_audio_src_ring_buffer_open_device (GstRingBuffer * buf); -static gboolean gst_audio_src_ring_buffer_close_device (GstRingBuffer * buf); -static gboolean gst_audio_src_ring_buffer_acquire (GstRingBuffer * buf, - GstRingBufferSpec * spec); -static gboolean gst_audio_src_ring_buffer_release (GstRingBuffer * buf); -static gboolean gst_audio_src_ring_buffer_start (GstRingBuffer * buf); -static gboolean gst_audio_src_ring_buffer_stop (GstRingBuffer * buf); -static guint gst_audio_src_ring_buffer_delay (GstRingBuffer * buf); +static gboolean gst_audio_src_ring_buffer_open_device (GstAudioRingBuffer * + buf); +static gboolean gst_audio_src_ring_buffer_close_device (GstAudioRingBuffer * + buf); +static gboolean gst_audio_src_ring_buffer_acquire (GstAudioRingBuffer * buf, + GstAudioRingBufferSpec * spec); +static gboolean gst_audio_src_ring_buffer_release (GstAudioRingBuffer * buf); +static gboolean gst_audio_src_ring_buffer_start (GstAudioRingBuffer * buf); +static gboolean gst_audio_src_ring_buffer_stop (GstAudioRingBuffer * buf); +static guint gst_audio_src_ring_buffer_delay (GstAudioRingBuffer * buf); /* ringbuffer abstract base class */ static GType @@ -149,8 +151,8 @@ gst_audio_src_ring_buffer_get_type (void) }; ringbuffer_type = - g_type_register_static (GST_TYPE_RING_BUFFER, "GstAudioSrcRingBuffer", - &ringbuffer_info, 0); + g_type_register_static (GST_TYPE_AUDIO_RING_BUFFER, + "GstAudioSrcRingBuffer", &ringbuffer_info, 0); } return ringbuffer_type; } @@ -159,10 +161,10 @@ static void gst_audio_src_ring_buffer_class_init (GstAudioSrcRingBufferClass * klass) { GObjectClass *gobject_class; - GstRingBufferClass *gstringbuffer_class; + GstAudioRingBufferClass *gstringbuffer_class; gobject_class = (GObjectClass *) klass; - gstringbuffer_class = (GstRingBufferClass *) klass; + gstringbuffer_class = (GstAudioRingBufferClass *) klass; ring_parent_class = g_type_class_peek_parent (klass); @@ -196,7 +198,7 @@ typedef guint (*ReadFunc) (GstAudioSrc * src, gpointer data, guint length); * The start/stop methods control the thread. */ static void -audioringbuffer_thread_func (GstRingBuffer * buf) +audioringbuffer_thread_func (GstAudioRingBuffer * buf) { GstAudioSrc *src; GstAudioSrcClass *csrc; @@ -228,7 +230,7 @@ audioringbuffer_thread_func (GstRingBuffer * buf) guint8 *readptr; gint readseg; - if (gst_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) { + if (gst_audio_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) { gint read; left = len; @@ -247,13 +249,13 @@ audioringbuffer_thread_func (GstRingBuffer * buf) } while (left > 0); /* we read one segment */ - gst_ring_buffer_advance (buf, 1); + gst_audio_ring_buffer_advance (buf, 1); } else { GST_OBJECT_LOCK (abuf); if (!abuf->running) goto stop_running; if (G_UNLIKELY (g_atomic_int_get (&buf->state) == - GST_RING_BUFFER_STATE_STARTED)) { + GST_AUDIO_RING_BUFFER_STATE_STARTED)) { GST_OBJECT_UNLOCK (abuf); continue; } @@ -322,7 +324,7 @@ gst_audio_src_ring_buffer_finalize (GObject * object) } static gboolean -gst_audio_src_ring_buffer_open_device (GstRingBuffer * buf) +gst_audio_src_ring_buffer_open_device (GstAudioRingBuffer * buf) { GstAudioSrc *src; GstAudioSrcClass *csrc; @@ -346,7 +348,7 @@ could_not_open: } static gboolean -gst_audio_src_ring_buffer_close_device (GstRingBuffer * buf) +gst_audio_src_ring_buffer_close_device (GstAudioRingBuffer * buf) { GstAudioSrc *src; GstAudioSrcClass *csrc; @@ -370,8 +372,8 @@ could_not_open: } static gboolean -gst_audio_src_ring_buffer_acquire (GstRingBuffer * buf, - GstRingBufferSpec * spec) +gst_audio_src_ring_buffer_acquire (GstAudioRingBuffer * buf, + GstAudioRingBufferSpec * spec) { GstAudioSrc *src; GstAudioSrcClass *csrc; @@ -408,7 +410,7 @@ could_not_open: /* function is called with LOCK */ static gboolean -gst_audio_src_ring_buffer_release (GstRingBuffer * buf) +gst_audio_src_ring_buffer_release (GstAudioRingBuffer * buf) { GstAudioSrc *src; GstAudioSrcClass *csrc; @@ -439,7 +441,7 @@ gst_audio_src_ring_buffer_release (GstRingBuffer * buf) } static gboolean -gst_audio_src_ring_buffer_start (GstRingBuffer * buf) +gst_audio_src_ring_buffer_start (GstAudioRingBuffer * buf) { GST_DEBUG ("start, sending signal"); GST_AUDIO_SRC_RING_BUFFER_SIGNAL (buf); @@ -448,7 +450,7 @@ gst_audio_src_ring_buffer_start (GstRingBuffer * buf) } static gboolean -gst_audio_src_ring_buffer_stop (GstRingBuffer * buf) +gst_audio_src_ring_buffer_stop (GstAudioRingBuffer * buf) { GstAudioSrc *src; GstAudioSrcClass *csrc; @@ -472,7 +474,7 @@ gst_audio_src_ring_buffer_stop (GstRingBuffer * buf) } static guint -gst_audio_src_ring_buffer_delay (GstRingBuffer * buf) +gst_audio_src_ring_buffer_delay (GstAudioRingBuffer * buf) { GstAudioSrc *src; GstAudioSrcClass *csrc; @@ -505,7 +507,8 @@ enum G_DEFINE_TYPE_WITH_CODE (GstAudioSrc, gst_audio_src, GST_TYPE_BASE_AUDIO_SRC, _do_init); -static GstRingBuffer *gst_audio_src_create_ringbuffer (GstBaseAudioSrc * src); +static GstAudioRingBuffer *gst_audio_src_create_ringbuffer (GstBaseAudioSrc * + src); static void gst_audio_src_class_init (GstAudioSrcClass * klass) @@ -525,10 +528,10 @@ gst_audio_src_init (GstAudioSrc * audiosrc) { } -static GstRingBuffer * +static GstAudioRingBuffer * gst_audio_src_create_ringbuffer (GstBaseAudioSrc * src) { - GstRingBuffer *buffer; + GstAudioRingBuffer *buffer; GST_DEBUG ("creating ringbuffer"); buffer = g_object_new (GST_TYPE_AUDIO_SRC_RING_BUFFER, NULL); diff --git a/gst-libs/gst/audio/gstaudiosrc.h b/gst-libs/gst/audio/gstaudiosrc.h index 3caa98e..8e21ee1 100644 --- a/gst-libs/gst/audio/gstaudiosrc.h +++ b/gst-libs/gst/audio/gstaudiosrc.h @@ -75,7 +75,7 @@ struct _GstAudioSrcClass { /* open the device with given specs */ gboolean (*open) (GstAudioSrc *src); /* prepare resources and state to operate with the given specs */ - gboolean (*prepare) (GstAudioSrc *src, GstRingBufferSpec *spec); + gboolean (*prepare) (GstAudioSrc *src, GstAudioRingBufferSpec *spec); /* undo anything that was done in prepare() */ gboolean (*unprepare) (GstAudioSrc *src); /* close the device */ diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c b/gst-libs/gst/audio/gstbaseaudiosink.c index 29e34f3..e0b9c96 100644 --- a/gst-libs/gst/audio/gstbaseaudiosink.c +++ b/gst-libs/gst/audio/gstbaseaudiosink.c @@ -23,7 +23,7 @@ /** * SECTION:gstbaseaudiosink * @short_description: Base class for audio sinks - * @see_also: #GstAudioSink, #GstRingBuffer. + * @see_also: #GstAudioSink, #GstAudioRingBuffer. * * This is the base class for audio sinks. Subclasses need to implement the * ::create_ringbuffer vmethod. This base class will then take care of @@ -165,8 +165,8 @@ static gboolean gst_base_audio_sink_query (GstElement * element, GstQuery * static GstClock *gst_base_audio_sink_provide_clock (GstElement * elem); static GstClockTime gst_base_audio_sink_get_time (GstClock * clock, GstBaseAudioSink * sink); -static void gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, - guint len, gpointer user_data); +static void gst_base_audio_sink_callback (GstAudioRingBuffer * rbuf, + guint8 * data, guint len, gpointer user_data); static GstFlowReturn gst_base_audio_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer); @@ -292,7 +292,7 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass) /* ref class from a thread-safe context to work around missing bit of * thread-safety in GObject */ g_type_class_ref (GST_TYPE_AUDIO_CLOCK); - g_type_class_ref (GST_TYPE_RING_BUFFER); + g_type_class_ref (GST_TYPE_AUDIO_RING_BUFFER); } @@ -356,7 +356,7 @@ gst_base_audio_sink_provide_clock (GstElement * elem) if (sink->ringbuffer == NULL) goto wrong_state; - if (!gst_ring_buffer_is_acquired (sink->ringbuffer)) + if (!gst_audio_ring_buffer_is_acquired (sink->ringbuffer)) goto wrong_state; GST_OBJECT_LOCK (sink); @@ -400,8 +400,9 @@ gst_base_audio_sink_query_pad (GstBaseSink * bsink, GstQuery * query) if (basesink->ringbuffer) { gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, NULL); - res = gst_ring_buffer_convert (basesink->ringbuffer, src_fmt, src_val, - dest_fmt, &dest_val); + res = + gst_audio_ring_buffer_convert (basesink->ringbuffer, src_fmt, + src_val, dest_fmt, &dest_val); if (res) { gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); } @@ -439,7 +440,7 @@ gst_base_audio_sink_query (GstElement * element, GstQuery * query) /* we and upstream are both live, adjust the min_latency */ if (live && us_live) { - GstRingBufferSpec *spec; + GstAudioRingBufferSpec *spec; GST_OBJECT_LOCK (basesink); if (!basesink->ringbuffer || !basesink->ringbuffer->spec.info.rate) { @@ -492,8 +493,9 @@ gst_base_audio_sink_query (GstElement * element, GstQuery * query) if (basesink->ringbuffer) { gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, NULL); - res = gst_ring_buffer_convert (basesink->ringbuffer, src_fmt, src_val, - dest_fmt, &dest_val); + res = + gst_audio_ring_buffer_convert (basesink->ringbuffer, src_fmt, + src_val, dest_fmt, &dest_val); if (res) { gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); } @@ -521,11 +523,11 @@ gst_base_audio_sink_get_time (GstClock * clock, GstBaseAudioSink * sink) return GST_CLOCK_TIME_NONE; /* our processed samples are always increasing */ - raw = samples = gst_ring_buffer_samples_done (sink->ringbuffer); + raw = samples = gst_audio_ring_buffer_samples_done (sink->ringbuffer); /* the number of samples not yet processed, this is still queued in the * device (not played for playback). */ - delay = gst_ring_buffer_delay (sink->ringbuffer); + delay = gst_audio_ring_buffer_delay (sink->ringbuffer); if (G_LIKELY (samples >= delay)) samples -= delay; @@ -851,7 +853,7 @@ static gboolean gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) { GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink); - GstRingBufferSpec *spec; + GstAudioRingBufferSpec *spec; GstClockTime now; GstClockTime crate_num, crate_denom; @@ -871,9 +873,9 @@ gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) GST_DEBUG_OBJECT (sink, "time was %" GST_TIME_FORMAT, GST_TIME_ARGS (now)); /* release old ringbuffer */ - gst_ring_buffer_pause (sink->ringbuffer); - gst_ring_buffer_activate (sink->ringbuffer, FALSE); - gst_ring_buffer_release (sink->ringbuffer); + gst_audio_ring_buffer_pause (sink->ringbuffer); + gst_audio_ring_buffer_activate (sink->ringbuffer, FALSE); + gst_audio_ring_buffer_release (sink->ringbuffer); GST_DEBUG_OBJECT (sink, "parse caps"); @@ -881,18 +883,18 @@ gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) spec->latency_time = sink->latency_time; /* parse new caps */ - if (!gst_ring_buffer_parse_caps (spec, caps)) + if (!gst_audio_ring_buffer_parse_caps (spec, caps)) goto parse_error; - gst_ring_buffer_debug_spec_buff (spec); + gst_audio_ring_buffer_debug_spec_buff (spec); GST_DEBUG_OBJECT (sink, "acquire ringbuffer"); - if (!gst_ring_buffer_acquire (sink->ringbuffer, spec)) + if (!gst_audio_ring_buffer_acquire (sink->ringbuffer, spec)) goto acquire_error; if (bsink->pad_mode == GST_PAD_ACTIVATE_PUSH) { GST_DEBUG_OBJECT (sink, "activate ringbuffer"); - gst_ring_buffer_activate (sink->ringbuffer, TRUE); + gst_audio_ring_buffer_activate (sink->ringbuffer, TRUE); } /* due to possible changes in the spec file we should recalibrate the clock */ @@ -909,7 +911,7 @@ gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) spec->buffer_time = spec->segtotal * spec->latency_time; - gst_ring_buffer_debug_spec_buff (spec); + gst_audio_ring_buffer_debug_spec_buff (spec); return TRUE; @@ -982,8 +984,8 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink) /* need to start playback before we can drain, but only when * we have successfully negotiated a format and thus acquired the * ringbuffer. */ - if (gst_ring_buffer_is_acquired (sink->ringbuffer)) - gst_ring_buffer_start (sink->ringbuffer); + if (gst_audio_ring_buffer_is_acquired (sink->ringbuffer)) + gst_audio_ring_buffer_start (sink->ringbuffer); if (sink->priv->eos_time != -1) { GST_DEBUG_OBJECT (sink, @@ -1008,7 +1010,7 @@ gst_base_audio_sink_event (GstBaseSink * bsink, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_FLUSH_START: if (sink->ringbuffer) - gst_ring_buffer_set_flushing (sink->ringbuffer, TRUE); + gst_audio_ring_buffer_set_flushing (sink->ringbuffer, TRUE); break; case GST_EVENT_FLUSH_STOP: /* always resync on sample after a flush */ @@ -1017,7 +1019,7 @@ gst_base_audio_sink_event (GstBaseSink * bsink, GstEvent * event) sink->priv->eos_time = -1; sink->priv->discont_time = -1; if (sink->ringbuffer) - gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE); + gst_audio_ring_buffer_set_flushing (sink->ringbuffer, FALSE); break; case GST_EVENT_EOS: /* now wait till we played everything */ @@ -1034,7 +1036,7 @@ gst_base_audio_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer) { GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink); - if (!gst_ring_buffer_is_acquired (sink->ringbuffer)) + if (!gst_audio_ring_buffer_is_acquired (sink->ringbuffer)) goto wrong_state; /* we don't really do anything when prerolling. We could make a @@ -1398,7 +1400,7 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj) } /* start ringbuffer so we can start slaving right away when we need to */ - gst_ring_buffer_start (sink->ringbuffer); + gst_audio_ring_buffer_start (sink->ringbuffer); GST_DEBUG_OBJECT (sink, "internal time: %" GST_TIME_FORMAT " external time: %" GST_TIME_FORMAT, @@ -1453,7 +1455,7 @@ static gint64 gst_base_audio_sink_get_alignment (GstBaseAudioSink * sink, GstClockTime sample_offset) { - GstRingBuffer *ringbuf = sink->ringbuffer; + GstAudioRingBuffer *ringbuf = sink->ringbuffer; gint64 align; gint64 sample_diff; gint64 max_sample_diff; @@ -1535,7 +1537,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) GstClockTimeDiff sync_offset, ts_offset; GstBaseAudioSinkClass *bclass; GstBaseAudioSink *sink; - GstRingBuffer *ringbuf; + GstAudioRingBuffer *ringbuf; gint64 diff, align; guint64 ctime, cstop; gsize offset; @@ -1559,7 +1561,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) ringbuf = sink->ringbuffer; /* can't do anything when we don't have the device */ - if (G_UNLIKELY (!gst_ring_buffer_is_acquired (ringbuf))) + if (G_UNLIKELY (!gst_audio_ring_buffer_is_acquired (ringbuf))) goto wrong_state; /* Wait for upstream latency before starting the ringbuffer, we do this so @@ -1830,8 +1832,8 @@ no_sync: data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ); do { written = - gst_ring_buffer_commit_full (ringbuf, &sample_offset, data + offset, - samples, out_samples, &accum); + gst_audio_ring_buffer_commit_full (ringbuf, &sample_offset, + data + offset, samples, out_samples, &accum); GST_DEBUG_OBJECT (sink, "wrote %u of %u", written, samples); /* if we wrote all, we're done */ @@ -1870,7 +1872,7 @@ no_sync: if (GST_CLOCK_TIME_IS_VALID (stop) && stop >= bsink->segment.stop) { GST_DEBUG_OBJECT (sink, "start playback because we are at the end of segment"); - gst_ring_buffer_start (ringbuf); + gst_audio_ring_buffer_start (ringbuf); } ret = GST_FLOW_OK; @@ -1936,17 +1938,17 @@ sync_latency_failed: * gst_base_audio_sink_create_ringbuffer: * @sink: a #GstBaseAudioSink. * - * Create and return the #GstRingBuffer for @sink. This function will call the + * Create and return the #GstAudioRingBuffer for @sink. This function will call the * ::create_ringbuffer vmethod and will set @sink as the parent of the returned * buffer (see gst_object_set_parent()). * * Returns: The new ringbuffer of @sink. */ -GstRingBuffer * +GstAudioRingBuffer * gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink * sink) { GstBaseAudioSinkClass *bclass; - GstRingBuffer *buffer = NULL; + GstAudioRingBuffer *buffer = NULL; bclass = GST_BASE_AUDIO_SINK_GET_CLASS (sink); if (bclass->create_ringbuffer) @@ -1959,8 +1961,8 @@ gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink * sink) } static void -gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len, - gpointer user_data) +gst_base_audio_sink_callback (GstAudioRingBuffer * rbuf, guint8 * data, + guint len, gpointer user_data) { GstBaseSink *basesink; GstBaseAudioSink *sink; @@ -2019,7 +2021,7 @@ error: { GST_WARNING_OBJECT (basesink, "Got flow '%s' but can't return it: %d", gst_flow_get_name (ret), ret); - gst_ring_buffer_pause (rbuf); + gst_audio_ring_buffer_pause (rbuf); GST_PAD_STREAM_UNLOCK (basesink->sinkpad); return; } @@ -2030,7 +2032,7 @@ eos: * set segment.stop and segment.duration to the last sample or so */ GST_DEBUG_OBJECT (sink, "EOS"); gst_base_audio_sink_drain (sink); - gst_ring_buffer_pause (rbuf); + gst_audio_ring_buffer_pause (rbuf); gst_element_post_message (GST_ELEMENT_CAST (sink), gst_message_new_eos (GST_OBJECT_CAST (sink))); GST_PAD_STREAM_UNLOCK (basesink->sinkpad); @@ -2038,7 +2040,7 @@ eos: flushing: { GST_DEBUG_OBJECT (sink, "we are flushing"); - gst_ring_buffer_pause (rbuf); + gst_audio_ring_buffer_pause (rbuf); GST_BASE_SINK_PREROLL_UNLOCK (basesink); GST_PAD_STREAM_UNLOCK (basesink->sinkpad); return; @@ -2046,7 +2048,7 @@ flushing: preroll_error: { GST_DEBUG_OBJECT (sink, "error %s", gst_flow_get_name (ret)); - gst_ring_buffer_pause (rbuf); + gst_audio_ring_buffer_pause (rbuf); GST_BASE_SINK_PREROLL_UNLOCK (basesink); GST_PAD_STREAM_UNLOCK (basesink->sinkpad); return; @@ -2062,14 +2064,14 @@ gst_base_audio_sink_activate_pull (GstBaseSink * basesink, gboolean active) if (active) { GST_DEBUG_OBJECT (basesink, "activating pull"); - gst_ring_buffer_set_callback (sink->ringbuffer, + gst_audio_ring_buffer_set_callback (sink->ringbuffer, gst_base_audio_sink_callback, sink); - ret = gst_ring_buffer_activate (sink->ringbuffer, TRUE); + ret = gst_audio_ring_buffer_activate (sink->ringbuffer, TRUE); } else { GST_DEBUG_OBJECT (basesink, "deactivating pull"); - gst_ring_buffer_set_callback (sink->ringbuffer, NULL, NULL); - ret = gst_ring_buffer_activate (sink->ringbuffer, FALSE); + gst_audio_ring_buffer_set_callback (sink->ringbuffer, NULL, NULL); + ret = gst_audio_ring_buffer_activate (sink->ringbuffer, FALSE); } return ret; @@ -2086,10 +2088,10 @@ gst_base_audio_sink_async_play (GstBaseSink * basesink) GST_DEBUG_OBJECT (sink, "ringbuffer may start now"); sink->priv->sync_latency = TRUE; - gst_ring_buffer_may_start (sink->ringbuffer, TRUE); + gst_audio_ring_buffer_may_start (sink->ringbuffer, TRUE); if (basesink->pad_mode == GST_PAD_ACTIVATE_PULL) { /* we always start the ringbuffer in pull mode immediatly */ - gst_ring_buffer_start (sink->ringbuffer); + gst_audio_ring_buffer_start (sink->ringbuffer); } return GST_STATE_CHANGE_SUCCESS; @@ -2109,7 +2111,7 @@ gst_base_audio_sink_change_state (GstElement * element, gst_audio_clock_reset (GST_AUDIO_CLOCK (sink->provided_clock), 0); sink->ringbuffer = gst_base_audio_sink_create_ringbuffer (sink); } - if (!gst_ring_buffer_open_device (sink->ringbuffer)) + if (!gst_audio_ring_buffer_open_device (sink->ringbuffer)) goto open_failed; break; case GST_STATE_CHANGE_READY_TO_PAUSED: @@ -2117,8 +2119,8 @@ gst_base_audio_sink_change_state (GstElement * element, sink->priv->last_align = -1; sink->priv->eos_time = -1; sink->priv->discont_time = -1; - gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE); - gst_ring_buffer_may_start (sink->ringbuffer, FALSE); + gst_audio_ring_buffer_set_flushing (sink->ringbuffer, FALSE); + gst_audio_ring_buffer_may_start (sink->ringbuffer, FALSE); /* Only post clock-provide messages if this is the clock that * we've created. If the subclass has overriden it the subclass @@ -2140,20 +2142,20 @@ gst_base_audio_sink_change_state (GstElement * element, eos = GST_BASE_SINK (sink)->eos; GST_OBJECT_UNLOCK (sink); - gst_ring_buffer_may_start (sink->ringbuffer, TRUE); + gst_audio_ring_buffer_may_start (sink->ringbuffer, TRUE); if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_PAD_ACTIVATE_PULL || g_atomic_int_get (&sink->eos_rendering) || eos) { /* we always start the ringbuffer in pull mode immediatly */ /* sync rendering on eos needs running clock, * and others need running clock when finished rendering eos */ - gst_ring_buffer_start (sink->ringbuffer); + gst_audio_ring_buffer_start (sink->ringbuffer); } break; } case GST_STATE_CHANGE_PLAYING_TO_PAUSED: /* ringbuffer cannot start anymore */ - gst_ring_buffer_may_start (sink->ringbuffer, FALSE); - gst_ring_buffer_pause (sink->ringbuffer); + gst_audio_ring_buffer_may_start (sink->ringbuffer, FALSE); + gst_audio_ring_buffer_pause (sink->ringbuffer); GST_OBJECT_LOCK (sink); sink->priv->sync_latency = FALSE; @@ -2172,7 +2174,7 @@ gst_base_audio_sink_change_state (GstElement * element, /* make sure we unblock before calling the parent state change * so it can grab the STREAM_LOCK */ - gst_ring_buffer_set_flushing (sink->ringbuffer, TRUE); + gst_audio_ring_buffer_set_flushing (sink->ringbuffer, TRUE); break; default: break; @@ -2186,17 +2188,17 @@ gst_base_audio_sink_change_state (GstElement * element, gst_clock_set_master (sink->provided_clock, NULL); break; case GST_STATE_CHANGE_PAUSED_TO_READY: - gst_ring_buffer_activate (sink->ringbuffer, FALSE); - gst_ring_buffer_release (sink->ringbuffer); + gst_audio_ring_buffer_activate (sink->ringbuffer, FALSE); + gst_audio_ring_buffer_release (sink->ringbuffer); break; case GST_STATE_CHANGE_READY_TO_NULL: /* we release again here because the aqcuire happens when setting the * caps, which happens before we commit the state to PAUSED and thus the * PAUSED->READY state change (see above, where we release the ringbuffer) * might not be called when we get here. */ - gst_ring_buffer_activate (sink->ringbuffer, FALSE); - gst_ring_buffer_release (sink->ringbuffer); - gst_ring_buffer_close_device (sink->ringbuffer); + gst_audio_ring_buffer_activate (sink->ringbuffer, FALSE); + gst_audio_ring_buffer_release (sink->ringbuffer); + gst_audio_ring_buffer_close_device (sink->ringbuffer); GST_OBJECT_LOCK (sink); gst_object_unparent (GST_OBJECT_CAST (sink->ringbuffer)); sink->ringbuffer = NULL; diff --git a/gst-libs/gst/audio/gstbaseaudiosink.h b/gst-libs/gst/audio/gstbaseaudiosink.h index 2064ac0..d5a3932 100644 --- a/gst-libs/gst/audio/gstbaseaudiosink.h +++ b/gst-libs/gst/audio/gstbaseaudiosink.h @@ -42,7 +42,7 @@ * function will be used to perform a pull_range() on the sinkpad. * The thread scheduling the callback can be a real-time thread. * - * Subclasses must implement a GstRingBuffer in addition to overriding + * Subclasses must implement a GstAudioRingBuffer in addition to overriding * the methods in GstBaseSink and this class. */ @@ -107,25 +107,25 @@ typedef struct _GstBaseAudioSinkPrivate GstBaseAudioSinkPrivate; * Opaque #GstBaseAudioSink. */ struct _GstBaseAudioSink { - GstBaseSink element; + GstBaseSink element; /*< protected >*/ /* with LOCK */ /* our ringbuffer */ - GstRingBuffer *ringbuffer; + GstAudioRingBuffer *ringbuffer; /* required buffer and latency in microseconds */ - guint64 buffer_time; - guint64 latency_time; + guint64 buffer_time; + guint64 latency_time; /* the next sample to write */ - guint64 next_sample; + guint64 next_sample; /* clock */ - gboolean provide_clock; - GstClock *provided_clock; + gboolean provide_clock; + GstClock *provided_clock; /* with g_atomic_; currently rendering eos */ - gboolean eos_rendering; + gboolean eos_rendering; /*< private >*/ GstBaseAudioSinkPrivate *priv; @@ -136,7 +136,7 @@ struct _GstBaseAudioSink { /** * GstBaseAudioSinkClass: * @parent_class: the parent class. - * @create_ringbuffer: create and return a #GstRingBuffer to write to. + * @create_ringbuffer: create and return a #GstAudioRingBuffer to write to. * @payload: payload data in a format suitable to write to the sink. If no * payloading is required, returns a reffed copy of the original * buffer, else returns the payloaded buffer with all other metadata @@ -146,14 +146,14 @@ struct _GstBaseAudioSink { * functionality. */ struct _GstBaseAudioSinkClass { - GstBaseSinkClass parent_class; + GstBaseSinkClass parent_class; /* subclass ringbuffer allocation */ - GstRingBuffer* (*create_ringbuffer) (GstBaseAudioSink *sink); + GstAudioRingBuffer* (*create_ringbuffer) (GstBaseAudioSink *sink); /* subclass payloader */ - GstBuffer* (*payload) (GstBaseAudioSink *sink, - GstBuffer *buffer); + GstBuffer* (*payload) (GstBaseAudioSink *sink, + GstBuffer *buffer); /*< private >*/ gpointer _gst_reserved[GST_PADDING]; }; @@ -161,29 +161,30 @@ struct _GstBaseAudioSinkClass { GType gst_base_audio_sink_get_type(void); GType gst_base_audio_sink_slave_method_get_type (void); -GstRingBuffer *gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink *sink); +GstAudioRingBuffer * + gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink *sink); -void gst_base_audio_sink_set_provide_clock (GstBaseAudioSink *sink, gboolean provide); -gboolean gst_base_audio_sink_get_provide_clock (GstBaseAudioSink *sink); +void gst_base_audio_sink_set_provide_clock (GstBaseAudioSink *sink, gboolean provide); +gboolean gst_base_audio_sink_get_provide_clock (GstBaseAudioSink *sink); -void gst_base_audio_sink_set_slave_method (GstBaseAudioSink *sink, - GstBaseAudioSinkSlaveMethod method); +void gst_base_audio_sink_set_slave_method (GstBaseAudioSink *sink, + GstBaseAudioSinkSlaveMethod method); GstBaseAudioSinkSlaveMethod - gst_base_audio_sink_get_slave_method (GstBaseAudioSink *sink); + gst_base_audio_sink_get_slave_method (GstBaseAudioSink *sink); -void gst_base_audio_sink_set_drift_tolerance (GstBaseAudioSink *sink, - gint64 drift_tolerance); -gint64 gst_base_audio_sink_get_drift_tolerance (GstBaseAudioSink *sink); +void gst_base_audio_sink_set_drift_tolerance (GstBaseAudioSink *sink, + gint64 drift_tolerance); +gint64 gst_base_audio_sink_get_drift_tolerance (GstBaseAudioSink *sink); void gst_base_audio_sink_set_alignment_threshold (GstBaseAudioSink * sink, GstClockTime alignment_threshold); GstClockTime gst_base_audio_sink_get_alignment_threshold (GstBaseAudioSink * sink); -void gst_base_audio_sink_set_discont_wait (GstBaseAudioSink * sink, - GstClockTime discont_wait); +void gst_base_audio_sink_set_discont_wait (GstBaseAudioSink * sink, + GstClockTime discont_wait); GstClockTime - gst_base_audio_sink_get_discont_wait (GstBaseAudioSink * sink); + gst_base_audio_sink_get_discont_wait (GstBaseAudioSink * sink); G_END_DECLS diff --git a/gst-libs/gst/audio/gstbaseaudiosrc.c b/gst-libs/gst/audio/gstbaseaudiosrc.c index fd1e549..1a6c19b 100644 --- a/gst-libs/gst/audio/gstbaseaudiosrc.c +++ b/gst-libs/gst/audio/gstbaseaudiosrc.c @@ -23,7 +23,7 @@ /** * SECTION:gstbaseaudiosrc * @short_description: Base class for audio sources - * @see_also: #GstAudioSrc, #GstRingBuffer. + * @see_also: #GstAudioSrc, #GstAudioRingBuffer. * * This is the base class for audio sources. Subclasses need to implement the * ::create_ringbuffer vmethod. This base class will then take care of @@ -230,7 +230,7 @@ gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass) /* ref class from a thread-safe context to work around missing bit of * thread-safety in GObject */ g_type_class_ref (GST_TYPE_AUDIO_CLOCK); - g_type_class_ref (GST_TYPE_RING_BUFFER); + g_type_class_ref (GST_TYPE_AUDIO_RING_BUFFER); } static void @@ -291,7 +291,7 @@ gst_base_audio_src_provide_clock (GstElement * elem) if (src->ringbuffer == NULL) goto wrong_state; - if (!gst_ring_buffer_is_acquired (src->ringbuffer)) + if (!gst_audio_ring_buffer_is_acquired (src->ringbuffer)) goto wrong_state; GST_OBJECT_LOCK (src); @@ -328,11 +328,11 @@ gst_base_audio_src_get_time (GstClock * clock, GstBaseAudioSrc * src) || src->ringbuffer->spec.info.rate == 0)) return GST_CLOCK_TIME_NONE; - raw = samples = gst_ring_buffer_samples_done (src->ringbuffer); + raw = samples = gst_audio_ring_buffer_samples_done (src->ringbuffer); /* the number of samples not yet processed, this is still queued in the * device (not yet read for capture). */ - delay = gst_ring_buffer_delay (src->ringbuffer); + delay = gst_audio_ring_buffer_delay (src->ringbuffer); samples += delay; @@ -527,7 +527,7 @@ static gboolean gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps) { GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc); - GstRingBufferSpec *spec; + GstAudioRingBufferSpec *spec; gint bpf, rate; spec = &src->ringbuffer->spec; @@ -536,7 +536,7 @@ gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps) spec->latency_time = src->latency_time; GST_OBJECT_LOCK (src); - if (!gst_ring_buffer_parse_caps (spec, caps)) { + if (!gst_audio_ring_buffer_parse_caps (spec, caps)) { GST_OBJECT_UNLOCK (src); goto parse_error; } @@ -552,13 +552,13 @@ gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps) GST_DEBUG ("release old ringbuffer"); - gst_ring_buffer_release (src->ringbuffer); + gst_audio_ring_buffer_release (src->ringbuffer); - gst_ring_buffer_debug_spec_buff (spec); + gst_audio_ring_buffer_debug_spec_buff (spec); GST_DEBUG ("acquire new ringbuffer"); - if (!gst_ring_buffer_acquire (src->ringbuffer, spec)) + if (!gst_audio_ring_buffer_acquire (src->ringbuffer, spec)) goto acquire_error; /* calculate actual latency and buffer times */ @@ -566,7 +566,7 @@ gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps) spec->buffer_time = spec->segtotal * spec->segsize * GST_MSECOND / (rate * bpf); - gst_ring_buffer_debug_spec_buff (spec); + gst_audio_ring_buffer_debug_spec_buff (spec); g_object_notify (G_OBJECT (src), "actual-buffer-time"); g_object_notify (G_OBJECT (src), "actual-latency-time"); @@ -606,7 +606,7 @@ gst_base_audio_src_query (GstBaseSrc * bsrc, GstQuery * query) case GST_QUERY_LATENCY: { GstClockTime min_latency, max_latency; - GstRingBufferSpec *spec; + GstAudioRingBufferSpec *spec; gint bpf, rate; GST_OBJECT_LOCK (src); @@ -671,14 +671,14 @@ gst_base_audio_src_event (GstBaseSrc * bsrc, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_FLUSH_START: GST_DEBUG_OBJECT (bsrc, "flush-start"); - gst_ring_buffer_pause (src->ringbuffer); - gst_ring_buffer_clear_all (src->ringbuffer); + gst_audio_ring_buffer_pause (src->ringbuffer); + gst_audio_ring_buffer_clear_all (src->ringbuffer); break; case GST_EVENT_FLUSH_STOP: GST_DEBUG_OBJECT (bsrc, "flush-stop"); /* always resync on sample after a flush */ src->next_sample = -1; - gst_ring_buffer_clear_all (src->ringbuffer); + gst_audio_ring_buffer_clear_all (src->ringbuffer); break; case GST_EVENT_SEEK: GST_DEBUG_OBJECT (bsrc, "refuse to seek"); @@ -755,8 +755,8 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, guint samples, total_samples; guint64 sample; gint bpf, rate; - GstRingBuffer *ringbuffer; - GstRingBufferSpec *spec; + GstAudioRingBuffer *ringbuffer; + GstAudioRingBufferSpec *spec; guint read; GstClockTime timestamp, duration; GstClock *clock; @@ -764,7 +764,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, ringbuffer = src->ringbuffer; spec = &ringbuffer->spec; - if (G_UNLIKELY (!gst_ring_buffer_is_acquired (ringbuffer))) + if (G_UNLIKELY (!gst_audio_ring_buffer_is_acquired (ringbuffer))) goto wrong_state; bpf = GST_AUDIO_INFO_BPF (&spec->info); @@ -803,7 +803,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, data = ptr = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); do { - read = gst_ring_buffer_read (ringbuffer, sample, ptr, samples); + read = gst_audio_ring_buffer_read (ringbuffer, sample, ptr, samples); GST_DEBUG_OBJECT (src, "read %u of %u", read, samples); /* if we read all, we're done */ if (read == samples) @@ -932,7 +932,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, segment_diff = running_time_segment - last_written_segment; /* advance the ringbuffer */ - gst_ring_buffer_advance (ringbuffer, segment_diff); + gst_audio_ring_buffer_advance (ringbuffer, segment_diff); /* we move the new read segment to the last known written segment */ new_read_segment = @@ -1045,17 +1045,17 @@ stopped: * gst_base_audio_src_create_ringbuffer: * @src: a #GstBaseAudioSrc. * - * Create and return the #GstRingBuffer for @src. This function will call the + * Create and return the #GstAudioRingBuffer for @src. This function will call the * ::create_ringbuffer vmethod and will set @src as the parent of the returned * buffer (see gst_object_set_parent()). * * Returns: The new ringbuffer of @src. */ -GstRingBuffer * +GstAudioRingBuffer * gst_base_audio_src_create_ringbuffer (GstBaseAudioSrc * src) { GstBaseAudioSrcClass *bclass; - GstRingBuffer *buffer = NULL; + GstAudioRingBuffer *buffer = NULL; bclass = GST_BASE_AUDIO_SRC_GET_CLASS (src); if (bclass->create_ringbuffer) @@ -1083,14 +1083,14 @@ gst_base_audio_src_change_state (GstElement * element, src->ringbuffer = gst_base_audio_src_create_ringbuffer (src); } GST_OBJECT_UNLOCK (src); - if (!gst_ring_buffer_open_device (src->ringbuffer)) + if (!gst_audio_ring_buffer_open_device (src->ringbuffer)) goto open_failed; break; case GST_STATE_CHANGE_READY_TO_PAUSED: GST_DEBUG_OBJECT (src, "READY->PAUSED"); src->next_sample = -1; - gst_ring_buffer_set_flushing (src->ringbuffer, FALSE); - gst_ring_buffer_may_start (src->ringbuffer, FALSE); + gst_audio_ring_buffer_set_flushing (src->ringbuffer, FALSE); + gst_audio_ring_buffer_may_start (src->ringbuffer, FALSE); /* Only post clock-provide messages if this is the clock that * we've created. If the subclass has overriden it the subclass * should post this messages whenever necessary */ @@ -1103,12 +1103,12 @@ gst_base_audio_src_change_state (GstElement * element, break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: GST_DEBUG_OBJECT (src, "PAUSED->PLAYING"); - gst_ring_buffer_may_start (src->ringbuffer, TRUE); + gst_audio_ring_buffer_may_start (src->ringbuffer, TRUE); break; case GST_STATE_CHANGE_PLAYING_TO_PAUSED: GST_DEBUG_OBJECT (src, "PLAYING->PAUSED"); - gst_ring_buffer_may_start (src->ringbuffer, FALSE); - gst_ring_buffer_pause (src->ringbuffer); + gst_audio_ring_buffer_may_start (src->ringbuffer, FALSE); + gst_audio_ring_buffer_pause (src->ringbuffer); break; case GST_STATE_CHANGE_PAUSED_TO_READY: GST_DEBUG_OBJECT (src, "PAUSED->READY"); @@ -1120,7 +1120,7 @@ gst_base_audio_src_change_state (GstElement * element, (GstAudioClockGetTimeFunc) gst_base_audio_src_get_time) gst_element_post_message (element, gst_message_new_clock_lost (GST_OBJECT_CAST (element), src->clock)); - gst_ring_buffer_set_flushing (src->ringbuffer, TRUE); + gst_audio_ring_buffer_set_flushing (src->ringbuffer, TRUE); break; default: break; @@ -1131,11 +1131,11 @@ gst_base_audio_src_change_state (GstElement * element, switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: GST_DEBUG_OBJECT (src, "PAUSED->READY"); - gst_ring_buffer_release (src->ringbuffer); + gst_audio_ring_buffer_release (src->ringbuffer); break; case GST_STATE_CHANGE_READY_TO_NULL: GST_DEBUG_OBJECT (src, "READY->NULL"); - gst_ring_buffer_close_device (src->ringbuffer); + gst_audio_ring_buffer_close_device (src->ringbuffer); GST_OBJECT_LOCK (src); gst_object_unparent (GST_OBJECT_CAST (src->ringbuffer)); src->ringbuffer = NULL; diff --git a/gst-libs/gst/audio/gstbaseaudiosrc.h b/gst-libs/gst/audio/gstbaseaudiosrc.h index b55ac1e..9c5784f 100644 --- a/gst-libs/gst/audio/gstbaseaudiosrc.h +++ b/gst-libs/gst/audio/gstbaseaudiosrc.h @@ -87,21 +87,21 @@ typedef enum * Opaque #GstBaseAudioSrc. */ struct _GstBaseAudioSrc { - GstPushSrc element; + GstPushSrc element; /*< protected >*/ /* with LOCK */ /* our ringbuffer */ - GstRingBuffer *ringbuffer; + GstAudioRingBuffer *ringbuffer; /* required buffer and latency */ - GstClockTime buffer_time; - GstClockTime latency_time; + GstClockTime buffer_time; + GstClockTime latency_time; /* the next sample to write */ - guint64 next_sample; + guint64 next_sample; /* clock */ - GstClock *clock; + GstClock *clock; /*< private >*/ GstBaseAudioSrcPrivate *priv; @@ -112,16 +112,16 @@ struct _GstBaseAudioSrc { /** * GstBaseAudioSrcClass: * @parent_class: the parent class. - * @create_ringbuffer: create and return a #GstRingBuffer to read from. + * @create_ringbuffer: create and return a #GstAudioRingBuffer to read from. * * #GstBaseAudioSrc class. Override the vmethod to implement * functionality. */ struct _GstBaseAudioSrcClass { - GstPushSrcClass parent_class; + GstPushSrcClass parent_class; /* subclass ringbuffer allocation */ - GstRingBuffer* (*create_ringbuffer) (GstBaseAudioSrc *src); + GstAudioRingBuffer* (*create_ringbuffer) (GstBaseAudioSrc *src); /*< private >*/ gpointer _gst_reserved[GST_PADDING]; @@ -130,7 +130,8 @@ struct _GstBaseAudioSrcClass { GType gst_base_audio_src_get_type(void); GType gst_base_audio_src_slave_method_get_type (void); -GstRingBuffer *gst_base_audio_src_create_ringbuffer (GstBaseAudioSrc *src); +GstAudioRingBuffer * + gst_base_audio_src_create_ringbuffer (GstBaseAudioSrc *src); void gst_base_audio_src_set_provide_clock (GstBaseAudioSrc *src, gboolean provide); gboolean gst_base_audio_src_get_provide_clock (GstBaseAudioSrc *src); diff --git a/gst-libs/gst/audio/gstringbuffer.c b/gst-libs/gst/audio/gstringbuffer.c index 229440d..306d606 100644 --- a/gst-libs/gst/audio/gstringbuffer.c +++ b/gst-libs/gst/audio/gstringbuffer.c @@ -43,45 +43,46 @@ #include "gstringbuffer.h" -GST_DEBUG_CATEGORY_STATIC (gst_ring_buffer_debug); -#define GST_CAT_DEFAULT gst_ring_buffer_debug +GST_DEBUG_CATEGORY_STATIC (gst_audio_ring_buffer_debug); +#define GST_CAT_DEFAULT gst_audio_ring_buffer_debug -static void gst_ring_buffer_dispose (GObject * object); -static void gst_ring_buffer_finalize (GObject * object); +static void gst_audio_ring_buffer_dispose (GObject * object); +static void gst_audio_ring_buffer_finalize (GObject * object); -static gboolean gst_ring_buffer_pause_unlocked (GstRingBuffer * buf); -static void default_clear_all (GstRingBuffer * buf); -static guint default_commit (GstRingBuffer * buf, guint64 * sample, +static gboolean gst_audio_ring_buffer_pause_unlocked (GstAudioRingBuffer * buf); +static void default_clear_all (GstAudioRingBuffer * buf); +static guint default_commit (GstAudioRingBuffer * buf, guint64 * sample, guchar * data, gint in_samples, gint out_samples, gint * accum); /* ringbuffer abstract base class */ -G_DEFINE_ABSTRACT_TYPE (GstRingBuffer, gst_ring_buffer, GST_TYPE_OBJECT); +G_DEFINE_ABSTRACT_TYPE (GstAudioRingBuffer, gst_audio_ring_buffer, + GST_TYPE_OBJECT); static void -gst_ring_buffer_class_init (GstRingBufferClass * klass) +gst_audio_ring_buffer_class_init (GstAudioRingBufferClass * klass) { GObjectClass *gobject_class; - GstRingBufferClass *gstringbuffer_class; + GstAudioRingBufferClass *gstringbuffer_class; gobject_class = (GObjectClass *) klass; - gstringbuffer_class = (GstRingBufferClass *) klass; + gstringbuffer_class = (GstAudioRingBufferClass *) klass; - GST_DEBUG_CATEGORY_INIT (gst_ring_buffer_debug, "ringbuffer", 0, + GST_DEBUG_CATEGORY_INIT (gst_audio_ring_buffer_debug, "ringbuffer", 0, "ringbuffer class"); - gobject_class->dispose = gst_ring_buffer_dispose; - gobject_class->finalize = gst_ring_buffer_finalize; + gobject_class->dispose = gst_audio_ring_buffer_dispose; + gobject_class->finalize = gst_audio_ring_buffer_finalize; gstringbuffer_class->clear_all = GST_DEBUG_FUNCPTR (default_clear_all); gstringbuffer_class->commit = GST_DEBUG_FUNCPTR (default_commit); } static void -gst_ring_buffer_init (GstRingBuffer * ringbuffer) +gst_audio_ring_buffer_init (GstAudioRingBuffer * ringbuffer) { ringbuffer->open = FALSE; ringbuffer->acquired = FALSE; - ringbuffer->state = GST_RING_BUFFER_STATE_STOPPED; + ringbuffer->state = GST_AUDIO_RING_BUFFER_STATE_STOPPED; ringbuffer->cond = g_cond_new (); ringbuffer->waiting = 0; ringbuffer->empty_seg = NULL; @@ -89,25 +90,25 @@ gst_ring_buffer_init (GstRingBuffer * ringbuffer) } static void -gst_ring_buffer_dispose (GObject * object) +gst_audio_ring_buffer_dispose (GObject * object) { - GstRingBuffer *ringbuffer = GST_RING_BUFFER (object); + GstAudioRingBuffer *ringbuffer = GST_AUDIO_RING_BUFFER (object); gst_caps_replace (&ringbuffer->spec.caps, NULL); - G_OBJECT_CLASS (gst_ring_buffer_parent_class)->dispose (G_OBJECT + G_OBJECT_CLASS (gst_audio_ring_buffer_parent_class)->dispose (G_OBJECT (ringbuffer)); } static void -gst_ring_buffer_finalize (GObject * object) +gst_audio_ring_buffer_finalize (GObject * object) { - GstRingBuffer *ringbuffer = GST_RING_BUFFER (object); + GstAudioRingBuffer *ringbuffer = GST_AUDIO_RING_BUFFER (object); g_cond_free (ringbuffer->cond); g_free (ringbuffer->empty_seg); - G_OBJECT_CLASS (gst_ring_buffer_parent_class)->finalize (G_OBJECT + G_OBJECT_CLASS (gst_audio_ring_buffer_parent_class)->finalize (G_OBJECT (ringbuffer)); } @@ -127,13 +128,13 @@ static const gchar *format_type_names[] = { #endif /** - * gst_ring_buffer_debug_spec_caps: + * gst_audio_ring_buffer_debug_spec_caps: * @spec: the spec to debug * * Print debug info about the parsed caps in @spec to the debug log. */ void -gst_ring_buffer_debug_spec_caps (GstRingBufferSpec * spec) +gst_audio_ring_buffer_debug_spec_caps (GstAudioRingBufferSpec * spec) { #if 0 gint i, bytes; @@ -157,13 +158,13 @@ gst_ring_buffer_debug_spec_caps (GstRingBufferSpec * spec) } /** - * gst_ring_buffer_debug_spec_buff: + * gst_audio_ring_buffer_debug_spec_buff: * @spec: the spec to debug * * Print debug info about the buffer sized in @spec to the debug log. */ void -gst_ring_buffer_debug_spec_buff (GstRingBufferSpec * spec) +gst_audio_ring_buffer_debug_spec_buff (GstAudioRingBufferSpec * spec) { gint bpf = GST_AUDIO_INFO_BPF (&spec->info); @@ -180,7 +181,7 @@ gst_ring_buffer_debug_spec_buff (GstRingBufferSpec * spec) } /** - * gst_ring_buffer_parse_caps: + * gst_audio_ring_buffer_parse_caps: * @spec: a spec * @caps: a #GstCaps * @@ -189,7 +190,7 @@ gst_ring_buffer_debug_spec_buff (GstRingBufferSpec * spec) * Returns: TRUE if the caps could be parsed. */ gboolean -gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) +gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec * spec, GstCaps * caps) { const gchar *mimetype; GstStructure *structure; @@ -284,8 +285,8 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) spec->info = info; - gst_ring_buffer_debug_spec_caps (spec); - gst_ring_buffer_debug_spec_buff (spec); + gst_audio_ring_buffer_debug_spec_caps (spec); + gst_audio_ring_buffer_debug_spec_buff (spec); return TRUE; @@ -298,8 +299,8 @@ parse_error: } /** - * gst_ring_buffer_convert: - * @buf: the #GstRingBuffer + * gst_audio_ring_buffer_convert: + * @buf: the #GstAudioRingBuffer * @src_fmt: the source format * @src_val: the source value * @dest_fmt: the destination format @@ -313,7 +314,7 @@ parse_error: * Since: 0.10.22. */ gboolean -gst_ring_buffer_convert (GstRingBuffer * buf, +gst_audio_ring_buffer_convert (GstAudioRingBuffer * buf, GstFormat src_fmt, gint64 src_val, GstFormat dest_fmt, gint64 * dest_val) { gboolean res; @@ -328,8 +329,8 @@ gst_ring_buffer_convert (GstRingBuffer * buf, } /** - * gst_ring_buffer_set_callback: - * @buf: the #GstRingBuffer to set the callback on + * gst_audio_ring_buffer_set_callback: + * @buf: the #GstAudioRingBuffer to set the callback on * @cb: the callback to set * @user_data: user data passed to the callback * @@ -339,10 +340,10 @@ gst_ring_buffer_convert (GstRingBuffer * buf, * MT safe. */ void -gst_ring_buffer_set_callback (GstRingBuffer * buf, GstRingBufferCallback cb, - gpointer user_data) +gst_audio_ring_buffer_set_callback (GstAudioRingBuffer * buf, + GstAudioRingBufferCallback cb, gpointer user_data) { - g_return_if_fail (GST_IS_RING_BUFFER (buf)); + g_return_if_fail (GST_IS_AUDIO_RING_BUFFER (buf)); GST_OBJECT_LOCK (buf); buf->callback = cb; @@ -352,8 +353,8 @@ gst_ring_buffer_set_callback (GstRingBuffer * buf, GstRingBufferCallback cb, /** - * gst_ring_buffer_open_device: - * @buf: the #GstRingBuffer + * gst_audio_ring_buffer_open_device: + * @buf: the #GstAudioRingBuffer * * Open the audio device associated with the ring buffer. Does not perform any * setup on the device. You must open the device before acquiring the ring @@ -364,12 +365,12 @@ gst_ring_buffer_set_callback (GstRingBuffer * buf, GstRingBufferCallback cb, * MT safe. */ gboolean -gst_ring_buffer_open_device (GstRingBuffer * buf) +gst_audio_ring_buffer_open_device (GstAudioRingBuffer * buf) { gboolean res = TRUE; - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_DEBUG_OBJECT (buf, "opening device"); @@ -382,7 +383,7 @@ gst_ring_buffer_open_device (GstRingBuffer * buf) /* if this fails, something is wrong in this file */ g_assert (!buf->acquired); - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->open_device)) res = rclass->open_device (buf); @@ -413,23 +414,23 @@ open_failed: } /** - * gst_ring_buffer_close_device: - * @buf: the #GstRingBuffer + * gst_audio_ring_buffer_close_device: + * @buf: the #GstAudioRingBuffer * * Close the audio device associated with the ring buffer. The ring buffer - * should already have been released via gst_ring_buffer_release(). + * should already have been released via gst_audio_ring_buffer_release(). * * Returns: TRUE if the device could be closed, FALSE on error. * * MT safe. */ gboolean -gst_ring_buffer_close_device (GstRingBuffer * buf) +gst_audio_ring_buffer_close_device (GstAudioRingBuffer * buf) { gboolean res = TRUE; - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_DEBUG_OBJECT (buf, "closing device"); @@ -442,7 +443,7 @@ gst_ring_buffer_close_device (GstRingBuffer * buf) buf->open = FALSE; - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->close_device)) res = rclass->close_device (buf); @@ -480,8 +481,8 @@ close_error: } /** - * gst_ring_buffer_device_is_open: - * @buf: the #GstRingBuffer + * gst_audio_ring_buffer_device_is_open: + * @buf: the #GstAudioRingBuffer * * Checks the status of the device associated with the ring buffer. * @@ -490,11 +491,11 @@ close_error: * MT safe. */ gboolean -gst_ring_buffer_device_is_open (GstRingBuffer * buf) +gst_audio_ring_buffer_device_is_open (GstAudioRingBuffer * buf) { gboolean res = TRUE; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_OBJECT_LOCK (buf); res = buf->open; @@ -504,8 +505,8 @@ gst_ring_buffer_device_is_open (GstRingBuffer * buf) } /** - * gst_ring_buffer_acquire: - * @buf: the #GstRingBuffer to acquire + * gst_audio_ring_buffer_acquire: + * @buf: the #GstAudioRingBuffer to acquire * @spec: the specs of the buffer * * Allocate the resources for the ringbuffer. This function fills @@ -517,13 +518,14 @@ gst_ring_buffer_device_is_open (GstRingBuffer * buf) * MT safe. */ gboolean -gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) +gst_audio_ring_buffer_acquire (GstAudioRingBuffer * buf, + GstAudioRingBufferSpec * spec) { gboolean res = FALSE; - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; gint segsize, bpf; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_DEBUG_OBJECT (buf, "acquiring device %p", buf); @@ -536,7 +538,7 @@ gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) buf->acquired = TRUE; - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->acquire)) res = rclass->acquire (buf, spec); @@ -605,8 +607,8 @@ invalid_bpf: } /** - * gst_ring_buffer_release: - * @buf: the #GstRingBuffer to release + * gst_audio_ring_buffer_release: + * @buf: the #GstAudioRingBuffer to release * * Free the resources of the ringbuffer. * @@ -615,16 +617,16 @@ invalid_bpf: * MT safe. */ gboolean -gst_ring_buffer_release (GstRingBuffer * buf) +gst_audio_ring_buffer_release (GstAudioRingBuffer * buf) { gboolean res = FALSE; - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_DEBUG_OBJECT (buf, "releasing device"); - gst_ring_buffer_stop (buf); + gst_audio_ring_buffer_stop (buf); GST_OBJECT_LOCK (buf); if (G_UNLIKELY (!buf->acquired)) @@ -635,13 +637,13 @@ gst_ring_buffer_release (GstRingBuffer * buf) /* if this fails, something is wrong in this file */ g_assert (buf->open == TRUE); - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->release)) res = rclass->release (buf); /* signal any waiters */ GST_DEBUG_OBJECT (buf, "signal waiter"); - GST_RING_BUFFER_SIGNAL (buf); + GST_AUDIO_RING_BUFFER_SIGNAL (buf); if (G_UNLIKELY (!res)) goto release_failed; @@ -671,8 +673,8 @@ release_failed: } /** - * gst_ring_buffer_is_acquired: - * @buf: the #GstRingBuffer to check + * gst_audio_ring_buffer_is_acquired: + * @buf: the #GstAudioRingBuffer to check * * Check if the ringbuffer is acquired and ready to use. * @@ -681,11 +683,11 @@ release_failed: * MT safe. */ gboolean -gst_ring_buffer_is_acquired (GstRingBuffer * buf) +gst_audio_ring_buffer_is_acquired (GstAudioRingBuffer * buf) { gboolean res; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_OBJECT_LOCK (buf); res = buf->acquired; @@ -695,8 +697,8 @@ gst_ring_buffer_is_acquired (GstRingBuffer * buf) } /** - * gst_ring_buffer_activate: - * @buf: the #GstRingBuffer to activate + * gst_audio_ring_buffer_activate: + * @buf: the #GstAudioRingBuffer to activate * @active: the new mode * * Activate @buf to start or stop pulling data. @@ -709,12 +711,12 @@ gst_ring_buffer_is_acquired (GstRingBuffer * buf) * Since: 0.10.22. */ gboolean -gst_ring_buffer_activate (GstRingBuffer * buf, gboolean active) +gst_audio_ring_buffer_activate (GstAudioRingBuffer * buf, gboolean active) { gboolean res = FALSE; - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_DEBUG_OBJECT (buf, "activate device"); @@ -725,7 +727,7 @@ gst_ring_buffer_activate (GstRingBuffer * buf, gboolean active) if (G_UNLIKELY (buf->active == active)) goto was_active; - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); /* if there is no activate function we assume it was started/released * in the acquire method */ if (G_LIKELY (rclass->activate)) @@ -765,8 +767,8 @@ activate_failed: } /** - * gst_ring_buffer_is_active: - * @buf: the #GstRingBuffer + * gst_audio_ring_buffer_is_active: + * @buf: the #GstAudioRingBuffer * * Check if @buf is activated. * @@ -777,11 +779,11 @@ activate_failed: * Since: 0.10.22. */ gboolean -gst_ring_buffer_is_active (GstRingBuffer * buf) +gst_audio_ring_buffer_is_active (GstAudioRingBuffer * buf) { gboolean res; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_OBJECT_LOCK (buf); res = buf->active; @@ -792,8 +794,8 @@ gst_ring_buffer_is_active (GstRingBuffer * buf) /** - * gst_ring_buffer_set_flushing: - * @buf: the #GstRingBuffer to flush + * gst_audio_ring_buffer_set_flushing: + * @buf: the #GstAudioRingBuffer to flush * @flushing: the new mode * * Set the ringbuffer to flushing mode or normal mode. @@ -801,24 +803,24 @@ gst_ring_buffer_is_active (GstRingBuffer * buf) * MT safe. */ void -gst_ring_buffer_set_flushing (GstRingBuffer * buf, gboolean flushing) +gst_audio_ring_buffer_set_flushing (GstAudioRingBuffer * buf, gboolean flushing) { - g_return_if_fail (GST_IS_RING_BUFFER (buf)); + g_return_if_fail (GST_IS_AUDIO_RING_BUFFER (buf)); GST_OBJECT_LOCK (buf); buf->flushing = flushing; if (flushing) { - gst_ring_buffer_pause_unlocked (buf); + gst_audio_ring_buffer_pause_unlocked (buf); } else { - gst_ring_buffer_clear_all (buf); + gst_audio_ring_buffer_clear_all (buf); } GST_OBJECT_UNLOCK (buf); } /** - * gst_ring_buffer_start: - * @buf: the #GstRingBuffer to start + * gst_audio_ring_buffer_start: + * @buf: the #GstAudioRingBuffer to start * * Start processing samples from the ringbuffer. * @@ -827,13 +829,13 @@ gst_ring_buffer_set_flushing (GstRingBuffer * buf, gboolean flushing) * MT safe. */ gboolean -gst_ring_buffer_start (GstRingBuffer * buf) +gst_audio_ring_buffer_start (GstAudioRingBuffer * buf) { gboolean res = FALSE; - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; gboolean resume = FALSE; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_DEBUG_OBJECT (buf, "starting ringbuffer"); @@ -849,13 +851,14 @@ gst_ring_buffer_start (GstRingBuffer * buf) /* if stopped, set to started */ res = g_atomic_int_compare_and_exchange (&buf->state, - GST_RING_BUFFER_STATE_STOPPED, GST_RING_BUFFER_STATE_STARTED); + GST_AUDIO_RING_BUFFER_STATE_STOPPED, GST_AUDIO_RING_BUFFER_STATE_STARTED); if (!res) { GST_DEBUG_OBJECT (buf, "was not stopped, try paused"); /* was not stopped, try from paused */ res = g_atomic_int_compare_and_exchange (&buf->state, - GST_RING_BUFFER_STATE_PAUSED, GST_RING_BUFFER_STATE_STARTED); + GST_AUDIO_RING_BUFFER_STATE_PAUSED, + GST_AUDIO_RING_BUFFER_STATE_STARTED); if (!res) { /* was not paused either, must be started then */ res = TRUE; @@ -866,7 +869,7 @@ gst_ring_buffer_start (GstRingBuffer * buf) GST_DEBUG_OBJECT (buf, "resuming"); } - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (resume) { if (G_LIKELY (rclass->resume)) res = rclass->resume (buf); @@ -876,7 +879,7 @@ gst_ring_buffer_start (GstRingBuffer * buf) } if (G_UNLIKELY (!res)) { - buf->state = GST_RING_BUFFER_STATE_PAUSED; + buf->state = GST_AUDIO_RING_BUFFER_STATE_PAUSED; GST_DEBUG_OBJECT (buf, "failed to start"); } else { GST_DEBUG_OBJECT (buf, "started"); @@ -908,30 +911,30 @@ may_not_start: } static gboolean -gst_ring_buffer_pause_unlocked (GstRingBuffer * buf) +gst_audio_ring_buffer_pause_unlocked (GstAudioRingBuffer * buf) { gboolean res = FALSE; - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; GST_DEBUG_OBJECT (buf, "pausing ringbuffer"); /* if started, set to paused */ res = g_atomic_int_compare_and_exchange (&buf->state, - GST_RING_BUFFER_STATE_STARTED, GST_RING_BUFFER_STATE_PAUSED); + GST_AUDIO_RING_BUFFER_STATE_STARTED, GST_AUDIO_RING_BUFFER_STATE_PAUSED); if (!res) goto not_started; /* signal any waiters */ GST_DEBUG_OBJECT (buf, "signal waiter"); - GST_RING_BUFFER_SIGNAL (buf); + GST_AUDIO_RING_BUFFER_SIGNAL (buf); - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->pause)) res = rclass->pause (buf); if (G_UNLIKELY (!res)) { - buf->state = GST_RING_BUFFER_STATE_STARTED; + buf->state = GST_AUDIO_RING_BUFFER_STATE_STARTED; GST_DEBUG_OBJECT (buf, "failed to pause"); } else { GST_DEBUG_OBJECT (buf, "paused"); @@ -948,8 +951,8 @@ not_started: } /** - * gst_ring_buffer_pause: - * @buf: the #GstRingBuffer to pause + * gst_audio_ring_buffer_pause: + * @buf: the #GstAudioRingBuffer to pause * * Pause processing samples from the ringbuffer. * @@ -958,11 +961,11 @@ not_started: * MT safe. */ gboolean -gst_ring_buffer_pause (GstRingBuffer * buf) +gst_audio_ring_buffer_pause (GstAudioRingBuffer * buf) { gboolean res = FALSE; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_OBJECT_LOCK (buf); if (G_UNLIKELY (buf->flushing)) @@ -971,7 +974,7 @@ gst_ring_buffer_pause (GstRingBuffer * buf) if (G_UNLIKELY (!buf->acquired)) goto not_acquired; - res = gst_ring_buffer_pause_unlocked (buf); + res = gst_audio_ring_buffer_pause_unlocked (buf); GST_OBJECT_UNLOCK (buf); return res; @@ -992,8 +995,8 @@ not_acquired: } /** - * gst_ring_buffer_stop: - * @buf: the #GstRingBuffer to stop + * gst_audio_ring_buffer_stop: + * @buf: the #GstAudioRingBuffer to stop * * Stop processing samples from the ringbuffer. * @@ -1002,12 +1005,12 @@ not_acquired: * MT safe. */ gboolean -gst_ring_buffer_stop (GstRingBuffer * buf) +gst_audio_ring_buffer_stop (GstAudioRingBuffer * buf) { gboolean res = FALSE; - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); GST_DEBUG_OBJECT (buf, "stopping"); @@ -1015,13 +1018,14 @@ gst_ring_buffer_stop (GstRingBuffer * buf) /* if started, set to stopped */ res = g_atomic_int_compare_and_exchange (&buf->state, - GST_RING_BUFFER_STATE_STARTED, GST_RING_BUFFER_STATE_STOPPED); + GST_AUDIO_RING_BUFFER_STATE_STARTED, GST_AUDIO_RING_BUFFER_STATE_STOPPED); if (!res) { GST_DEBUG_OBJECT (buf, "was not started, try paused"); /* was not started, try from paused */ res = g_atomic_int_compare_and_exchange (&buf->state, - GST_RING_BUFFER_STATE_PAUSED, GST_RING_BUFFER_STATE_STOPPED); + GST_AUDIO_RING_BUFFER_STATE_PAUSED, + GST_AUDIO_RING_BUFFER_STATE_STOPPED); if (!res) { /* was not paused either, must have been stopped then */ res = TRUE; @@ -1032,14 +1036,14 @@ gst_ring_buffer_stop (GstRingBuffer * buf) /* signal any waiters */ GST_DEBUG_OBJECT (buf, "signal waiter"); - GST_RING_BUFFER_SIGNAL (buf); + GST_AUDIO_RING_BUFFER_SIGNAL (buf); - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->stop)) res = rclass->stop (buf); if (G_UNLIKELY (!res)) { - buf->state = GST_RING_BUFFER_STATE_STARTED; + buf->state = GST_AUDIO_RING_BUFFER_STATE_STARTED; GST_DEBUG_OBJECT (buf, "failed to stop"); } else { GST_DEBUG_OBJECT (buf, "stopped"); @@ -1051,8 +1055,8 @@ done: } /** - * gst_ring_buffer_delay: - * @buf: the #GstRingBuffer to query + * gst_audio_ring_buffer_delay: + * @buf: the #GstAudioRingBuffer to query * * Get the number of samples queued in the audio device. This is * usually less than the segment size but can be bigger when the @@ -1070,18 +1074,18 @@ done: * MT safe. */ guint -gst_ring_buffer_delay (GstRingBuffer * buf) +gst_audio_ring_buffer_delay (GstAudioRingBuffer * buf) { - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; guint res; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), 0); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), 0); /* buffer must be acquired */ - if (G_UNLIKELY (!gst_ring_buffer_is_acquired (buf))) + if (G_UNLIKELY (!gst_audio_ring_buffer_is_acquired (buf))) goto not_acquired; - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->delay)) res = rclass->delay (buf); else @@ -1097,24 +1101,24 @@ not_acquired: } /** - * gst_ring_buffer_samples_done: - * @buf: the #GstRingBuffer to query + * gst_audio_ring_buffer_samples_done: + * @buf: the #GstAudioRingBuffer to query * * Get the number of samples that were processed by the ringbuffer * since it was last started. This does not include the number of samples not - * yet processed (see gst_ring_buffer_delay()). + * yet processed (see gst_audio_ring_buffer_delay()). * * Returns: The number of samples processed by the ringbuffer. * * MT safe. */ guint64 -gst_ring_buffer_samples_done (GstRingBuffer * buf) +gst_audio_ring_buffer_samples_done (GstAudioRingBuffer * buf) { gint segdone; guint64 samples; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), 0); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), 0); /* get the amount of segments we processed */ segdone = g_atomic_int_get (&buf->segdone); @@ -1126,8 +1130,8 @@ gst_ring_buffer_samples_done (GstRingBuffer * buf) } /** - * gst_ring_buffer_set_sample: - * @buf: the #GstRingBuffer to use + * gst_audio_ring_buffer_set_sample: + * @buf: the #GstAudioRingBuffer to use * @sample: the sample number to set * * Make sure that the next sample written to the device is @@ -1140,9 +1144,9 @@ gst_ring_buffer_samples_done (GstRingBuffer * buf) * MT safe. */ void -gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample) +gst_audio_ring_buffer_set_sample (GstAudioRingBuffer * buf, guint64 sample) { - g_return_if_fail (GST_IS_RING_BUFFER (buf)); + g_return_if_fail (GST_IS_AUDIO_RING_BUFFER (buf)); if (sample == -1) sample = 0; @@ -1155,14 +1159,14 @@ gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample) * offset when calculating the processed samples. */ buf->segbase = buf->segdone - sample / buf->samples_per_seg; - gst_ring_buffer_clear_all (buf); + gst_audio_ring_buffer_clear_all (buf); GST_DEBUG_OBJECT (buf, "set sample to %" G_GUINT64_FORMAT ", segbase %d", sample, buf->segbase); } static void -default_clear_all (GstRingBuffer * buf) +default_clear_all (GstAudioRingBuffer * buf) { gint i; @@ -1173,26 +1177,26 @@ default_clear_all (GstRingBuffer * buf) GST_DEBUG_OBJECT (buf, "clear all segments"); for (i = 0; i < buf->spec.segtotal; i++) { - gst_ring_buffer_clear (buf, i); + gst_audio_ring_buffer_clear (buf, i); } } /** - * gst_ring_buffer_clear_all: - * @buf: the #GstRingBuffer to clear + * gst_audio_ring_buffer_clear_all: + * @buf: the #GstAudioRingBuffer to clear * * Fill the ringbuffer with silence. * * MT safe. */ void -gst_ring_buffer_clear_all (GstRingBuffer * buf) +gst_audio_ring_buffer_clear_all (GstAudioRingBuffer * buf) { - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; - g_return_if_fail (GST_IS_RING_BUFFER (buf)); + g_return_if_fail (GST_IS_AUDIO_RING_BUFFER (buf)); - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->clear_all)) rclass->clear_all (buf); @@ -1200,21 +1204,21 @@ gst_ring_buffer_clear_all (GstRingBuffer * buf) static gboolean -wait_segment (GstRingBuffer * buf) +wait_segment (GstAudioRingBuffer * buf) { gint segments; gboolean wait = TRUE; /* buffer must be started now or we deadlock since nobody is reading */ if (G_UNLIKELY (g_atomic_int_get (&buf->state) != - GST_RING_BUFFER_STATE_STARTED)) { + GST_AUDIO_RING_BUFFER_STATE_STARTED)) { /* see if we are allowed to start it */ if (G_UNLIKELY (g_atomic_int_get (&buf->may_start) == FALSE)) goto no_start; GST_DEBUG_OBJECT (buf, "start!"); segments = g_atomic_int_get (&buf->segdone); - gst_ring_buffer_start (buf); + gst_audio_ring_buffer_start (buf); /* After starting, the writer may have wrote segments already and then we * don't need to wait anymore */ @@ -1228,19 +1232,19 @@ wait_segment (GstRingBuffer * buf) goto flushing; if (G_UNLIKELY (g_atomic_int_get (&buf->state) != - GST_RING_BUFFER_STATE_STARTED)) + GST_AUDIO_RING_BUFFER_STATE_STARTED)) goto not_started; if (G_LIKELY (wait)) { if (g_atomic_int_compare_and_exchange (&buf->waiting, 0, 1)) { GST_DEBUG_OBJECT (buf, "waiting.."); - GST_RING_BUFFER_WAIT (buf); + GST_AUDIO_RING_BUFFER_WAIT (buf); if (G_UNLIKELY (buf->flushing)) goto flushing; if (G_UNLIKELY (g_atomic_int_get (&buf->state) != - GST_RING_BUFFER_STATE_STARTED)) + GST_AUDIO_RING_BUFFER_STATE_STARTED)) goto not_started; } } @@ -1358,7 +1362,7 @@ G_STMT_START { \ } G_STMT_END static guint -default_commit (GstRingBuffer * buf, guint64 * sample, +default_commit (GstAudioRingBuffer * buf, guint64 * sample, guchar * data, gint in_samples, gint out_samples, gint * accum) { gint segdone; @@ -1487,8 +1491,8 @@ not_started: } /** - * gst_ring_buffer_commit_full: - * @buf: the #GstRingBuffer to commit + * gst_audio_ring_buffer_commit_full: + * @buf: the #GstAudioRingBuffer to commit * @sample: the sample position of the data * @data: the data to commit * @in_samples: the number of samples in the data to commit @@ -1522,18 +1526,18 @@ not_started: * Since: 0.10.11. */ guint -gst_ring_buffer_commit_full (GstRingBuffer * buf, guint64 * sample, +gst_audio_ring_buffer_commit_full (GstAudioRingBuffer * buf, guint64 * sample, guchar * data, gint in_samples, gint out_samples, gint * accum) { - GstRingBufferClass *rclass; + GstAudioRingBufferClass *rclass; guint res = -1; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), -1); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), -1); if (G_UNLIKELY (in_samples == 0 || out_samples == 0)) return in_samples; - rclass = GST_RING_BUFFER_GET_CLASS (buf); + rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->commit)) res = rclass->commit (buf, sample, data, in_samples, out_samples, accum); @@ -1542,13 +1546,13 @@ gst_ring_buffer_commit_full (GstRingBuffer * buf, guint64 * sample, } /** - * gst_ring_buffer_commit: - * @buf: the #GstRingBuffer to commit + * gst_audio_ring_buffer_commit: + * @buf: the #GstAudioRingBuffer to commit * @sample: the sample position of the data * @data: the data to commit * @len: the number of samples in the data to commit * - * Same as gst_ring_buffer_commit_full() but with a in_samples and out_samples + * Same as gst_audio_ring_buffer_commit_full() but with a in_samples and out_samples * equal to @len, ignoring accum. * * Returns: The number of samples written to the ringbuffer or -1 on @@ -1557,20 +1561,20 @@ gst_ring_buffer_commit_full (GstRingBuffer * buf, guint64 * sample, * MT safe. */ guint -gst_ring_buffer_commit (GstRingBuffer * buf, guint64 sample, guchar * data, - guint len) +gst_audio_ring_buffer_commit (GstAudioRingBuffer * buf, guint64 sample, + guchar * data, guint len) { guint res; guint64 samplep = sample; - res = gst_ring_buffer_commit_full (buf, &samplep, data, len, len, NULL); + res = gst_audio_ring_buffer_commit_full (buf, &samplep, data, len, len, NULL); return res; } /** - * gst_ring_buffer_read: - * @buf: the #GstRingBuffer to read from + * gst_audio_ring_buffer_read: + * @buf: the #GstAudioRingBuffer to read from * @sample: the sample position of the data * @data: where the data should be read * @len: the number of samples in data to read @@ -1589,15 +1593,15 @@ gst_ring_buffer_commit (GstRingBuffer * buf, guint64 sample, guchar * data, * MT safe. */ guint -gst_ring_buffer_read (GstRingBuffer * buf, guint64 sample, guchar * data, - guint len) +gst_audio_ring_buffer_read (GstAudioRingBuffer * buf, guint64 sample, + guchar * data, guint len) { gint segdone; gint segsize, segtotal, bpf, sps; guint8 *dest; guint to_read; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), -1); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), -1); g_return_val_if_fail (buf->memory != NULL, -1); g_return_val_if_fail (data != NULL, -1); @@ -1680,8 +1684,8 @@ not_started: } /** - * gst_ring_buffer_prepare_read: - * @buf: the #GstRingBuffer to read from + * gst_audio_ring_buffer_prepare_read: + * @buf: the #GstAudioRingBuffer to read from * @segment: the segment to read * @readptr: the pointer to the memory where samples can be read * @len: the number of bytes to read @@ -1694,17 +1698,17 @@ not_started: * MT safe. */ gboolean -gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment, +gst_audio_ring_buffer_prepare_read (GstAudioRingBuffer * buf, gint * segment, guint8 ** readptr, gint * len) { guint8 *data; gint segdone; - g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE); if (buf->callback == NULL) { /* push mode, fail when nothing is started */ - if (g_atomic_int_get (&buf->state) != GST_RING_BUFFER_STATE_STARTED) + if (g_atomic_int_get (&buf->state) != GST_AUDIO_RING_BUFFER_STATE_STARTED) return FALSE; } @@ -1734,8 +1738,8 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment, } /** - * gst_ring_buffer_advance: - * @buf: the #GstRingBuffer to advance + * gst_audio_ring_buffer_advance: + * @buf: the #GstAudioRingBuffer to advance * @advance: the number of segments written * * Subclasses should call this function to notify the fact that @@ -1744,9 +1748,9 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment, * MT safe. */ void -gst_ring_buffer_advance (GstRingBuffer * buf, guint advance) +gst_audio_ring_buffer_advance (GstAudioRingBuffer * buf, guint advance) { - g_return_if_fail (GST_IS_RING_BUFFER (buf)); + g_return_if_fail (GST_IS_AUDIO_RING_BUFFER (buf)); /* update counter */ g_atomic_int_add (&buf->segdone, advance); @@ -1757,14 +1761,14 @@ gst_ring_buffer_advance (GstRingBuffer * buf, guint advance) if (g_atomic_int_compare_and_exchange (&buf->waiting, 1, 0)) { GST_OBJECT_LOCK (buf); GST_DEBUG_OBJECT (buf, "signal waiter"); - GST_RING_BUFFER_SIGNAL (buf); + GST_AUDIO_RING_BUFFER_SIGNAL (buf); GST_OBJECT_UNLOCK (buf); } } /** - * gst_ring_buffer_clear: - * @buf: the #GstRingBuffer to clear + * gst_audio_ring_buffer_clear: + * @buf: the #GstAudioRingBuffer to clear * @segment: the segment to clear * * Clear the given segment of the buffer with silence samples. @@ -1773,11 +1777,11 @@ gst_ring_buffer_advance (GstRingBuffer * buf, guint advance) * MT safe. */ void -gst_ring_buffer_clear (GstRingBuffer * buf, gint segment) +gst_audio_ring_buffer_clear (GstAudioRingBuffer * buf, gint segment) { guint8 *data; - g_return_if_fail (GST_IS_RING_BUFFER (buf)); + g_return_if_fail (GST_IS_AUDIO_RING_BUFFER (buf)); /* no data means it's already cleared */ if (G_UNLIKELY (buf->memory == NULL)) @@ -1798,8 +1802,8 @@ gst_ring_buffer_clear (GstRingBuffer * buf, gint segment) } /** - * gst_ring_buffer_may_start: - * @buf: the #GstRingBuffer + * gst_audio_ring_buffer_may_start: + * @buf: the #GstAudioRingBuffer * @allowed: the new value * * Tell the ringbuffer that it is allowed to start playback when @@ -1810,9 +1814,9 @@ gst_ring_buffer_clear (GstRingBuffer * buf, gint segment) * Since: 0.10.6 */ void -gst_ring_buffer_may_start (GstRingBuffer * buf, gboolean allowed) +gst_audio_ring_buffer_may_start (GstAudioRingBuffer * buf, gboolean allowed) { - g_return_if_fail (GST_IS_RING_BUFFER (buf)); + g_return_if_fail (GST_IS_AUDIO_RING_BUFFER (buf)); GST_LOG_OBJECT (buf, "may start: %d", allowed); g_atomic_int_set (&buf->may_start, allowed); diff --git a/gst-libs/gst/audio/gstringbuffer.h b/gst-libs/gst/audio/gstringbuffer.h index ddd2c68..0c76d4b 100644 --- a/gst-libs/gst/audio/gstringbuffer.h +++ b/gst-libs/gst/audio/gstringbuffer.h @@ -20,54 +20,54 @@ * Boston, MA 02111-1307, USA. */ -#ifndef __GST_RING_BUFFER_H__ -#define __GST_RING_BUFFER_H__ +#ifndef __GST_AUDIO_RING_BUFFER_H__ +#define __GST_AUDIO_RING_BUFFER_H__ #include #include G_BEGIN_DECLS -#define GST_TYPE_RING_BUFFER (gst_ring_buffer_get_type()) -#define GST_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RING_BUFFER,GstRingBuffer)) -#define GST_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RING_BUFFER,GstRingBufferClass)) -#define GST_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RING_BUFFER, GstRingBufferClass)) -#define GST_RING_BUFFER_CAST(obj) ((GstRingBuffer *)obj) -#define GST_IS_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RING_BUFFER)) -#define GST_IS_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RING_BUFFER)) +#define GST_TYPE_AUDIO_RING_BUFFER (gst_audio_ring_buffer_get_type()) +#define GST_AUDIO_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_RING_BUFFER,GstAudioRingBuffer)) +#define GST_AUDIO_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_RING_BUFFER,GstAudioRingBufferClass)) +#define GST_AUDIO_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_RING_BUFFER, GstAudioRingBufferClass)) +#define GST_AUDIO_RING_BUFFER_CAST(obj) ((GstAudioRingBuffer *)obj) +#define GST_IS_AUDIO_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_RING_BUFFER)) +#define GST_IS_AUDIO_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_RING_BUFFER)) -typedef struct _GstRingBuffer GstRingBuffer; -typedef struct _GstRingBufferClass GstRingBufferClass; -typedef struct _GstRingBufferSpec GstRingBufferSpec; +typedef struct _GstAudioRingBuffer GstAudioRingBuffer; +typedef struct _GstAudioRingBufferClass GstAudioRingBufferClass; +typedef struct _GstAudioRingBufferSpec GstAudioRingBufferSpec; /** - * GstRingBufferCallback: - * @rbuf: a #GstRingBuffer + * GstAudioRingBufferCallback: + * @rbuf: a #GstAudioRingBuffer * @data: target to fill * @len: amount to fill * @user_data: user data * - * This function is set with gst_ring_buffer_set_callback() and is + * This function is set with gst_audio_ring_buffer_set_callback() and is * called to fill the memory at @data with @len bytes of samples. */ -typedef void (*GstRingBufferCallback) (GstRingBuffer *rbuf, guint8* data, guint len, gpointer user_data); +typedef void (*GstAudioRingBufferCallback) (GstAudioRingBuffer *rbuf, guint8* data, guint len, gpointer user_data); /** - * GstRingBufferState: - * @GST_RING_BUFFER_STATE_STOPPED: The ringbuffer is stopped - * @GST_RING_BUFFER_STATE_PAUSED: The ringbuffer is paused - * @GST_RING_BUFFER_STATE_STARTED: The ringbuffer is started + * GstAudioRingBufferState: + * @GST_AUDIO_RING_BUFFER_STATE_STOPPED: The ringbuffer is stopped + * @GST_AUDIO_RING_BUFFER_STATE_PAUSED: The ringbuffer is paused + * @GST_AUDIO_RING_BUFFER_STATE_STARTED: The ringbuffer is started * * The state of the ringbuffer. */ typedef enum { - GST_RING_BUFFER_STATE_STOPPED, - GST_RING_BUFFER_STATE_PAUSED, - GST_RING_BUFFER_STATE_STARTED -} GstRingBufferState; + GST_AUDIO_RING_BUFFER_STATE_STOPPED, + GST_AUDIO_RING_BUFFER_STATE_PAUSED, + GST_AUDIO_RING_BUFFER_STATE_STARTED +} GstAudioRingBufferState; /** - * GstRingBufferSegState: + * GstAudioRingBufferSegState: * @GST_SEGSTATE_INVALID: The content of the segment is invalid * @GST_SEGSTATE_EMPTY: The segment is empty * @GST_SEGSTATE_FILLED: The segment contains valid data @@ -80,7 +80,7 @@ typedef enum { GST_SEGSTATE_EMPTY, GST_SEGSTATE_FILLED, GST_SEGSTATE_PARTIAL -} GstRingBufferSegState; +} GstAudioRingBufferSegState; /** * GstBufferFormatType: @@ -116,7 +116,7 @@ typedef enum } GstBufferFormatType; /** - * GstRingBufferSpec: + * GstAudioRingBufferSpec: * @caps: The caps that generated the Spec. * @type: the sample type * @info: the #GstAudioInfo @@ -129,7 +129,7 @@ typedef enum * * The structure containing the format specification of the ringbuffer. */ -struct _GstRingBufferSpec +struct _GstAudioRingBufferSpec { /*< public >*/ /* in */ @@ -160,13 +160,13 @@ struct _GstRingBufferSpec gpointer _gst_reserved[GST_PADDING]; }; -#define GST_RING_BUFFER_GET_COND(buf) (((GstRingBuffer *)buf)->cond) -#define GST_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf))) -#define GST_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_RING_BUFFER_GET_COND (buf))) -#define GST_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_RING_BUFFER_GET_COND (buf))) +#define GST_AUDIO_RING_BUFFER_GET_COND(buf) (((GstAudioRingBuffer *)buf)->cond) +#define GST_AUDIO_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIO_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf))) +#define GST_AUDIO_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIO_RING_BUFFER_GET_COND (buf))) +#define GST_AUDIO_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIO_RING_BUFFER_GET_COND (buf))) /** - * GstRingBuffer: + * GstAudioRingBuffer: * @cond: used to signal start/stop/pause/resume actions * @open: boolean indicating that the ringbuffer is open * @acquired: boolean indicating that the ringbuffer is acquired @@ -183,41 +183,41 @@ struct _GstRingBufferSpec * * The ringbuffer base class structure. */ -struct _GstRingBuffer { - GstObject object; +struct _GstAudioRingBuffer { + GstObject object; /*< public >*/ /* with LOCK */ - GCond *cond; - gboolean open; - gboolean acquired; - guint8 *memory; - gsize size; - GstRingBufferSpec spec; - GstRingBufferSegState *segstate; - gint samples_per_seg; - guint8 *empty_seg; + GCond *cond; + gboolean open; + gboolean acquired; + guint8 *memory; + gsize size; + GstAudioRingBufferSpec spec; + GstAudioRingBufferSegState *segstate; + gint samples_per_seg; + guint8 *empty_seg; /*< public >*/ /* ATOMIC */ - gint state; - gint segdone; - gint segbase; - gint waiting; + gint state; + gint segdone; + gint segbase; + gint waiting; /*< private >*/ - GstRingBufferCallback callback; - gpointer cb_data; + GstAudioRingBufferCallback callback; + gpointer cb_data; - gboolean flushing; + gboolean flushing; /* ATOMIC */ - gint may_start; - gboolean active; + gint may_start; + gboolean active; /*< private >*/ - gpointer _gst_reserved[GST_PADDING + 0]; + gpointer _gst_reserved[GST_PADDING]; }; /** - * GstRingBufferClass: + * GstAudioRingBufferClass: * @parent_class: parent class * @open_device: open the device, don't set any params or allocate anything * @acquire: allocate the resources for the ringbuffer using the given spec @@ -235,104 +235,105 @@ struct _GstRingBuffer { * * The vmethods that subclasses can override to implement the ringbuffer. */ -struct _GstRingBufferClass { +struct _GstAudioRingBufferClass { GstObjectClass parent_class; /*< public >*/ - gboolean (*open_device) (GstRingBuffer *buf); - gboolean (*acquire) (GstRingBuffer *buf, GstRingBufferSpec *spec); - gboolean (*release) (GstRingBuffer *buf); - gboolean (*close_device) (GstRingBuffer *buf); + gboolean (*open_device) (GstAudioRingBuffer *buf); + gboolean (*acquire) (GstAudioRingBuffer *buf, GstAudioRingBufferSpec *spec); + gboolean (*release) (GstAudioRingBuffer *buf); + gboolean (*close_device) (GstAudioRingBuffer *buf); - gboolean (*start) (GstRingBuffer *buf); - gboolean (*pause) (GstRingBuffer *buf); - gboolean (*resume) (GstRingBuffer *buf); - gboolean (*stop) (GstRingBuffer *buf); + gboolean (*start) (GstAudioRingBuffer *buf); + gboolean (*pause) (GstAudioRingBuffer *buf); + gboolean (*resume) (GstAudioRingBuffer *buf); + gboolean (*stop) (GstAudioRingBuffer *buf); - guint (*delay) (GstRingBuffer *buf); + guint (*delay) (GstAudioRingBuffer *buf); /* ABI added */ - gboolean (*activate) (GstRingBuffer *buf, gboolean active); + gboolean (*activate) (GstAudioRingBuffer *buf, gboolean active); - guint (*commit) (GstRingBuffer * buf, guint64 *sample, + guint (*commit) (GstAudioRingBuffer * buf, guint64 *sample, guchar * data, gint in_samples, gint out_samples, gint * accum); - void (*clear_all) (GstRingBuffer * buf); + void (*clear_all) (GstAudioRingBuffer * buf); /*< private >*/ - gpointer _gst_reserved[GST_PADDING - 3]; + gpointer _gst_reserved[GST_PADDING]; }; -GType gst_ring_buffer_get_type(void); +GType gst_audio_ring_buffer_get_type(void); /* callback stuff */ -void gst_ring_buffer_set_callback (GstRingBuffer *buf, GstRingBufferCallback cb, - gpointer user_data); +void gst_audio_ring_buffer_set_callback (GstAudioRingBuffer *buf, + GstAudioRingBufferCallback cb, + gpointer user_data); -gboolean gst_ring_buffer_parse_caps (GstRingBufferSpec *spec, GstCaps *caps); -void gst_ring_buffer_debug_spec_caps (GstRingBufferSpec *spec); -void gst_ring_buffer_debug_spec_buff (GstRingBufferSpec *spec); +gboolean gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec *spec, GstCaps *caps); +void gst_audio_ring_buffer_debug_spec_caps (GstAudioRingBufferSpec *spec); +void gst_audio_ring_buffer_debug_spec_buff (GstAudioRingBufferSpec *spec); -gboolean gst_ring_buffer_convert (GstRingBuffer * buf, GstFormat src_fmt, - gint64 src_val, GstFormat dest_fmt, - gint64 * dest_val); +gboolean gst_audio_ring_buffer_convert (GstAudioRingBuffer * buf, GstFormat src_fmt, + gint64 src_val, GstFormat dest_fmt, + gint64 * dest_val); /* device state */ -gboolean gst_ring_buffer_open_device (GstRingBuffer *buf); -gboolean gst_ring_buffer_close_device (GstRingBuffer *buf); +gboolean gst_audio_ring_buffer_open_device (GstAudioRingBuffer *buf); +gboolean gst_audio_ring_buffer_close_device (GstAudioRingBuffer *buf); -gboolean gst_ring_buffer_device_is_open (GstRingBuffer *buf); +gboolean gst_audio_ring_buffer_device_is_open (GstAudioRingBuffer *buf); /* allocate resources */ -gboolean gst_ring_buffer_acquire (GstRingBuffer *buf, GstRingBufferSpec *spec); -gboolean gst_ring_buffer_release (GstRingBuffer *buf); +gboolean gst_audio_ring_buffer_acquire (GstAudioRingBuffer *buf, GstAudioRingBufferSpec *spec); +gboolean gst_audio_ring_buffer_release (GstAudioRingBuffer *buf); -gboolean gst_ring_buffer_is_acquired (GstRingBuffer *buf); +gboolean gst_audio_ring_buffer_is_acquired (GstAudioRingBuffer *buf); /* activating */ -gboolean gst_ring_buffer_activate (GstRingBuffer *buf, gboolean active); -gboolean gst_ring_buffer_is_active (GstRingBuffer *buf); +gboolean gst_audio_ring_buffer_activate (GstAudioRingBuffer *buf, gboolean active); +gboolean gst_audio_ring_buffer_is_active (GstAudioRingBuffer *buf); /* flushing */ -void gst_ring_buffer_set_flushing (GstRingBuffer *buf, gboolean flushing); +void gst_audio_ring_buffer_set_flushing (GstAudioRingBuffer *buf, gboolean flushing); /* playback/pause */ -gboolean gst_ring_buffer_start (GstRingBuffer *buf); -gboolean gst_ring_buffer_pause (GstRingBuffer *buf); -gboolean gst_ring_buffer_stop (GstRingBuffer *buf); +gboolean gst_audio_ring_buffer_start (GstAudioRingBuffer *buf); +gboolean gst_audio_ring_buffer_pause (GstAudioRingBuffer *buf); +gboolean gst_audio_ring_buffer_stop (GstAudioRingBuffer *buf); /* get status */ -guint gst_ring_buffer_delay (GstRingBuffer *buf); -guint64 gst_ring_buffer_samples_done (GstRingBuffer *buf); +guint gst_audio_ring_buffer_delay (GstAudioRingBuffer *buf); +guint64 gst_audio_ring_buffer_samples_done (GstAudioRingBuffer *buf); -void gst_ring_buffer_set_sample (GstRingBuffer *buf, guint64 sample); +void gst_audio_ring_buffer_set_sample (GstAudioRingBuffer *buf, guint64 sample); /* clear all segments */ -void gst_ring_buffer_clear_all (GstRingBuffer *buf); +void gst_audio_ring_buffer_clear_all (GstAudioRingBuffer *buf); /* commit samples */ -guint gst_ring_buffer_commit (GstRingBuffer *buf, guint64 sample, - guchar *data, guint len); -guint gst_ring_buffer_commit_full (GstRingBuffer * buf, guint64 *sample, - guchar * data, gint in_samples, - gint out_samples, gint * accum); +guint gst_audio_ring_buffer_commit (GstAudioRingBuffer *buf, guint64 sample, + guchar *data, guint len); +guint gst_audio_ring_buffer_commit_full (GstAudioRingBuffer * buf, guint64 *sample, + guchar * data, gint in_samples, + gint out_samples, gint * accum); /* read samples */ -guint gst_ring_buffer_read (GstRingBuffer *buf, guint64 sample, - guchar *data, guint len); +guint gst_audio_ring_buffer_read (GstAudioRingBuffer *buf, guint64 sample, + guchar *data, guint len); /* mostly protected */ /* not yet implemented -gboolean gst_ring_buffer_prepare_write (GstRingBuffer *buf, gint *segment, guint8 **writeptr, gint *len); +gboolean gst_audio_ring_buffer_prepare_write (GstAudioRingBuffer *buf, gint *segment, guint8 **writeptr, gint *len); */ -gboolean gst_ring_buffer_prepare_read (GstRingBuffer *buf, gint *segment, guint8 **readptr, gint *len); -void gst_ring_buffer_clear (GstRingBuffer *buf, gint segment); -void gst_ring_buffer_advance (GstRingBuffer *buf, guint advance); - -void gst_ring_buffer_may_start (GstRingBuffer *buf, gboolean allowed); +gboolean gst_audio_ring_buffer_prepare_read (GstAudioRingBuffer *buf, gint *segment, + guint8 **readptr, gint *len); +void gst_audio_ring_buffer_clear (GstAudioRingBuffer *buf, gint segment); +void gst_audio_ring_buffer_advance (GstAudioRingBuffer *buf, guint advance); +void gst_audio_ring_buffer_may_start (GstAudioRingBuffer *buf, gboolean allowed); G_END_DECLS -#endif /* __GST_RING_BUFFER_H__ */ +#endif /* __GST_AUDIO_RING_BUFFER_H__ */ -- 2.7.4