gst-libs/gst/audio/gstringbuffer.*: Added function to clear the ringbuffer.

Original commit message from CVS:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_set_sample),
(gst_ring_buffer_clear_all):
* gst-libs/gst/audio/gstringbuffer.h:
Added function to clear the ringbuffer.
This commit is contained in:
Wim Taymans 2005-08-24 11:29:10 +00:00
parent b45323de18
commit 5ac2327f05
3 changed files with 33 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2005-08-24 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_set_sample),
(gst_ring_buffer_clear_all):
* gst-libs/gst/audio/gstringbuffer.h:
Added function to clear the ringbuffer.
2005-08-24 Andy Wingo <wingo@pobox.com> 2005-08-24 Andy Wingo <wingo@pobox.com>
* sys/v4l/gstv4lelement.c (gst_v4lelement_start) * sys/v4l/gstv4lelement.c (gst_v4lelement_start)

View file

@ -822,8 +822,6 @@ gst_ring_buffer_samples_done (GstRingBuffer * buf)
void void
gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample) gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample)
{ {
gint i;
g_return_if_fail (buf != NULL); g_return_if_fail (buf != NULL);
if (sample == -1) if (sample == -1)
@ -838,13 +836,33 @@ gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample)
buf->segbase = buf->segdone - sample / buf->samples_per_seg; buf->segbase = buf->segdone - sample / buf->samples_per_seg;
buf->next_sample = sample; buf->next_sample = sample;
for (i = 0; i < buf->spec.segtotal; i++) { gst_ring_buffer_clear_all (buf);
gst_ring_buffer_clear (buf, i);
}
GST_DEBUG ("set sample to %llu, segbase %d", sample, buf->segbase); GST_DEBUG ("set sample to %llu, segbase %d", sample, buf->segbase);
} }
/**
* gst_ring_buffer_clear_all:
* @buf: the #GstRingBuffer to clear
*
* Fill the ringbuffer with silence.
*
* MT safe.
*/
void
gst_ring_buffer_clear_all (GstRingBuffer * buf)
{
gint i;
g_return_if_fail (buf != NULL);
g_return_if_fail (buf->spec.segtotal > 0);
for (i = 0; i < buf->spec.segtotal; i++) {
gst_ring_buffer_clear (buf, i);
}
}
static gboolean static gboolean
wait_segment (GstRingBuffer * buf) wait_segment (GstRingBuffer * buf)
{ {

View file

@ -236,6 +236,9 @@ guint64 gst_ring_buffer_samples_done (GstRingBuffer *buf);
void gst_ring_buffer_set_sample (GstRingBuffer *buf, guint64 sample); void gst_ring_buffer_set_sample (GstRingBuffer *buf, guint64 sample);
/* clear all segments */
void gst_ring_buffer_clear_all (GstRingBuffer *buf);
/* commit samples */ /* commit samples */
guint gst_ring_buffer_commit (GstRingBuffer *buf, guint64 sample, guint gst_ring_buffer_commit (GstRingBuffer *buf, guint64 sample,
guchar *data, guint len); guchar *data, guint len);