static void gst_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,
guchar * data, gint in_samples, gint out_samples, gint * accum);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_ring_buffer_dispose);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_ring_buffer_finalize);
+ gstringbuffer_class->clear_all = GST_DEBUG_FUNCPTR (default_clear_all);
gstringbuffer_class->commit = GST_DEBUG_FUNCPTR (default_commit);
}
GST_OBJECT_LOCK (buf);
buf->abidata.ABI.flushing = flushing;
- gst_ring_buffer_clear_all (buf);
if (flushing) {
gst_ring_buffer_pause_unlocked (buf);
+ } else {
+ gst_ring_buffer_clear_all (buf);
}
GST_OBJECT_UNLOCK (buf);
}
buf->segbase);
}
+static void
+default_clear_all (GstRingBuffer * buf)
+{
+ gint i;
+
+ /* not fatal, we just are not negotiated yet */
+ if (G_UNLIKELY (buf->spec.segtotal <= 0))
+ return;
+
+ GST_DEBUG_OBJECT (buf, "clear all segments");
+
+ for (i = 0; i < buf->spec.segtotal; i++) {
+ gst_ring_buffer_clear (buf, i);
+ }
+}
+
/**
* gst_ring_buffer_clear_all:
* @buf: the #GstRingBuffer to clear
void
gst_ring_buffer_clear_all (GstRingBuffer * buf)
{
- gint i;
+ GstRingBufferClass *rclass;
g_return_if_fail (GST_IS_RING_BUFFER (buf));
- /* not fatal, we just are not negotiated yet */
- if (G_UNLIKELY (buf->spec.segtotal <= 0))
- return;
-
- GST_DEBUG_OBJECT (buf, "clear all segments");
+ rclass = GST_RING_BUFFER_GET_CLASS (buf);
- for (i = 0; i < buf->spec.segtotal; i++) {
- gst_ring_buffer_clear (buf, i);
- }
+ if (G_LIKELY (rclass->clear_all))
+ rclass->clear_all (buf);
}
* @activate: activate the thread that starts pulling and monitoring the
* consumed segments in the device. Since 0.10.22
* @commit: write samples into the ringbuffer
+ * @clear_all: clear the entire ringbuffer Since 0.10.24
*
* The vmethods that subclasses can override to implement the ringbuffer.
*/
guchar * data, gint in_samples,
gint out_samples, gint * accum);
+ void (*clear_all) (GstRingBuffer * buf);
+
/*< private >*/
- gpointer _gst_reserved[GST_PADDING - 2];
+ gpointer _gst_reserved[GST_PADDING - 3];
};
GType gst_ring_buffer_get_type(void);