2006-04-28 Wim Taymans <wim@fluendo.com>
+ * gst-libs/gst/audio/gstringbuffer.c:
+ (gst_ring_buffer_set_callback), (gst_ring_buffer_acquire),
+ (gst_ring_buffer_release), (gst_ring_buffer_is_acquired),
+ (gst_ring_buffer_set_flushing), (gst_ring_buffer_start),
+ (gst_ring_buffer_pause), (gst_ring_buffer_stop),
+ (gst_ring_buffer_delay), (gst_ring_buffer_samples_done),
+ (gst_ring_buffer_set_sample), (gst_ring_buffer_clear_all),
+ (gst_ring_buffer_commit), (gst_ring_buffer_read),
+ (gst_ring_buffer_prepare_read), (gst_ring_buffer_advance),
+ (gst_ring_buffer_clear), (gst_ring_buffer_may_start):
+ Check arguments passed to public functions instead of
+ crashing.
+
+2006-04-28 Wim Taymans <wim@fluendo.com>
+
* gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_init),
(gst_base_audio_src_get_time), (gst_base_audio_src_create):
GstBaseAudioSrc must be live or it does not work.
gst_ring_buffer_set_callback (GstRingBuffer * buf, GstRingBufferCallback cb,
gpointer user_data)
{
- g_return_if_fail (buf != NULL);
+ g_return_if_fail (GST_IS_RING_BUFFER (buf));
GST_OBJECT_LOCK (buf);
buf->callback = cb;
gint i, j;
gint segsize, bps;
- g_return_val_if_fail (buf != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
GST_DEBUG_OBJECT (buf, "acquiring device");
gboolean res = FALSE;
GstRingBufferClass *rclass;
- g_return_val_if_fail (buf != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
GST_DEBUG_OBJECT (buf, "releasing device");
{
gboolean res;
- g_return_val_if_fail (buf != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
GST_OBJECT_LOCK (buf);
res = buf->acquired;
void
gst_ring_buffer_set_flushing (GstRingBuffer * buf, gboolean flushing)
{
+ g_return_if_fail (GST_IS_RING_BUFFER (buf));
+
GST_OBJECT_LOCK (buf);
buf->abidata.ABI.flushing = flushing;
GstRingBufferClass *rclass;
gboolean resume = FALSE;
- g_return_val_if_fail (buf != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
GST_DEBUG_OBJECT (buf, "starting ringbuffer");
{
gboolean res = FALSE;
- g_return_val_if_fail (buf != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
GST_OBJECT_LOCK (buf);
if (G_UNLIKELY (buf->abidata.ABI.flushing))
gboolean res = FALSE;
GstRingBufferClass *rclass;
- g_return_val_if_fail (buf != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
GST_DEBUG_OBJECT (buf, "stopping");
GstRingBufferClass *rclass;
guint res;
- g_return_val_if_fail (buf != NULL, 0);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), 0);
res = 0;
guint64 raw, samples;
guint delay;
- g_return_val_if_fail (buf != NULL, 0);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), 0);
/* get the amount of segments we processed */
segdone = g_atomic_int_get (&buf->segdone);
void
gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample)
{
- g_return_if_fail (buf != NULL);
+ g_return_if_fail (GST_IS_RING_BUFFER (buf));
if (sample == -1)
sample = 0;
{
gint i;
- g_return_if_fail (buf != NULL);
+ g_return_if_fail (GST_IS_RING_BUFFER (buf));
/* not fatal, we just are not negotiated yet */
if (G_UNLIKELY (buf->spec.segtotal <= 0))
guint8 *dest;
guint to_write;
- g_return_val_if_fail (buf != NULL, -1);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), -1);
g_return_val_if_fail (buf->data != NULL, -1);
g_return_val_if_fail (data != NULL, -1);
gint segsize, segtotal, bps, sps;
guint8 *dest;
- g_return_val_if_fail (buf != NULL, -1);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), -1);
g_return_val_if_fail (buf->data != NULL, -1);
g_return_val_if_fail (data != NULL, -1);
guint8 *data;
gint segdone;
- g_return_val_if_fail (buf != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
/* buffer must be started */
if (g_atomic_int_get (&buf->state) != GST_RING_BUFFER_STATE_STARTED)
void
gst_ring_buffer_advance (GstRingBuffer * buf, guint advance)
{
- g_return_if_fail (buf != NULL);
+ g_return_if_fail (GST_IS_RING_BUFFER (buf));
/* update counter */
g_atomic_int_add (&buf->segdone, advance);
{
guint8 *data;
- g_return_if_fail (buf != NULL);
+ g_return_if_fail (GST_IS_RING_BUFFER (buf));
/* no data means it's already cleared */
if (G_UNLIKELY (buf->data == NULL))
void
gst_ring_buffer_may_start (GstRingBuffer * buf, gboolean allowed)
{
+ g_return_if_fail (GST_IS_RING_BUFFER (buf));
+
GST_LOG_OBJECT (buf, "may start: %d", allowed);
gst_atomic_int_set (&buf->abidata.ABI.may_start, allowed);
}