gboolean complete;
g_return_val_if_fail (buffer != NULL, NULL);
- g_return_val_if_fail (buffer->mini_object.refcount, NULL);
+ g_return_val_if_fail (buffer->mini_object.refcount > 0, NULL);
g_return_val_if_fail (buffer->size >= offset + size, NULL);
/* find real parent */
gst_buffer_is_span_fast (GstBuffer * buf1, GstBuffer * buf2)
{
g_return_val_if_fail (buf1 != NULL && buf2 != NULL, FALSE);
- g_return_val_if_fail (buf1->mini_object.refcount, FALSE);
- g_return_val_if_fail (buf2->mini_object.refcount, FALSE);
+ g_return_val_if_fail (buf1->mini_object.refcount > 0, FALSE);
+ g_return_val_if_fail (buf2->mini_object.refcount > 0, FALSE);
/* it's only fast if we have subbuffers of the same parent */
return (GST_IS_SUBBUFFER (buf1) &&
GstBuffer *newbuf;
g_return_val_if_fail (buf1 != NULL && buf2 != NULL, NULL);
- g_return_val_if_fail (buf1->mini_object.refcount, NULL);
- g_return_val_if_fail (buf2->mini_object.refcount, NULL);
- g_return_val_if_fail (len, NULL);
+ g_return_val_if_fail (buf1->mini_object.refcount > 0, NULL);
+ g_return_val_if_fail (buf2->mini_object.refcount > 0, NULL);
+ g_return_val_if_fail (len > 0, NULL);
g_return_val_if_fail (len <= buf1->size + buf2->size - offset, NULL);
/* if the two buffers have the same parent and are adjacent */
handler = bus->sync_handler;
handler_data = bus->sync_handler_data;
- emit_sync_message = bus->priv->num_sync_message_emitters;
+ emit_sync_message = bus->priv->num_sync_message_emitters > 0;
GST_OBJECT_UNLOCK (bus);
/* first call the sync handler if it is installed */
/* I know the callees don't take this lock, so go ahead and abuse it */
GST_OBJECT_LOCK (bus);
- if (bus->num_signal_watchers)
+ if (bus->num_signal_watchers > 0)
goto done;
/* this should not fail because the counter above takes care of it */
bus->num_signal_watchers--;
- if (bus->num_signal_watchers)
+ if (bus->num_signal_watchers > 0)
goto done;
id = bus->signal_watch_id;
GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p %d->%d", caps,
GST_CAPS_REFCOUNT_VALUE (caps), GST_CAPS_REFCOUNT_VALUE (caps) + 1);
#endif
- g_return_val_if_fail (GST_CAPS_REFCOUNT_VALUE (caps), NULL);
+ g_return_val_if_fail (GST_CAPS_REFCOUNT_VALUE (caps) > 0, NULL);
g_atomic_int_inc (&caps->refcount);
GST_CAPS_REFCOUNT_VALUE (caps), GST_CAPS_REFCOUNT_VALUE (caps) - 1);
#endif
- g_return_if_fail (GST_CAPS_REFCOUNT_VALUE (caps));
+ g_return_if_fail (GST_CAPS_REFCOUNT_VALUE (caps) > 0);
/* if we ended up with the refcount at zero, free the caps */
if (G_UNLIKELY (g_atomic_int_dec_and_test (&caps->refcount)))
G_LOCK (static_caps_lock);
/* check if other thread already updated */
- if (G_UNLIKELY (g_atomic_int_get (&caps->refcount)))
+ if (G_UNLIKELY (g_atomic_int_get (&caps->refcount) > 0))
goto done;
string = static_caps->string;
Note: there's a test that checks this behaviour. */
g_return_val_if_fail (!CAPS_IS_ANY (minuend), NULL);
sublen = subtrahend->structs->len;
- g_assert (sublen);
+ g_assert (sublen > 0);
src = gst_caps_copy (minuend);
for (i = 0; i < sublen; i++) {
for (i = 0; i < clen; i++) {
GstStructure *structure;
- if (i) {
+ if (i > 0) {
/* ';' is now added by gst_structure_to_string */
g_string_append_c (s, ' ');
}
{
g_return_if_fail (GST_IS_CLOCK (clock));
g_return_if_fail (rate_num != GST_CLOCK_TIME_NONE);
- g_return_if_fail (rate_denom && rate_denom != GST_CLOCK_TIME_NONE);
+ g_return_if_fail (rate_denom > 0 && rate_denom != GST_CLOCK_TIME_NONE);
write_seqlock (clock);
GST_CAT_DEBUG_OBJECT (GST_CAT_CLOCK, clock,
gst_mini_object_unref (GstMiniObject * mini_object)
{
g_return_if_fail (GST_IS_MINI_OBJECT (mini_object));
- g_return_if_fail (mini_object->refcount);
+ g_return_if_fail (mini_object->refcount > 0);
GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p unref %d->%d",
mini_object,
gst_object_unref (gpointer object)
{
g_return_if_fail (object != NULL);
- g_return_if_fail (((GObject *) object)->ref_count);
+ g_return_if_fail (((GObject *) object)->ref_count > 0);
#ifdef DEBUG_REFCOUNT
GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "%p unref %d->%d", object,
caps = gst_pad_data_get_caps (is_buffer, data);
caps_changed = caps && caps != GST_PAD_CAPS (pad);
- emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) != 0;
+ emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
GST_OBJECT_UNLOCK (pad);
/* see if the signal should be emited, we emit before caps nego as
/* we emit signals on the pad arg, the peer will have a chance to
* emit in the _chain() function */
- if (G_UNLIKELY (GST_PAD_DO_BUFFER_SIGNALS (pad))) {
+ if (G_UNLIKELY (GST_PAD_DO_BUFFER_SIGNALS (pad) > 0)) {
cache = NULL;
/* unlock before emitting */
GST_OBJECT_UNLOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
- emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) != 0;
+ emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
GST_OBJECT_UNLOCK (pad);
if (G_UNLIKELY ((getrangefunc = GST_PAD_GETRANGEFUNC (pad)) == NULL))
/* signal emision for the pad, peer has chance to emit when
* we call _get_range() */
- emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) != 0;
+ emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
gst_object_ref (peer);
GST_OBJECT_UNLOCK (pad);
GST_EVENT_SRC (event) = gst_object_ref (pad);
}
- if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) != 0)) {
+ if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) > 0)) {
GST_OBJECT_UNLOCK (pad);
if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (event)))
}
/* pad signals */
- if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) != 0)) {
+ if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) > 0)) {
GST_OBJECT_UNLOCK (pad);
if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT_CAST (event)))
/* FIXME 0.11: Don't recurse into directories, this behaviour
* is inconsistent with other PATH environment variables
*/
- if (level) {
+ if (level > 0) {
GST_LOG_OBJECT (context->registry, "recursing into directory %s",
filename);
changed |= gst_registry_scan_path_level (context, filename, level - 1);
|| G_VALUE_TYPE (val) == GST_TYPE_ARRAY) {
GArray *array = g_value_peek_pointer (val);
- if (array->len) {
+ if (array->len > 0) {
GValue *value = &g_array_index (array, GValue, 0);
return gst_structure_value_get_generic_type (value);
static void
gst_system_clock_wait_wakeup (GstSystemClock * sysclock)
{
- while (sysclock->priv->wakeup_count) {
+ while (sysclock->priv->wakeup_count > 0) {
GST_CLOCK_WAIT (sysclock);
}
}
return NULL;
return gst_value_list_get_value (value, index);
} else {
- if (index)
+ if (index > 0)
return NULL;
return value;
}
* part of denom since denom > G_MAXUINT32. */
s = gst_util_clz (v.l.high);
- if (s) {
+ if (s > 0) {
/* normalize divisor and dividend */
v.ll <<= s;
c1.ll = (c1.ll << s) | (c0.l.high >> (32 - s));
gst_pad_remove_data_probe (GstPad * pad, guint handler_id)
{
g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (handler_id);
+ g_return_if_fail (handler_id > 0);
GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id);
gst_pad_remove_event_probe (GstPad * pad, guint handler_id)
{
g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (handler_id);
+ g_return_if_fail (handler_id > 0);
GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id);
gst_pad_remove_buffer_probe (GstPad * pad, guint handler_id)
{
g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (handler_id);
+ g_return_if_fail (handler_id > 0);
GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id);
* Therefore, only consider it empty if it is not filled. */
return ((queue->min_threshold.buffers > 0 &&
queue->cur_level.buffers < queue->min_threshold.buffers) ||
- (queue->min_threshold.bytes &&
+ (queue->min_threshold.bytes > 0 &&
queue->cur_level.bytes < queue->min_threshold.bytes) ||
(queue->min_threshold.time > 0 &&
queue->cur_level.time < queue->min_threshold.time)) &&
static gboolean
gst_queue_is_filled (GstQueue * queue)
{
- return (((queue->max_size.buffers &&
+ return (((queue->max_size.buffers > 0 &&
queue->cur_level.buffers >= queue->max_size.buffers) ||
- (queue->max_size.bytes &&
+ (queue->max_size.bytes > 0 &&
queue->cur_level.bytes >= queue->max_size.bytes) ||
- (queue->max_size.time &&
+ (queue->max_size.time > 0 &&
queue->cur_level.time >= queue->max_size.time)));
}
* limit, the best thing we can do is to return an infinite delay. In
* reality a better estimate would be the byte/buffer rate but that is not
* possible right now. */
- if (queue->max_size.time && max != -1)
+ if (queue->max_size.time > 0 && max != -1)
max += queue->max_size.time;
else
max = -1;
/* adjust for min-threshold */
- if (queue->min_threshold.time && min != -1)
+ if (queue->min_threshold.time > 0 && min != -1)
min += queue->min_threshold.time;
gst_query_set_latency (query, live, min, max);