+2005-11-21 Andy Wingo <wingo@pobox.com>
+
+ * *.h:
+ * *.c: Ran scripts/update-macros. Oh yes.
+
+ * gst/gstobject.h (GST_OBJECT_GET_LOCK, GST_OBJECT_LOCK)
+ (GST_OBJECT_TRYLOCK, GST_OBJECT_UNLOCK): Renamed from
+ GST_GET_LOCK, etc.
+
+ * scripts/update-macros: New script. Run it on your files to
+ change GST_LOCK to GST_OBJECT_LOCK, and the same for UNLOCK as
+ well.
+
2005-11-21 Stefan Kost <ensonic@users.sf.net>
* docs/gst/Makefile.am:
fail_unless (gst_bin_add (GST_BIN (b1), sink));
fail_unless (gst_element_link_pads (src, NULL, i1, NULL));
fail_unless (gst_element_link_pads (i1, NULL, sink, NULL));
- GST_LOCK (b2);
+ GST_OBJECT_LOCK (b2);
fail_unless (b2->numsinkpads == 1);
fail_unless (GST_IS_GHOST_PAD (b2->sinkpads->data));
fail_unless (b2->numsrcpads == 1);
fail_unless (GST_IS_GHOST_PAD (b2->srcpads->data));
- GST_UNLOCK (b2);
+ GST_OBJECT_UNLOCK (b2);
fsrc = gst_element_get_pad (src, "src");
fail_unless (fsrc != NULL);
/* start looping and set/get name repeatedly */
for (i = 0; i < 1000; ++i) {
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
g_free (GST_OBJECT_NAME (object));
GST_OBJECT_NAME (object) = g_strdup ("main");
THREAD_SWITCH ();
name = g_strdup (GST_OBJECT_NAME (object));
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
fail_unless (strcmp (name, "main") == 0,
"Name got changed while lock held during run %d", i);
{
gint result;
- GST_LOCK (o);
- GST_LOCK (p);
+ GST_OBJECT_LOCK (o);
+ GST_OBJECT_LOCK (p);
if (o->name == NULL && p->name == NULL) {
result = 0;
result = strcmp (o->name, p->name);
}
- GST_UNLOCK (p);
- GST_UNLOCK (o);
+ GST_OBJECT_UNLOCK (p);
+ GST_OBJECT_UNLOCK (o);
return result;
}
internal consistency when multiple threads call API function on the object.
For objects that extend the GStreamer base object class this lock can be
- obtained with the macros GST_LOCK() and GST_UNLOCK(). For other object that do
+ obtained with the macros GST_OBJECT_LOCK() and GST_OBJECT_UNLOCK(). For other object that do
not extend from the base GstObject class these macros can be different.
* refcounting
Accessing the property is therefore allowed with the following code example:
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
direction = GST_RPAD_DIRECTION (pad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
* Property lifetime
lock is released, the peer could be unreffed and disposed, making the
pointer obtained in the critical section point to invalid memory.
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
peer = GST_RPAD_PEER (pad);
if (peer)
gst_object_ref (GST_OBJECT (peer));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
... use peer ...
if (peer)
Accessing the name of an object makes a copy of the name. The caller of the
function should g_free() the name after usage.
- GST_LOCK (object)
+ GST_OBJECT_LOCK (object)
name = g_strdup (object->name);
- GST_UNLOCK (object)
+ GST_OBJECT_UNLOCK (object)
... use name ...
g_free (name);
that whenever we reacquire the lock, we check for updates to the cookie to
decide if we are still iterating the right list.
- GST_LOCK (lock);
+ GST_OBJECT_LOCK (lock);
/* grab list and cookie */
cookie = object->list_cookie;
list = object-list;
GstObject *item = GST_OBJECT (list->data);
/* need to ref the item before releasing the lock */
gst_object_ref (item);
- GST_UNLOCK (lock);
+ GST_OBJECT_UNLOCK (lock);
... use/change item here...
/* release item here */
gst_object_unref (item);
- GST_LOCK (lock);
+ GST_OBJECT_LOCK (lock);
if (cookie != object->list_cookie) {
/* handle rollback caused by concurrent modification
* of the list here */
list = g_list_next (list);
}
}
- GST_UNLOCK (lock);
+ GST_OBJECT_UNLOCK (lock);
* GstIterator
GST_CLASS_LOCK
GST_CLASS_TRYLOCK
GST_CLASS_UNLOCK
-GST_LOCK
+GST_OBJECT_LOCK
GST_TRYLOCK
-GST_UNLOCK
-GST_GET_LOCK
+GST_OBJECT_UNLOCK
+GST_OBJECT_GET_LOCK
gst_object_set_name
gst_object_get_name
functions, e.g. object properties. Be sure to lock properly here,
since applications will change those properties in a different thread
than the thread which does the actual data passing! You can use the
- <function>GST_LOCK ()</function> and <function>GST_UNLOCK
+ <function>GST_OBJECT_LOCK ()</function> and <function>GST_OBJECT_UNLOCK
()</function> helpers in most cases, fortunately, which grabs the
default property lock of the element.
</para>
// the queue is empty
while (!queue->level_buffers) {
STATUS("queue: %s U released lock\n");
- GST_UNLOCK (queue);
+ GST_OBJECT_UNLOCK (queue);
// thread1 is scheduled and puts a lot of buffers
// in the queue
queue->level_buffers++;
/* we can unlock now */
- GST_UNLOCK (queue);
+ GST_OBJECT_UNLOCK (queue);
if (tosignal) {
g_mutex_lock (queue->emptylock);
// wait forever
g_cond_wait (queue->emptycond, queue->emptylock);
g_mutex_unlock (queue->emptylock);
- GST_LOCK (queue);
+ GST_OBJECT_LOCK (queue);
}
The following pseudo code shows an algorithm for commiting the state
change in the streaming method.
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
/* if we are going to PAUSED, we can commit the state change */
if (GST_STATE_TRANSITION (element) == GST_STATE_READY_TO_PAUSED) {
gst_element_commit_state (element);
/* here we wait for the next state change */
do {
- g_cond_wait (element->state_cond, GST_GET_LOCK (element));
+ g_cond_wait (element->state_cond, GST_OBJECT_GET_LOCK (element));
} while (GST_STATE (element) == GST_STATE_PAUSED);
/* check if we got playing */
if (GST_STATE (element) != GST_STATE_PLAYING) {
/* not playing, we can't accept the buffer */
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
gst_buffer_unref (buf);
return GST_FLOW_WRONG_STATE;
}
}
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
{
GstBaseSink *sink = GST_BASE_SINK (object);
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
switch (prop_id) {
case PROP_PREROLL_QUEUE_LEN:
g_value_set_uint (value, sink->preroll_queue_max_len);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
}
static GstCaps *
gboolean post_paused = FALSE;
gboolean post_playing = FALSE;
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
current = GST_STATE (basesink);
next = GST_STATE_NEXT (basesink);
pending = GST_STATE_PENDING (basesink);
GST_STATE_PENDING (basesink) = GST_STATE_VOID_PENDING;
GST_STATE_RETURN (basesink) = GST_STATE_CHANGE_SUCCESS;
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
if (post_paused) {
message = gst_message_new_state_changed (GST_OBJECT_CAST (basesink),
stopping:
{
/* app is going to READY */
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
return FALSE;
}
}
if (!gst_base_sink_commit_state (basesink))
goto stopping;
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
/* it is possible that commiting the state made us go to PLAYING
* now in which case we don't need to block anymore. */
GST_DEBUG_OBJECT (basesink, "waiting to finish preroll");
GST_PREROLL_WAIT (pad);
GST_DEBUG_OBJECT (basesink, "done preroll");
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
}
GST_PREROLL_UNLOCK (pad);
}
flushing:
{
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
gst_base_sink_preroll_queue_flush (basesink, pad);
GST_PREROLL_UNLOCK (pad);
GST_DEBUG_OBJECT (basesink, "pad is flushing");
if (bclass->event)
bclass->event (basesink, event);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
basesink->flushing = TRUE;
if (basesink->clock_id) {
gst_clock_id_unschedule (basesink->clock_id);
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
GST_PREROLL_LOCK (pad);
/* we need preroll after the flush */
/* now we are completely unblocked and the _chain method
* will return */
GST_STREAM_LOCK (pad);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
basesink->flushing = FALSE;
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
/* we need new segment info after the flush. */
basesink->segment_start = -1;
basesink->segment_stop = -1;
basesink->clock_id = id;
/* release the object lock while waiting */
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
ret = gst_clock_id_wait (id, NULL);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
gst_clock_id_unref (id);
basesink->clock_id = NULL;
if (basesink->clock) {
GstClockTime base_time;
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
base_time = GST_ELEMENT_CAST (basesink)->base_time;
result = gst_base_sink_wait (basesink, stream_start + base_time);
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
GST_LOG_OBJECT (basesink, "clock entry done: %d", result);
} else {
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
if (basesink->clock) {
/* wait for last buffer to finish if we have a valid end time */
if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) {
basesink->end_time = GST_CLOCK_TIME_NONE;
}
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
break;
default:
break;
basesink = GST_BASE_SINK (gst_pad_get_parent (pad));
if (!(basesink->pad_mode == GST_ACTIVATE_PUSH)) {
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
g_warning ("Push on pad %s:%s, but it was not activated in push mode",
GST_DEBUG_PAD_NAME (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
result = GST_FLOW_UNEXPECTED;
goto done;
}
/* step 1, unblock clock sync (if any) or any other blocking thing */
GST_PREROLL_LOCK (pad);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
if (basesink->clock_id) {
gst_clock_id_unschedule (basesink->clock_id);
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
/* unlock any subclasses */
if (bclass->unlock)
GstBaseSink *basesink = GST_BASE_SINK (element);
gboolean result;
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
pad = basesink->sinkpad;
gst_object_ref (pad);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
result = gst_pad_push_event (pad, event);
case GST_FORMAT_TIME:
{
/* we can answer time format */
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
if ((clock = GST_ELEMENT_CLOCK (basesink))) {
GstClockTime now;
gint64 segment_time;
gst_object_ref (clock);
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
now = gst_clock_get_time (clock);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
if (GST_CLOCK_TIME_IS_VALID (basesink->segment_time))
segment_time = basesink->segment_time;
else
res = TRUE;
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
}
default:
break;
bclass = GST_BASE_SINK_GET_CLASS (basesink);
GST_PREROLL_LOCK (basesink->sinkpad);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
/* unlock clock wait if any */
if (basesink->clock_id) {
gst_clock_id_unschedule (basesink->clock_id);
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
/* unlock any subclasses */
if (bclass->unlock)
basesrc->clock_id = id;
/* release the object lock while waiting */
- GST_UNLOCK (basesrc);
+ GST_OBJECT_UNLOCK (basesrc);
ret = gst_clock_id_wait (id, NULL);
- GST_LOCK (basesrc);
+ GST_OBJECT_LOCK (basesrc);
gst_clock_id_unref (id);
basesrc->clock_id = NULL;
", end: %" GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (end));
/* now do clocking */
- GST_LOCK (basesrc);
+ GST_OBJECT_LOCK (basesrc);
base_time = GST_ELEMENT_CAST (basesrc)->base_time;
GST_LOG_OBJECT (basesrc,
GST_TIME_ARGS (base_time), GST_TIME_ARGS (start));
result = gst_base_src_wait (basesrc, start + base_time);
- GST_UNLOCK (basesrc);
+ GST_OBJECT_UNLOCK (basesrc);
GST_LOG_OBJECT (basesrc, "clock entry done: %d", result);
GST_DEBUG ("live source unlocked");
}
/* FIXME, use another variable to signal stopping */
- GST_LOCK (src->srcpad);
+ GST_OBJECT_LOCK (src->srcpad);
if (GST_PAD_IS_FLUSHING (src->srcpad))
goto flushing;
- GST_UNLOCK (src->srcpad);
+ GST_OBJECT_UNLOCK (src->srcpad);
}
GST_LIVE_UNLOCK (src);
flushing:
{
GST_DEBUG_OBJECT (src, "pad is flushing");
- GST_UNLOCK (src->srcpad);
+ GST_OBJECT_UNLOCK (src->srcpad);
GST_LIVE_UNLOCK (src);
return GST_FLOW_WRONG_STATE;
}
GST_DEBUG ("unschedule clock");
/* and unblock the clock as well, if any */
- GST_LOCK (basesrc);
+ GST_OBJECT_LOCK (basesrc);
if (basesrc->clock_id) {
gst_clock_id_unschedule (basesrc->clock_id);
}
- GST_UNLOCK (basesrc);
+ GST_OBJECT_UNLOCK (basesrc);
GST_DEBUG ("unlock done");
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad))
trans->have_same_caps =
gst_caps_is_equal (GST_PAD_CAPS (trans->sinkpad),
trans->segment_stop = -1;
trans->segment_base = 0;
trans->segment_accum = 0;
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
if (passthrough == FALSE) {
if (bclass->transform_ip || bclass->transform)
trans->passthrough = FALSE;
}
GST_DEBUG_OBJECT (trans, "set passthrough %d", trans->passthrough);
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
}
/**
g_return_val_if_fail (trans != NULL, FALSE);
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
result = trans->passthrough;
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
return result;
}
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
if (in_place) {
if (bclass->transform_ip) {
}
}
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
}
/**
g_return_val_if_fail (trans != NULL, FALSE);
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
result = trans->always_in_place;
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
return result;
}
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECT_PADS (pads));
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->func = func;
pads->user_data = user_data;
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
}
/**
data->pad = pad;
data->buffer = NULL;
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->data = g_slist_append (pads->data, data);
gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_collect_pads_chain));
gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_collect_pads_event));
gst_pad_set_element_private (pad, data);
pads->numpads++;
pads->cookie++;
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
return data;
}
g_return_val_if_fail (pad != NULL, FALSE);
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
list = g_slist_find_custom (pads->data, pad, (GCompareFunc) find_pad);
if (list) {
g_free (list->data);
}
pads->numpads--;
pads->cookie++;
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
return list != NULL;
}
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECT_PADS (pads));
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->started = TRUE;
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
}
/**
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECT_PADS (pads));
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->started = FALSE;
GST_COLLECT_PADS_BROADCAST (pads);
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
}
/**
{
GstFlowReturn ret = GST_FLOW_OK;
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->eospads++;
ret = pads->func (pads, pads->user_data);
}
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
/* We eat this event */
gst_event_unref (event);
pads = data->collect;
size = GST_BUFFER_SIZE (buffer);
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
/* if not started, bail out */
if (!pads->started)
GST_DEBUG ("Not all active pads have data, continuing");
ret = GST_FLOW_OK;
}
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
return ret;
}
not_started:
{
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
GST_DEBUG ("collect_pads not started");
return GST_FLOW_WRONG_STATE;
}
typedef GstFlowReturn (*GstCollectPadsFunction) (GstCollectPads *pads, gpointer user_data);
#define GST_COLLECT_PADS_GET_COND(pads) (((GstCollectPads *)pads)->cond)
-#define GST_COLLECT_PADS_WAIT(pads) (g_cond_wait (GST_COLLECT_PADS_GET_COND (pads), GST_GET_LOCK (pads)))
+#define GST_COLLECT_PADS_WAIT(pads) (g_cond_wait (GST_COLLECT_PADS_GET_COND (pads), GST_OBJECT_GET_LOCK (pads)))
#define GST_COLLECT_PADS_SIGNAL(pads) (g_cond_signal (GST_COLLECT_PADS_GET_COND (pads)))
#define GST_COLLECT_PADS_BROADCAST(pads)(g_cond_broadcast (GST_COLLECT_PADS_GET_COND (pads)))
g_value_set_boolean (value, sink->signal_handoffs);
break;
case PROP_LAST_MESSAGE:
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
g_value_set_string (value, sink->last_message);
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
break;
case PROP_CAN_ACTIVATE_PUSH:
g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_push);
const GstStructure *s;
gchar *sstr;
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
g_free (sink->last_message);
if ((s = gst_event_get_structure (event)))
g_strdup_printf ("event ******* E (type: %d, %s) %p",
GST_EVENT_TYPE (event), sstr, event);
g_free (sstr);
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
GstFakeSink *sink = GST_FAKE_SINK (bsink);
if (!sink->silent) {
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
g_free (sink->last_message);
sink->last_message = g_strdup_printf ("preroll ******* ");
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
if (!sink->silent) {
gchar ts_str[64], dur_str[64];
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
g_free (sink->last_message);
if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
G_GINT64_FORMAT ", flags: %d) %p", GST_BUFFER_SIZE (buf), ts_str,
dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
GST_MINI_OBJECT (buf)->flags, buf);
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
case GST_STATE_CHANGE_READY_TO_NULL:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL)
goto error;
- GST_LOCK (fakesink);
+ GST_OBJECT_LOCK (fakesink);
g_free (fakesink->last_message);
fakesink->last_message = NULL;
- GST_UNLOCK (fakesink);
+ GST_OBJECT_UNLOCK (fakesink);
break;
default:
break;
const GstStructure *s;
gchar *sstr;
- GST_LOCK (src);
+ GST_OBJECT_LOCK (src);
g_free (src->last_message);
if ((s = gst_event_get_structure (event)))
g_strdup_printf ("event ******* E (type: %d, %s) %p",
GST_EVENT_TYPE (event), sstr, event);
g_free (sstr);
- GST_UNLOCK (src);
+ GST_OBJECT_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
}
g_value_set_boolean (value, src->dump);
break;
case PROP_LAST_MESSAGE:
- GST_LOCK (src);
+ GST_OBJECT_LOCK (src);
g_value_set_string (value, src->last_message);
- GST_UNLOCK (src);
+ GST_OBJECT_UNLOCK (src);
break;
case PROP_CAN_ACTIVATE_PUSH:
g_value_set_boolean (value, GST_BASE_SRC (src)->can_activate_push);
if (!src->silent) {
gchar ts_str[64], dur_str[64];
- GST_LOCK (src);
+ GST_OBJECT_LOCK (src);
g_free (src->last_message);
if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
G_GINT64_FORMAT ", flags: %d) %p", GST_BUFFER_SIZE (buf), ts_str,
dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
GST_MINI_OBJECT (buf)->flags, buf);
- GST_UNLOCK (src);
+ GST_OBJECT_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
}
src = GST_FAKE_SRC (basesrc);
- GST_LOCK (src);
+ GST_OBJECT_LOCK (src);
if (src->parent) {
gst_buffer_unref (src->parent);
src->parent = NULL;
}
g_free (src->last_message);
src->last_message = NULL;
- GST_UNLOCK (src);
+ GST_OBJECT_UNLOCK (src);
return TRUE;
}
const GstStructure *s;
gchar *sstr;
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
if ((s = gst_event_get_structure (event)))
GST_DEBUG_PAD_NAME (trans->sinkpad), GST_EVENT_TYPE (event), sstr,
event);
g_free (sstr);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
g_object_notify (G_OBJECT (identity), "last_message");
}
if (identity->drop_probability > 0.0) {
if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
identity->last_message =
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, timestamp: %"
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
GST_BUFFER_FLAGS (buf), buf);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
g_object_notify (G_OBJECT (identity), "last-message");
return GST_FLOW_OK;
}
}
if (!identity->silent) {
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
identity->last_message =
g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, timestamp: %"
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
GST_BUFFER_FLAGS (buf), buf);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
g_object_notify (G_OBJECT (identity), "last-message");
}
if (identity->sync) {
GstClock *clock;
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
if ((clock = GST_ELEMENT (identity)->clock)) {
GstClockReturn cret;
GstClockTime timestamp;
/* save id if we need to unlock */
/* FIXME: actually unlock this somewhere in the state changes */
identity->clock_id = gst_clock_new_single_shot_id (clock, timestamp);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
cret = gst_clock_id_wait (identity->clock_id, NULL);
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
if (identity->clock_id) {
gst_clock_id_unref (identity->clock_id);
identity->clock_id = NULL;
if (cret == GST_CLOCK_UNSCHEDULED)
ret = GST_FLOW_UNEXPECTED;
}
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
}
identity->offset += GST_BUFFER_SIZE (buf);
g_value_set_boolean (value, identity->dump);
break;
case PROP_LAST_MESSAGE:
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_value_set_string (value, identity->last_message);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
break;
case PROP_SYNC:
g_value_set_boolean (value, identity->sync);
identity = GST_IDENTITY (trans);
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
identity->last_message = NULL;
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
return TRUE;
}
tee = GST_TEE (element);
- GST_LOCK (tee);
+ GST_OBJECT_LOCK (tee);
name = g_strdup_printf ("src%d", tee->pad_counter++);
- GST_UNLOCK (tee);
+ GST_OBJECT_UNLOCK (tee);
srcpad = gst_pad_new_from_template (templ, name);
g_free (name);
{
GstTee *tee = GST_TEE (object);
- GST_LOCK (tee);
+ GST_OBJECT_LOCK (tee);
switch (prop_id) {
case PROP_HAS_SINK_LOOP:
tee->has_sink_loop = g_value_get_boolean (value);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_UNLOCK (tee);
+ GST_OBJECT_UNLOCK (tee);
}
static void
{
GstTee *tee = GST_TEE (object);
- GST_LOCK (tee);
+ GST_OBJECT_LOCK (tee);
switch (prop_id) {
case PROP_NUM_SRC_PADS:
g_value_set_int (value, GST_ELEMENT (tee)->numsrcpads);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_UNLOCK (tee);
+ GST_OBJECT_UNLOCK (tee);
}
typedef struct
bin = GST_BIN_CAST (child_proxy);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
if ((res = g_list_nth_data (bin->children, index)))
gst_object_ref (res);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return res;
}
bin = GST_BIN_CAST (child_proxy);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
num = bin->numchildren;
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return num;
}
bin = GST_BIN (element);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
for (children = bin->children; children; children = g_list_next (children)) {
GstElement *child = GST_ELEMENT (children->data);
gst_element_set_index (child, index);
}
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
}
#endif
bin = GST_BIN (element);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
if (element->clock != clock) {
for (children = bin->children; children; children = g_list_next (children)) {
GstElement *child = GST_ELEMENT (children->data);
gst_element_set_clock (child, clock);
}
}
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
}
/* get the clock for this bin by asking all of the children in this bin
bin = GST_BIN (element);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
if (!bin->clock_dirty)
goto not_dirty;
(GstObject *) provider);
bin->clock_dirty = FALSE;
GST_DEBUG_OBJECT (bin, "provided new clock %p", result);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
gst_iterator_free (it);
if ((result = bin->provided_clock))
gst_object_ref (result);
GST_DEBUG_OBJECT (bin, "returning old clock %p", result);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return result;
}
goto adding_itself;
/* get the element name to make sure it is unique in this bin. */
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
elem_name = g_strdup (GST_ELEMENT_NAME (element));
is_sink = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_IS_SINK);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
/* then check to see if the element's name is already taken in the bin,
* we can safely take the lock here. This check is probably bogus because
gst_element_set_base_time (element, GST_ELEMENT (bin)->base_time);
gst_element_set_clock (element, GST_ELEMENT_CLOCK (bin));
bin->state_dirty = TRUE;
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
if (clock_message) {
gst_element_post_message (GST_ELEMENT_CAST (bin), clock_message);
/* ERROR handling here */
adding_itself:
{
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
g_warning ("Cannot add bin %s to itself", GST_ELEMENT_NAME (bin));
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return FALSE;
}
duplicate_name:
{
g_warning ("Name %s is not unique in bin %s, not adding",
elem_name, GST_ELEMENT_NAME (bin));
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
g_free (elem_name);
return FALSE;
}
had_parent:
{
g_warning ("Element %s already has parent", elem_name);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
g_free (elem_name);
return FALSE;
}
gboolean is_sink;
GstMessage *clock_message = NULL;
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
/* Check if the element is already being removed and immediately
* return */
if (G_UNLIKELY (GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_UNPARENTING)))
/* grab element name so we can print it */
elem_name = g_strdup (GST_ELEMENT_NAME (element));
is_sink = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_IS_SINK);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
/* unlink all linked pads */
it = gst_element_iterate_pads (element);
gst_iterator_foreach (it, (GFunc) unlink_pads, element);
gst_iterator_free (it);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
/* the element must be in the bin's list of children */
if (G_UNLIKELY (g_list_find (bin->children, element) == NULL))
goto not_in_bin;
gst_message_new_clock_lost (GST_OBJECT_CAST (bin), bin->provided_clock);
}
bin->state_dirty = TRUE;
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
if (clock_message) {
gst_element_post_message (GST_ELEMENT_CAST (bin), clock_message);
gst_object_ref (element);
gst_object_unparent (GST_OBJECT_CAST (element));
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
GST_OBJECT_FLAG_UNSET (element, GST_ELEMENT_UNPARENTING);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
g_signal_emit (G_OBJECT (bin), gst_bin_signals[ELEMENT_REMOVED], 0, element);
{
g_warning ("Element %s is not in bin %s", elem_name,
GST_ELEMENT_NAME (bin));
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
g_free (elem_name);
return FALSE;
}
already_removing:
{
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return FALSE;
}
}
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
/* add ref because the iterator refs the bin. When the iterator
* is freed it will unref the bin again using the provided dispose
* function. */
gst_object_ref (bin);
result = gst_iterator_new_list (GST_TYPE_ELEMENT,
- GST_GET_LOCK (bin),
+ GST_OBJECT_GET_LOCK (bin),
&bin->children_cookie,
&bin->children,
bin,
(GstIteratorItemFunction) iterate_child,
(GstIteratorDisposeFunction) gst_object_unref);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return result;
}
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
/* add ref because the iterator refs the bin. When the iterator
* is freed it will unref the bin again using the provided dispose
* function. */
gst_object_ref (bin);
result = gst_iterator_new_list (GST_TYPE_ELEMENT,
- GST_GET_LOCK (bin),
+ GST_OBJECT_GET_LOCK (bin),
&bin->children_cookie,
&bin->children,
bin,
(GstIteratorItemFunction) iterate_child_recurse,
(GstIteratorDisposeFunction) gst_object_unref);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return result;
}
/* we lock the child here for the remainder of the function to
* get its name and flag safely. */
- GST_LOCK (child);
+ GST_OBJECT_LOCK (child);
is_sink = GST_OBJECT_FLAG_IS_SET (child, GST_ELEMENT_IS_SINK);
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin,
"child %s %s sink", GST_OBJECT_NAME (child), is_sink ? "is" : "is not");
- GST_UNLOCK (child);
+ GST_OBJECT_UNLOCK (child);
return is_sink ? 0 : 1;
}
ret = GST_STATE_CHANGE_SUCCESS;
/* lock bin, no element can be added or removed while we have this lock */
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
/* forced recalc, make state dirty again */
if (force)
bin->state_dirty = TRUE;
gst_object_ref (child);
/* now we release the lock to enter a non blocking wait. We
* release the lock anyway since we can. */
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
ret = gst_element_get_state (child, NULL, NULL, 0);
gst_object_unref (child);
/* now grab the lock to iterate to the next child */
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
if (G_UNLIKELY (children_cookie != bin->children_cookie)) {
/* child added/removed during state change, restart. We need
* to restart with the quick check as a no-preroll element could
done:
bin->polling = FALSE;
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
/* now we can take the state lock, it is possible that new elements
* are added now and we still report the old state. No problem though as
not_dirty:
{
GST_CAT_INFO_OBJECT (GST_CAT_STATES, bin, "not dirty");
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return;
}
was_polling:
{
GST_CAT_INFO_OBJECT (GST_CAT_STATES, bin, "was polling");
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return;
}
concurrent_state:
{
GST_CAT_INFO_OBJECT (GST_CAT_STATES, bin, "concurrent_state");
bin->polling = FALSE;
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return;
}
unknown_state:
gboolean is_sink;
/* sinks are added right away */
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
is_sink = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_IS_SINK);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
if (is_sink) {
add_to_queue (bit, element);
{
gboolean linked = FALSE;
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
/* don't touch degree if element has no sourcepads */
if (element->numsinkpads != 0) {
/* loop over all sinkpads, decrement degree for all connected
GstElement *peer_element;
if ((peer_element = gst_pad_get_parent_element (peer))) {
- GST_LOCK (peer_element);
+ GST_OBJECT_LOCK (peer_element);
/* check that we don't go outside of this bin */
if (GST_OBJECT_CAST (peer_element)->parent ==
GST_OBJECT_CAST (bit->bin)) {
}
linked = TRUE;
}
- GST_UNLOCK (peer_element);
+ GST_OBJECT_UNLOCK (peer_element);
gst_object_unref (peer_element);
}
gst_object_unref (peer);
GST_DEBUG_OBJECT (bit->bin, "element %s not linked on any sinkpads",
GST_ELEMENT_NAME (element));
}
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
}
/* find the next best element not handled yet. This is the one
result = (GstBinSortIterator *)
gst_iterator_new (sizeof (GstBinSortIterator),
GST_TYPE_ELEMENT,
- GST_GET_LOCK (bin),
+ GST_OBJECT_GET_LOCK (bin),
&bin->children_cookie,
(GstIteratorNextFunction) gst_bin_sort_iterator_next,
(GstIteratorItemFunction) NULL,
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
result = gst_bin_sort_iterator_new (bin);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
return result;
}
gboolean locked;
/* peel off the locked flag */
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
locked = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_LOCKED_STATE);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
/* skip locked elements */
if (G_UNLIKELY (locked)) {
/* Clear message list on next PAUSED */
if (next == GST_STATE_PAUSED) {
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
GST_DEBUG_OBJECT (element, "clearing EOS elements");
bin_remove_messages (bin, NULL, GST_MESSAGE_EOS);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
}
/* iterate in state change order */
gboolean eos;
/* collect all eos messages from the children */
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
bin_replace_message (bin, message, GST_MESSAGE_EOS);
eos = is_eos (bin);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
/* if we are completely EOS, we forward an EOS message */
if (eos) {
GST_DEBUG_OBJECT (bin, "%s gave state dirty", GST_ELEMENT_NAME (src));
/* mark the bin dirty */
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
GST_DEBUG_OBJECT (bin, "marking dirty");
bin->state_dirty = TRUE;
gst_object_ref (bin);
GST_DEBUG_OBJECT (bin, "pushing recalc on thread pool");
g_thread_pool_push (klass->pool, bin, NULL);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
break;
/* non toplevel bins just forward the message and don't start
* a recalc themselves */
not_toplevel:
{
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
GST_DEBUG_OBJECT (bin, "not toplevel");
/* post message up, mark parent bins dirty */
}
}
case GST_MESSAGE_SEGMENT_START:
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
/* replace any previous segment_start message from this source
* with the new segment start message */
bin_replace_message (bin, message, GST_MESSAGE_SEGMENT_START);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
break;
case GST_MESSAGE_SEGMENT_DONE:
{
gst_message_parse_segment_done (message, &format, &position);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
bin_replace_message (bin, message, GST_MESSAGE_SEGMENT_START);
/* if there are no more segment_start messages, everybody posted
* a segment_done and we can post one on the bus. */
/* remove all old segment_done messages */
bin_remove_messages (bin, NULL, GST_MESSAGE_SEGMENT_DONE);
}
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
if (post) {
/* post segment done with latest format and position. */
gst_element_post_message (GST_ELEMENT_CAST (bin),
{
/* remove all cached duration messages, next time somebody asks
* for duration, we will recalculate. */
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
bin_remove_messages (bin, NULL, GST_MESSAGE_DURATION);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
goto forward;
}
case GST_MESSAGE_CLOCK_LOST:
gst_message_parse_clock_lost (message, &clock);
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
bin->clock_dirty = TRUE;
/* if we lost the clock that we provided, post to parent but
* only if we are PLAYING. */
forward = playing & provided;
GST_DEBUG_OBJECT (bin, "provided %d, playing %d, forward %d",
provided, playing, forward);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
if (forward) {
goto forward;
{
gboolean forward;
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
bin->clock_dirty = TRUE;
/* a new clock is available, post to parent but not
* to the application */
forward = GST_OBJECT_PARENT (bin) != NULL;
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
if (forward)
goto forward;
GST_DEBUG_OBJECT (bin, "max duration %" G_GINT64_FORMAT, fold->max);
/* and cache now */
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
bin->messages = g_list_prepend (bin->messages,
gst_message_new_duration (GST_OBJECT_CAST (bin), format, fold->max));
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
}
/* generic fold, return first valid result */
gst_query_parse_duration (query, &qformat, NULL);
/* find cached duration query */
- GST_LOCK (bin);
+ GST_OBJECT_LOCK (bin);
for (cached = bin->messages; cached; cached = g_list_next (cached)) {
GstMessage *message = (GstMessage *) cached->data;
if (format == qformat) {
GST_DEBUG_OBJECT (bin, "return cached duration %" G_GINT64_FORMAT,
duration);
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
gst_query_set_duration (query, qformat, duration);
res = TRUE;
}
}
}
- GST_UNLOCK (bin);
+ GST_OBJECT_UNLOCK (bin);
fold_func = (GstIteratorFoldFunction) bin_query_duration_fold;
fold_init = bin_query_duration_init;
{
gint eq;
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
eq = strcmp (GST_ELEMENT_NAME (element), name);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
if (eq != 0) {
gst_object_unref (element);
GST_DEBUG_OBJECT (bus, "[msg %p] posting on bus, type %s",
message, gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
- GST_LOCK (bus);
+ GST_OBJECT_LOCK (bus);
/* check if the bus is flushing */
if (GST_OBJECT_FLAG_IS_SET (bus, GST_BUS_FLUSHING))
goto is_flushing;
handler = bus->sync_handler;
handler_data = bus->sync_handler_data;
- GST_UNLOCK (bus);
+ GST_OBJECT_UNLOCK (bus);
/* first call the sync handler if it is installed */
if (handler)
{
GST_DEBUG_OBJECT (bus, "bus is flushing");
gst_message_unref (message);
- GST_UNLOCK (bus);
+ GST_OBJECT_UNLOCK (bus);
return FALSE;
}
{
GstMessage *message;
- GST_LOCK (bus);
+ GST_OBJECT_LOCK (bus);
if (flushing) {
GST_OBJECT_FLAG_SET (bus, GST_BUS_FLUSHING);
GST_OBJECT_FLAG_UNSET (bus, GST_BUS_FLUSHING);
}
- GST_UNLOCK (bus);
+ GST_OBJECT_UNLOCK (bus);
}
{
g_return_if_fail (GST_IS_BUS (bus));
- GST_LOCK (bus);
+ GST_OBJECT_LOCK (bus);
/* Assert if the user attempts to replace an existing sync_handler,
* other than to clear it */
bus->sync_handler = func;
bus->sync_handler_data = data;
- GST_UNLOCK (bus);
+ GST_OBJECT_UNLOCK (bus);
return;
no_replace:
{
- GST_UNLOCK (bus);
+ GST_OBJECT_UNLOCK (bus);
g_warning ("cannot replace existing sync handler");
return;
}
g_return_if_fail (GST_IS_BUS (bus));
/* I know the callees don't take this lock, so go ahead and abuse it */
- GST_LOCK (bus);
+ GST_OBJECT_LOCK (bus);
if (bus->num_signal_watchers > 0)
goto done;
bus->num_signal_watchers++;
- GST_UNLOCK (bus);
+ GST_OBJECT_UNLOCK (bus);
}
/**
g_return_if_fail (GST_IS_BUS (bus));
/* I know the callees don't take this lock, so go ahead and abuse it */
- GST_LOCK (bus);
+ GST_OBJECT_LOCK (bus);
if (bus->num_signal_watchers == 0)
goto error;
bus->signal_watch_id = 0;
done:
- GST_UNLOCK (bus);
+ GST_OBJECT_UNLOCK (bus);
return;
error:
{
g_critical ("Bus %s has no signal watches attached", GST_OBJECT_NAME (bus));
- GST_UNLOCK (bus);
+ GST_OBJECT_UNLOCK (bus);
return;
}
}
ret = gst_clock_get_internal_time (clock);
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
/* this will scale for rate and offset */
ret = gst_clock_adjust_unlocked (clock, ret);
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
GST_CAT_DEBUG (GST_CAT_CLOCK, "adjusted time %" GST_TIME_FORMAT,
GST_TIME_ARGS (ret));
g_return_if_fail (rate > 0.0);
g_return_if_fail (internal <= gst_clock_get_internal_time (clock));
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
clock->internal_calibration = internal;
clock->external_calibration = external;
clock->rate = rate;
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
}
/**
{
g_return_if_fail (GST_IS_CLOCK (clock));
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
if (rate)
*rate = clock->rate;
if (external)
*external = clock->external_calibration;
if (internal)
*internal = clock->internal_calibration;
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
}
static void
*
* Wait on the clock until the entries changed.
*/
-#define GST_CLOCK_WAIT(clock) g_cond_wait(GST_CLOCK_COND(clock),GST_GET_LOCK(clock))
+#define GST_CLOCK_WAIT(clock) g_cond_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock))
/**
* GST_CLOCK_TIMED_WAIT:
* @clock: the clock to wait on
* Wait on the clock until the entries changed or the specified timeout
* occured.
*/
-#define GST_CLOCK_TIMED_WAIT(clock,tv) g_cond_timed_wait(GST_CLOCK_COND(clock),GST_GET_LOCK(clock),tv)
+#define GST_CLOCK_TIMED_WAIT(clock,tv) g_cond_timed_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock),tv)
/**
* GST_CLOCK_BROADCAST:
* @clock: the clock to broadcast
if (oclass->set_clock)
oclass->set_clock (element, clock);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
gst_object_replace ((GstObject **) & element->clock, (GstObject *) clock);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
}
/**
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
if ((result = element->clock))
gst_object_ref (result);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return result;
}
{
g_return_if_fail (GST_IS_ELEMENT (element));
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
element->base_time = time;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
GST_DEBUG_OBJECT (element, "set base_time=%" GST_TIME_FORMAT,
GST_TIME_ARGS (time));
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_CLOCK_TIME_NONE);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
result = element->base_time;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return result;
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
/* locking pad to look at the name */
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
pad_name = g_strdup (GST_PAD_NAME (pad));
GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, "adding pad '%s'",
GST_STR_NULL (pad_name));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
/* then check to see if there's already a pad by that name here */
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
if (G_UNLIKELY (!gst_object_check_uniqueness (element->pads, pad_name)))
goto name_exists;
element->pads = g_list_prepend (element->pads, pad);
element->numpads++;
element->pads_cookie++;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
/* emit the NEW_PAD signal */
g_signal_emit (G_OBJECT (element), gst_element_signals[NEW_PAD], 0, pad);
{
g_critical ("Padname %s is not unique in element %s, not adding",
pad_name, GST_ELEMENT_NAME (element));
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
g_free (pad_name);
return FALSE;
}
g_critical
("Pad %s already has parent when trying to add to element %s",
pad_name, GST_ELEMENT_NAME (element));
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
g_free (pad_name);
return FALSE;
}
no_direction:
{
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
g_critical
("Trying to add pad %s to element %s, but it has no direction",
GST_OBJECT_NAME (pad), GST_ELEMENT_NAME (element));
- GST_UNLOCK (pad);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (element);
return FALSE;
}
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
/* locking pad to look at the name and parent */
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, "removing pad '%s'",
GST_STR_NULL (GST_PAD_NAME (pad)));
if (G_UNLIKELY (GST_PAD_PARENT (pad) != element))
goto not_our_pad;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
/* unlink */
if ((peer = gst_pad_get_peer (pad))) {
gst_object_unref (peer);
}
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
/* remove it from the list */
switch (gst_pad_get_direction (pad)) {
case GST_PAD_SRC:
element->pads = g_list_remove (element->pads, pad);
element->numpads--;
element->pads_cookie++;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
g_signal_emit (G_OBJECT (element), gst_element_signals[PAD_REMOVED], 0, pad);
not_our_pad:
{
/* FIXME, locking order? */
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
g_critical ("Padname %s:%s does not belong to element %s when removing",
GST_ELEMENT_NAME (GST_PAD_PARENT (pad)), GST_PAD_NAME (pad),
GST_ELEMENT_NAME (element));
- GST_UNLOCK (element);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (element);
+ GST_OBJECT_UNLOCK (pad);
return FALSE;
}
}
{
gint result;
- GST_LOCK (pad1);
+ GST_OBJECT_LOCK (pad1);
result = strcmp (GST_PAD_NAME (pad1), name);
- GST_UNLOCK (pad1);
+ GST_OBJECT_UNLOCK (pad1);
return result;
}
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
g_return_val_if_fail (name != NULL, NULL);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
find =
g_list_find_custom (element->pads, name, (GCompareFunc) pad_compare_name);
if (find) {
GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "found pad %s:%s",
GST_ELEMENT_NAME (element), name);
}
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return result;
}
{
GstIterator *result;
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
gst_object_ref (element);
result = gst_iterator_new_list (GST_TYPE_PAD,
- GST_GET_LOCK (element),
+ GST_OBJECT_GET_LOCK (element),
&element->pads_cookie,
padlist,
element,
(GstIteratorItemFunction) iterate_pad,
(GstIteratorDisposeFunction) gst_object_unref);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return result;
}
switch (dir) {
case GST_PAD_SRC:
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
pads = element->srcpads;
break;
case GST_PAD_SINK:
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
pads = element->sinkpads;
break;
default:
for (; pads; pads = g_list_next (pads)) {
GstPad *pad = GST_PAD (pads->data);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "checking pad %s:%s",
GST_DEBUG_PAD_NAME (pad));
if (GST_PAD_IS_LINKED (pad)) {
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
result = pad;
break;
} else {
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is not linked",
GST_DEBUG_PAD_NAME (pad));
}
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
}
if (result)
gst_object_ref (result);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return result;
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
g_return_val_if_fail (message != NULL, FALSE);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
bus = element->bus;
if (G_UNLIKELY (bus == NULL))
goto no_bus;
gst_object_ref (bus);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
result = gst_bus_post (bus, message);
gst_object_unref (bus);
no_bus:
{
GST_DEBUG ("not posting message %p: no bus", message);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
gst_message_unref (message);
return FALSE;
}
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
result = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_LOCKED_STATE);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return result;
}
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
old = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_LOCKED_STATE);
if (G_UNLIKELY (old == locked_state))
GST_ELEMENT_NAME (element));
GST_OBJECT_FLAG_UNSET (element, GST_ELEMENT_LOCKED_STATE);
}
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return TRUE;
was_ok:
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return FALSE;
}
GstState parent_current, parent_pending;
GstStateChangeReturn ret;
- GST_LOCK (parent);
+ GST_OBJECT_LOCK (parent);
parent_current = GST_STATE (parent);
parent_pending = GST_STATE_PENDING (parent);
- GST_UNLOCK (parent);
+ GST_OBJECT_UNLOCK (parent);
GST_CAT_DEBUG (GST_CAT_STATES,
"syncing state of element %s (%s) to %s (%s, %s)",
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "getting state");
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
ret = GST_STATE_RETURN (element);
/* we got an error, report immediatly */
"state current: %s, pending: %s, result: %d",
gst_element_state_get_name (GST_STATE (element)),
gst_element_state_get_name (GST_STATE_PENDING (element)), ret);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return ret;
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "get_state() interruped");
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return GST_STATE_CHANGE_FAILURE;
}
g_return_if_fail (GST_IS_ELEMENT (element));
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
pending = GST_STATE_PENDING (element);
if (pending == GST_STATE_VOID_PENDING ||
GST_STATE_RETURN (element) = GST_STATE_CHANGE_FAILURE;
GST_STATE_BROADCAST (element);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return;
nothing_aborted:
{
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return;
}
}
GstMessage *message;
GstStateChange transition;
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
old_ret = GST_STATE_RETURN (element);
GST_STATE_RETURN (element) = ret;
pending = GST_STATE_PENDING (element);
transition = GST_STATE_TRANSITION (current, next);
GST_STATE_NEXT (element) = next;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"committing state from %s to %s, pending %s",
nothing_pending:
{
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "nothing pending");
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return ret;
}
complete:
GST_STATE_NEXT (element) = GST_STATE_VOID_PENDING;
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "completed state change");
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
/* don't post silly messages with the same state. This can happen
* when an element state is changed to what it already was. For bins
g_return_if_fail (GST_IS_ELEMENT (element));
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
if (GST_STATE_PENDING (element) != GST_STATE_VOID_PENDING ||
GST_STATE_RETURN (element) == GST_STATE_CHANGE_FAILURE)
goto nothing_lost;
GST_STATE_NEXT (element) = current_state;
GST_STATE_PENDING (element) = current_state;
GST_STATE_RETURN (element) = GST_STATE_CHANGE_ASYNC;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
message = gst_message_new_state_changed (GST_OBJECT (element),
current_state, current_state, current_state);
nothing_lost:
{
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return;
}
}
GST_STATE_LOCK (element);
/* now calculate how to get to the new state */
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
old_ret = GST_STATE_RETURN (element);
/* previous state change returned an error, remove all pending
* and next states */
/* now signal any waiters, they will error since the cookie was increased */
GST_STATE_BROADCAST (element);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
ret = gst_element_change_state (element, transition);
GST_STATE_RETURN (element) = GST_STATE_CHANGE_ASYNC;
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
"element was busy with async state change");
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
GST_STATE_UNLOCK (element);
return ret;
async:
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
GST_STATE_RETURN (element) = ret;
GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "exit async state change %d",
ret);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return ret;
/* ERROR */
invalid_return:
{
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
/* somebody added a GST_STATE_ and forgot to do stuff here ! */
g_critical ("%s: unknown return value %d from a state change function",
GST_ELEMENT_NAME (element), ret);
ret = GST_STATE_CHANGE_FAILURE;
GST_STATE_RETURN (element) = ret;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return ret;
}
was_ok:
{
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
result = GST_STATE_RETURN (element);
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
"element is already in the %s state",
gst_element_state_get_name (state));
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
return result;
}
GST_STR_NULL (GST_OBJECT_NAME (object)));
}
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
gst_object_replace ((GstObject **) & element->clock, NULL);
gst_object_replace ((GstObject **) & element->bus, NULL);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "parent class dispose");
GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element, "setting bus to %p", bus);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
gst_object_replace ((GstObject **) & GST_ELEMENT_BUS (element),
GST_OBJECT_CAST (bus));
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
}
/**
g_return_val_if_fail (GST_IS_ELEMENT (element), result);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
result = GST_ELEMENT_BUS (element);
gst_object_ref (result);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
GST_DEBUG_OBJECT (element, "got bus %" GST_PTR_FORMAT, result);
#define GST_STATE_UNLOCK_FULL(elem) g_static_rec_mutex_unlock_full(GST_STATE_GET_LOCK(elem))
#define GST_STATE_LOCK_FULL(elem,t) g_static_rec_mutex_lock_full(GST_STATE_GET_LOCK(elem), t)
#define GST_STATE_WAIT(elem) g_cond_wait (GST_STATE_GET_COND (elem), \
- GST_GET_LOCK (elem))
+ GST_OBJECT_GET_LOCK (elem))
#define GST_STATE_TIMED_WAIT(elem, timeval) g_cond_timed_wait (GST_STATE_GET_COND (elem), \
- GST_GET_LOCK (elem), timeval)
+ GST_OBJECT_GET_LOCK (elem), timeval)
#define GST_STATE_SIGNAL(elem) g_cond_signal (GST_STATE_GET_COND (elem));
#define GST_STATE_BROADCAST(elem) g_cond_broadcast (GST_STATE_GET_COND (elem));
g_object_get (internal, "caps", &caps, NULL);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
gst_caps_replace (&(GST_PAD_CAPS (pad)), caps);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
g_object_notify (G_OBJECT (pad), "caps");
if (caps)
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "sink");
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
gst_object_unref (object);
} else {
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
}
}
{
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose");
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
GST_OBJECT_PARENT (object) = NULL;
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
/* need to patch refcount so it is finalized */
PATCH_REFCOUNT1 (object);
g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
/* parented objects cannot be renamed */
if (G_UNLIKELY (object->parent != NULL))
if (name != NULL) {
g_free (object->name);
object->name = g_strdup (name);
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
result = TRUE;
} else {
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
result = gst_object_set_name_default (object, G_OBJECT_TYPE_NAME (object));
}
return result;
/* error */
had_parent:
{
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
return FALSE;
}
}
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
result = g_strdup (object->name);
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
return result;
}
{
g_return_if_fail (GST_IS_OBJECT (object));
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
g_free (object->name_prefix);
object->name_prefix = g_strdup (name_prefix); /* NULL gives NULL */
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
}
/**
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
result = g_strdup (object->name_prefix);
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
return result;
}
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object,
"set parent (ref and sink)");
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
if (G_UNLIKELY (object->parent != NULL))
goto had_parent;
if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unsetting floating flag");
GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
} else {
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
gst_object_ref (object);
}
/* ERROR handling */
had_parent:
{
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
return FALSE;
}
}
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
result = object->parent;
if (G_LIKELY (result))
gst_object_ref (result);
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
return result;
}
g_return_if_fail (GST_IS_OBJECT (object));
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
parent = object->parent;
if (G_LIKELY (parent != NULL)) {
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unparent");
object->parent = NULL;
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
g_signal_emit (G_OBJECT (object), gst_object_signals[PARENT_UNSET], 0,
parent);
gst_object_unref (object);
} else {
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
}
}
child = GST_OBJECT (list->data);
- GST_LOCK (child);
+ GST_OBJECT_LOCK (child);
eq = strcmp (GST_OBJECT_NAME (child), name) == 0;
- GST_UNLOCK (child);
+ GST_OBJECT_UNLOCK (child);
if (G_UNLIKELY (eq)) {
result = FALSE;
* function with a valid object! */
/**
- * GST_GET_LOCK:
+ * GST_OBJECT_GET_LOCK:
* @obj: a #GstObject
*
* Acquire a reference to the mutex of this object.
*/
-#define GST_GET_LOCK(obj) (GST_OBJECT_CAST(obj)->lock)
+#define GST_OBJECT_GET_LOCK(obj) (GST_OBJECT_CAST(obj)->lock)
/**
- * GST_LOCK:
+ * GST_OBJECT_LOCK:
* @obj: a #GstObject to lock
*
* This macro will obtain a lock on the object, making serialization possible.
* It blocks until the lock can be obtained.
*/
-#define GST_LOCK(obj) g_mutex_lock(GST_GET_LOCK(obj))
+#define GST_OBJECT_LOCK(obj) g_mutex_lock(GST_OBJECT_GET_LOCK(obj))
/**
* GST_TRYLOCK:
* @obj: a #Object.
* This macro will try to obtain a lock on the object, but will return with
* FALSE if it can't get it immediately.
*/
-#define GST_TRYLOCK(obj) g_mutex_trylock(GST_GET_LOCK(obj))
+#define GST_OBJECT_TRYLOCK(obj) g_mutex_trylock(GST_OBJECT_GET_LOCK(obj))
/**
- * GST_UNLOCK:
+ * GST_OBJECT_UNLOCK:
* @obj: a #GstObject to unlock.
*
* This macro releases a lock on the object.
*/
-#define GST_UNLOCK(obj) g_mutex_unlock(GST_GET_LOCK(obj))
+#define GST_OBJECT_UNLOCK(obj) g_mutex_unlock(GST_OBJECT_GET_LOCK(obj))
/**
* error return value */
g_return_val_if_fail (GST_IS_PAD (pad), GST_PAD_UNKNOWN);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
result = GST_PAD_DIRECTION (pad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return result;
}
switch (new_mode) {
case GST_ACTIVATE_PUSH:
case GST_ACTIVATE_PULL:
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_DEBUG_OBJECT (pad, "setting ACTIVATE_MODE %d, unset flushing",
new_mode);
GST_PAD_UNSET_FLUSHING (pad);
GST_PAD_ACTIVATE_MODE (pad) = new_mode;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
break;
case GST_ACTIVATE_NONE:
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_DEBUG_OBJECT (pad, "setting ACTIVATE_MODE NONE, set flushing",
new_mode);
GST_PAD_SET_FLUSHING (pad);
/* unlock blocked pads so element can resume and stop */
GST_PAD_BLOCK_SIGNAL (pad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
break;
}
}
/* ensures that streaming stops */
GST_STREAM_LOCK (pad);
/* while we're at it set activation mode */
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_DEBUG_OBJECT (pad, "setting ACTIVATE_MODE %d", new_mode);
GST_PAD_ACTIVATE_MODE (pad) = new_mode;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
GST_STREAM_UNLOCK (pad);
break;
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
old = GST_PAD_ACTIVATE_MODE (pad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
if (active) {
switch (old) {
}
if (!active && !ret) {
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
g_critical ("Failed to deactivate pad %s:%s, very bad",
GST_DEBUG_PAD_NAME (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
}
return ret;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
old = GST_PAD_ACTIVATE_MODE (pad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
if ((active && old == GST_ACTIVATE_PULL)
|| (!active && old == GST_ACTIVATE_NONE))
}
peer_failed:
{
- GST_LOCK (peer);
+ GST_OBJECT_LOCK (peer);
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"activate_pull on peer (%s:%s) failed", GST_DEBUG_PAD_NAME (peer));
- GST_UNLOCK (peer);
+ GST_OBJECT_UNLOCK (peer);
gst_object_unref (peer);
return FALSE;
}
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "trying to set %s in push mode",
active ? "activated" : "deactivated");
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
old = GST_PAD_ACTIVATE_MODE (pad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
if ((active && old == GST_ACTIVATE_PUSH)
|| (!active && old == GST_ACTIVATE_NONE))
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
result = GST_PAD_MODE_ACTIVATE (GST_PAD_ACTIVATE_MODE (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return result;
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
was_blocked = GST_PAD_IS_BLOCKED (pad);
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "unblocked");
}
}
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return TRUE;
{
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"pad %s:%s was in right state", GST_DEBUG_PAD_NAME (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return FALSE;
}
}
g_return_val_if_fail (GST_IS_PAD (pad), result);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
result = GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKED);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return result;
}
GST_DEBUG_PAD_NAME (srcpad), srcpad,
GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
- GST_LOCK (srcpad);
+ GST_OBJECT_LOCK (srcpad);
if (G_UNLIKELY (GST_PAD_DIRECTION (srcpad) != GST_PAD_SRC))
goto not_srcpad;
- GST_LOCK (sinkpad);
+ GST_OBJECT_LOCK (sinkpad);
if (G_UNLIKELY (GST_PAD_DIRECTION (sinkpad) != GST_PAD_SINK))
goto not_sinkpad;
GST_PAD_PEER (srcpad) = NULL;
GST_PAD_PEER (sinkpad) = NULL;
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
/* fire off a signal to each of the pads telling them
* that they've been unlinked */
not_srcpad:
{
g_critical ("pad %s is not a source pad", GST_PAD_NAME (srcpad));
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (srcpad);
return FALSE;
}
not_sinkpad:
{
g_critical ("pad %s is not a sink pad", GST_PAD_NAME (sinkpad));
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
return FALSE;
}
not_linked_together:
{
/* we do not emit a warning in this case because unlinking cannot
* be made MT safe.*/
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
return FALSE;
}
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
result = (GST_PAD_PEER (pad) != NULL);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return result;
}
GST_CAT_INFO (GST_CAT_PADS, "trying to link %s:%s and %s:%s",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
- GST_LOCK (srcpad);
+ GST_OBJECT_LOCK (srcpad);
if (G_UNLIKELY (GST_PAD_DIRECTION (srcpad) != GST_PAD_SRC))
goto not_srcpad;
if (G_UNLIKELY (GST_PAD_PEER (srcpad) != NULL))
goto src_was_linked;
- GST_LOCK (sinkpad);
+ GST_OBJECT_LOCK (sinkpad);
if (G_UNLIKELY (GST_PAD_DIRECTION (sinkpad) != GST_PAD_SINK))
goto not_sinkpad;
not_srcpad:
{
g_critical ("pad %s is not a source pad", GST_PAD_NAME (srcpad));
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (srcpad);
return GST_PAD_LINK_WRONG_DIRECTION;
}
src_was_linked:
GST_DEBUG_PAD_NAME (srcpad));
/* we do not emit a warning in this case because unlinking cannot
* be made MT safe.*/
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (srcpad);
return GST_PAD_LINK_WAS_LINKED;
}
not_sinkpad:
{
g_critical ("pad %s is not a sink pad", GST_PAD_NAME (sinkpad));
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
return GST_PAD_LINK_WRONG_DIRECTION;
}
sink_was_linked:
GST_DEBUG_PAD_NAME (sinkpad));
/* we do not emit a warning in this case because unlinking cannot
* be made MT safe.*/
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
return GST_PAD_LINK_WAS_LINKED;
}
wrong_hierarchy:
{
GST_CAT_INFO (GST_CAT_PADS, "pads have wrong hierarchy");
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
return GST_PAD_LINK_WRONG_HIERARCHY;
}
no_format:
{
GST_CAT_INFO (GST_CAT_PADS, "caps are incompatible");
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
return GST_PAD_LINK_NOFORMAT;
}
}
if (result != GST_PAD_LINK_OK)
goto prepare_failed;
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
/* FIXME released the locks here, concurrent thread might link
* something else. */
result = GST_PAD_LINK_OK;
}
- GST_LOCK (srcpad);
- GST_LOCK (sinkpad);
+ GST_OBJECT_LOCK (srcpad);
+ GST_OBJECT_LOCK (sinkpad);
if (result == GST_PAD_LINK_OK) {
GST_PAD_PEER (srcpad) = sinkpad;
GST_PAD_PEER (sinkpad) = srcpad;
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
/* fire off a signal to each of the pads telling them
* that they've been linked */
GST_CAT_INFO (GST_CAT_PADS, "link between %s:%s and %s:%s failed",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
- GST_UNLOCK (sinkpad);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (sinkpad);
+ GST_OBJECT_UNLOCK (srcpad);
}
return result;
{
/* this function would need checks if it weren't static */
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
gst_object_replace ((GstObject **) & pad->padtemplate, (GstObject *) templ);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
if (templ)
gst_pad_template_pad_created (templ, pad);
GST_CAT_DEBUG (GST_CAT_CAPS, "dispatching to pad getcaps function");
GST_OBJECT_FLAG_SET (pad, GST_PAD_IN_GETCAPS);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
result = GST_PAD_GETCAPSFUNC (pad) (pad);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_OBJECT_FLAG_UNSET (pad, GST_PAD_IN_GETCAPS);
if (result == NULL) {
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_CAT_DEBUG (GST_CAT_CAPS, "get pad caps of %s:%s (%p)",
GST_DEBUG_PAD_NAME (pad), pad);
result = gst_pad_get_caps_unlocked (pad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return result;
}
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_CAT_DEBUG (GST_CAT_CAPS, "get peer caps of %s:%s (%p)",
GST_DEBUG_PAD_NAME (pad), pad);
goto no_peer;
gst_object_ref (peerpad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
result = gst_pad_get_caps (peerpad);
no_peer:
{
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return NULL;
}
}
if (caps == NULL)
return TRUE;
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
acceptfunc = GST_PAD_ACCEPTCAPSFUNC (pad);
GST_CAT_DEBUG (GST_CAT_CAPS, "pad accept caps of %s:%s (%p)",
GST_DEBUG_PAD_NAME (pad), pad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
if (acceptfunc) {
/* we can call the function */
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_CAT_DEBUG (GST_CAT_CAPS, "peer accept caps of %s:%s (%p)",
GST_DEBUG_PAD_NAME (pad), pad);
goto no_peer;
result = gst_pad_accept_caps (peerpad, caps);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return result;
no_peer:
{
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return TRUE;
}
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (caps == NULL || gst_caps_is_fixed (caps), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
setcaps = GST_PAD_SETCAPSFUNC (pad);
existing = GST_PAD_CAPS (pad);
if (setcaps != NULL && caps) {
if (!GST_PAD_IS_IN_SETCAPS (pad)) {
GST_OBJECT_FLAG_SET (pad, GST_PAD_IN_SETCAPS);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
if (!setcaps (pad, caps))
goto could_not_set;
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_OBJECT_FLAG_UNSET (pad, GST_PAD_IN_SETCAPS);
} else {
GST_CAT_DEBUG (GST_CAT_CAPS, "pad %s:%s was dispatching",
gst_caps_replace (&GST_PAD_CAPS (pad), caps);
GST_CAT_DEBUG (GST_CAT_CAPS, "%s:%s caps %" GST_PTR_FORMAT,
GST_DEBUG_PAD_NAME (pad), caps);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
g_object_notify (G_OBJECT (pad), "caps");
setting_same_caps:
{
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
gst_caps_replace (&GST_PAD_CAPS (pad), caps);
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad,
"caps %" GST_PTR_FORMAT " same as existing, updating ptr only", caps);
/* errors */
could_not_set:
{
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
GST_OBJECT_FLAG_UNSET (pad, GST_PAD_IN_SETCAPS);
GST_CAT_DEBUG (GST_CAT_CAPS,
"pad %s:%s, caps %" GST_PTR_FORMAT " could not be set",
GST_DEBUG_PAD_NAME (pad), caps);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return FALSE;
}
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
result = GST_PAD_PEER (pad);
if (result)
gst_object_ref (result);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return result;
}
g_return_val_if_fail (GST_IS_PAD (srcpad), NULL);
g_return_val_if_fail (GST_PAD_IS_SRC (srcpad), NULL);
- GST_LOCK (srcpad);
+ GST_OBJECT_LOCK (srcpad);
peer = GST_PAD_PEER (srcpad);
if (G_UNLIKELY (peer == NULL))
GST_DEBUG_PAD_NAME (srcpad));
gst_object_ref (peer);
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (srcpad);
mycaps = gst_pad_get_caps (srcpad);
peercaps = gst_pad_get_caps (peer);
{
GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%s:%s: no peer",
GST_DEBUG_PAD_NAME (srcpad));
- GST_UNLOCK (srcpad);
+ GST_OBJECT_UNLOCK (srcpad);
return NULL;
}
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
if (G_UNLIKELY ((peer = GST_PAD_PEER (pad)) == NULL))
goto no_peer;
caps = GST_PAD_CAPS (pad);
if (caps)
gst_caps_ref (caps);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
GST_CAT_DEBUG (GST_CAT_CAPS, "negotiated caps %" GST_PTR_FORMAT, caps);
{
GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%s:%s: no peer",
GST_DEBUG_PAD_NAME (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return NULL;
}
g_return_val_if_fail (GST_PAD_IS_SRC (pad), GST_FLOW_ERROR);
g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
while (G_UNLIKELY (GST_PAD_IS_BLOCKED (pad)))
if ((ret = handle_pad_block (pad)) != GST_FLOW_OK)
goto flushed;
goto no_peer;
gst_object_ref (peer);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
if (G_LIKELY ((bufferallocfunc = peer->bufferallocfunc) == NULL))
goto fallback;
- GST_LOCK (peer);
+ GST_OBJECT_LOCK (peer);
/* when the peer is flushing we cannot give a buffer */
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (peer)))
goto flushing;
G_GUINT64_FORMAT, GST_DEBUG_FUNCPTR_NAME (bufferallocfunc),
&bufferallocfunc, GST_DEBUG_PAD_NAME (peer), size, offset);
}
- GST_UNLOCK (peer);
+ GST_OBJECT_UNLOCK (peer);
ret = bufferallocfunc (peer, offset, size, caps, buf);
{
GST_CAT_DEBUG (GST_CAT_PADS, "%s:%s pad block stopped by flush",
GST_DEBUG_PAD_NAME (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return ret;
}
no_peer:
GST_CAT_DEBUG (GST_CAT_PADS,
"%s:%s called bufferallocfunc but had no peer",
GST_DEBUG_PAD_NAME (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return GST_FLOW_NOT_LINKED;
}
flushing:
{
/* peer was flushing */
- GST_UNLOCK (peer);
+ GST_OBJECT_UNLOCK (peer);
gst_object_unref (peer);
GST_CAT_DEBUG (GST_CAT_PADS,
"%s:%s called bufferallocfunc but peer was flushing",
callback = pad->block_callback;
if (callback) {
user_data = pad->block_data;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
callback (pad, TRUE, user_data);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
} else {
GST_PAD_BLOCK_SIGNAL (pad);
}
callback = pad->block_callback;
if (callback) {
user_data = pad->block_data;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
callback (pad, FALSE, user_data);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
} else {
GST_PAD_BLOCK_SIGNAL (pad);
}
GST_STREAM_LOCK (pad);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
caps_changed = caps && caps != GST_PAD_CAPS (pad);
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
/* see if the signal should be emited, we emit before caps nego as
* we might drop the buffer and do capsnego for nothing. */
gst_buffer_unref (buffer);
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"pushing, but pad was flushing");
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
GST_STREAM_UNLOCK (pad);
return GST_FLOW_WRONG_STATE;
}
g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
/* FIXME: this check can go away; pad_set_blocked could be implemented with
* probes completely */
* emit in the _chain() function */
if (G_UNLIKELY (GST_PAD_DO_BUFFER_SIGNALS (pad) > 0)) {
/* unlock before emitting */
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
/* if the signal handler returned FALSE, it means we should just drop the
* buffer */
if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (buffer)))
goto dropped;
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
}
if (G_UNLIKELY ((peer = GST_PAD_PEER (pad)) == NULL))
goto not_linked;
gst_object_ref (peer);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
ret = gst_pad_chain (peer, buffer);
{
gst_buffer_unref (buffer);
GST_DEBUG_OBJECT (pad, "pad block stopped by flush");
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return ret;
}
dropped:
gst_buffer_unref (buffer);
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"pushing, but it was not linked");
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return GST_FLOW_NOT_LINKED;
}
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
if (GST_PAD_DIRECTION (pad) != GST_PAD_SINK)
goto wrong_direction;
goto not_connected;
gst_object_ref (peer);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
/* see note in above function */
if (G_LIKELY ((checkgetrangefunc = peer->checkgetrangefunc) == NULL)) {
/* ERROR recovery here */
wrong_direction:
{
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return FALSE;
}
not_connected:
{
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"checking pull range, but it was not linked");
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return FALSE;
}
}
GST_STREAM_LOCK (pad);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
if (G_UNLIKELY ((getrangefunc = GST_PAD_GETRANGEFUNC (pad)) == NULL))
goto no_function;
{
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"pulling range, but pad was flushing");
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
GST_STREAM_UNLOCK (pad);
return GST_FLOW_WRONG_STATE;
}
GST_FLOW_ERROR);
g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
while (G_UNLIKELY (GST_PAD_IS_BLOCKED (pad)))
handle_pad_block (pad);
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
gst_object_ref (peer);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
ret = gst_pad_get_range (peer, offset, size, buffer);
{
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"pulling range, but it was not linked");
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return GST_FLOW_NOT_LINKED;
}
dropping:
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_START:
GST_PAD_SET_FLUSHING (pad);
}
if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) > 0)) {
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (event)))
goto dropping;
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
}
peerpad = GST_PAD_PEER (pad);
if (peerpad == NULL)
GST_LOG_OBJECT (peerpad, "sending event on peerpad");
gst_object_ref (peerpad);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
result = gst_pad_send_event (peerpad, event);
not_linked:
{
gst_event_unref (event);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return FALSE;
}
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
if (GST_PAD_IS_SINK (pad) && !GST_EVENT_IS_DOWNSTREAM (event))
goto wrong_direction;
if (GST_PAD_IS_SRC (pad) && !GST_EVENT_IS_UPSTREAM (event))
goto no_function;
emit_signal = GST_PAD_DO_EVENT_SIGNALS (pad) > 0;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
/* have to check if it's a sink pad, because e.g. CUSTOM_BOTH is serialized
when going down but not when going up */
{
g_warning ("pad %s:%s sending event in wrong direction",
GST_DEBUG_PAD_NAME (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
gst_event_unref (event);
return FALSE;
}
{
g_warning ("pad %s:%s has no event handler, file a bug.",
GST_DEBUG_PAD_NAME (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
gst_event_unref (event);
return FALSE;
}
flushing:
{
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
GST_CAT_INFO (GST_CAT_EVENT, "Received event on flushing pad. Discarding");
gst_event_unref (event);
return FALSE;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (func != NULL, FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
task = GST_PAD_TASK (pad);
if (task == NULL) {
task = gst_task_create (func, data);
GST_PAD_TASK (pad) = task;
}
gst_task_start (task);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return TRUE;
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
task = GST_PAD_TASK (pad);
if (task == NULL)
goto no_task;
gst_task_pause (task);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
GST_STREAM_LOCK (pad);
GST_STREAM_UNLOCK (pad);
no_task:
{
GST_DEBUG_OBJECT (pad, "pad has no task");
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return FALSE;
}
}
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
task = GST_PAD_TASK (pad);
if (task == NULL)
goto no_task;
GST_PAD_TASK (pad) = NULL;
gst_task_stop (task);
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
GST_STREAM_LOCK (pad);
GST_STREAM_UNLOCK (pad);
no_task:
{
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
GST_STREAM_LOCK (pad);
GST_STREAM_UNLOCK (pad);
#define GST_PREROLL_BROADCAST(pad) g_cond_broadcast (GST_PREROLL_GET_COND (pad));
#define GST_PAD_BLOCK_GET_COND(pad) (GST_PAD_CAST(pad)->block_cond)
-#define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_GET_LOCK (pad)))
+#define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
#define GST_PAD_BLOCK_SIGNAL(pad) (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
{
GstPipeline *pipeline = GST_PIPELINE (object);
- GST_LOCK (pipeline);
+ GST_OBJECT_LOCK (pipeline);
switch (prop_id) {
case PROP_DELAY:
pipeline->delay = g_value_get_uint64 (value);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_UNLOCK (pipeline);
+ GST_OBJECT_UNLOCK (pipeline);
}
static void
{
GstPipeline *pipeline = GST_PIPELINE (object);
- GST_LOCK (pipeline);
+ GST_OBJECT_LOCK (pipeline);
switch (prop_id) {
case PROP_DELAY:
g_value_set_uint64 (value, pipeline->delay);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_UNLOCK (pipeline);
+ GST_OBJECT_UNLOCK (pipeline);
}
static gboolean
if (flush && res) {
gboolean need_reset;
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
need_reset = GST_PIPELINE (element)->stream_time != GST_CLOCK_TIME_NONE;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
/* need to reset the stream time to 0 after a flushing seek, unless the user
explicitly disabled this behavior by setting stream time to NONE */
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
if (element->bus)
gst_bus_set_flushing (element->bus, FALSE);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
break;
start_time = gst_clock_get_time (clock);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
new_clock = element->clock != clock;
stream_time = pipeline->stream_time;
delay = pipeline->delay;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
if (new_clock) {
/* now distribute the clock (which could be NULL I guess) */
{
gboolean need_reset;
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
need_reset = pipeline->stream_time != GST_CLOCK_TIME_NONE;
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
if (need_reset)
gst_pipeline_set_new_stream_time (pipeline, 0);
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
if ((clock = element->clock)) {
GstClockTime now;
gst_object_ref (clock);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
/* calculate the time when we stopped */
now = gst_clock_get_time (clock);
gst_object_unref (clock);
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
/* store the current stream time */
if (pipeline->stream_time != GST_CLOCK_TIME_NONE)
pipeline->stream_time = now - element->base_time;
GST_TIME_ARGS (pipeline->stream_time),
GST_TIME_ARGS (now), GST_TIME_ARGS (element->base_time));
}
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_NULL:
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
if (element->bus) {
gst_bus_set_flushing (element->bus, TRUE);
}
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
break;
}
return result;
{
g_return_if_fail (GST_IS_PIPELINE (pipeline));
- GST_LOCK (pipeline);
+ GST_OBJECT_LOCK (pipeline);
pipeline->stream_time = time;
- GST_UNLOCK (pipeline);
+ GST_OBJECT_UNLOCK (pipeline);
GST_DEBUG_OBJECT (pipeline, "set new stream_time to %" GST_TIME_FORMAT,
GST_TIME_ARGS (time));
g_return_val_if_fail (GST_IS_PIPELINE (pipeline), GST_CLOCK_TIME_NONE);
- GST_LOCK (pipeline);
+ GST_OBJECT_LOCK (pipeline);
result = pipeline->stream_time;
- GST_UNLOCK (pipeline);
+ GST_OBJECT_UNLOCK (pipeline);
return result;
}
GstPipeline *pipeline = GST_PIPELINE (element);
/* if we have a fixed clock, use that one */
- GST_LOCK (pipeline);
+ GST_OBJECT_LOCK (pipeline);
if (GST_OBJECT_FLAG_IS_SET (pipeline, GST_PIPELINE_FLAG_FIXED_CLOCK)) {
clock = pipeline->fixed_clock;
gst_object_ref (clock);
- GST_UNLOCK (pipeline);
+ GST_OBJECT_UNLOCK (pipeline);
GST_CAT_DEBUG (GST_CAT_CLOCK, "pipeline using fixed clock %p (%s)",
clock, clock ? GST_STR_NULL (GST_OBJECT_NAME (clock)) : "-");
} else {
- GST_UNLOCK (pipeline);
+ GST_OBJECT_UNLOCK (pipeline);
clock =
GST_ELEMENT_CLASS (parent_class)->
provide_clock (GST_ELEMENT (pipeline));
{
g_return_if_fail (GST_IS_PIPELINE (pipeline));
- GST_LOCK (pipeline);
+ GST_OBJECT_LOCK (pipeline);
GST_OBJECT_FLAG_SET (pipeline, GST_PIPELINE_FLAG_FIXED_CLOCK);
gst_object_replace ((GstObject **) & pipeline->fixed_clock,
(GstObject *) clock);
- GST_UNLOCK (pipeline);
+ GST_OBJECT_UNLOCK (pipeline);
GST_CAT_DEBUG (GST_CAT_CLOCK, "pipeline using fixed clock %p (%s)", clock,
(clock ? GST_OBJECT_NAME (clock) : "nil"));
g_return_if_fail (pipeline != NULL);
g_return_if_fail (GST_IS_PIPELINE (pipeline));
- GST_LOCK (pipeline);
+ GST_OBJECT_LOCK (pipeline);
GST_OBJECT_FLAG_UNSET (pipeline, GST_PIPELINE_FLAG_FIXED_CLOCK);
gst_object_replace ((GstObject **) & pipeline->fixed_clock, NULL);
- GST_UNLOCK (pipeline);
+ GST_OBJECT_UNLOCK (pipeline);
GST_CAT_DEBUG (GST_CAT_CLOCK, "pipeline using automatic clock");
}
return;
}
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
if (g_list_find_custom (registry->paths, path, (GCompareFunc) strcmp)) {
g_warning ("path %s already added to registry", path);
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
return;
}
GST_INFO ("Adding plugin path: \"%s\"", path);
registry->paths = g_list_append (registry->paths, g_strdup (path));
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
}
/**
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
/* We don't need to copy the strings, because they won't be deleted
* as long as the GstRegistry is around */
list = g_list_copy (registry->paths);
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
return list;
}
g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
existing_plugin = gst_registry_lookup_locked (registry, plugin->filename);
if (existing_plugin) {
GST_DEBUG_OBJECT (registry,
gst_object_ref (plugin);
gst_object_sink (plugin);
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
GST_DEBUG_OBJECT (registry, "emitting plugin-added for filename \"%s\"",
GST_STR_NULL (plugin->filename));
{
g_return_if_fail (GST_IS_REGISTRY (registry));
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
registry->plugins = g_list_remove (registry->plugins, plugin);
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
gst_object_unref (plugin);
}
g_return_val_if_fail (feature->name != NULL, FALSE);
g_return_val_if_fail (feature->plugin_name != NULL, FALSE);
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
existing_feature = gst_registry_lookup_feature_locked (registry,
feature->name);
if (existing_feature) {
gst_object_ref (feature);
gst_object_sink (feature);
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
GST_DEBUG_OBJECT (registry, "emitting feature-added for %s", feature->name);
g_signal_emit (G_OBJECT (registry), gst_registry_signals[FEATURE_ADDED], 0,
GST_DEBUG_OBJECT (registry, "removing feature %p (%s)",
feature, gst_plugin_feature_get_name (feature));
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
registry->features = g_list_remove (registry->features, feature);
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
gst_object_unref (feature);
}
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
list = gst_filter_run (registry->plugins, (GstFilterFunc) filter, first,
user_data);
for (g = list; g; g = g->next) {
gst_object_ref (GST_PLUGIN (g->data));
}
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
return list;
}
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
list = gst_filter_run (registry->features, (GstFilterFunc) filter, first,
user_data);
for (g = list; g; g = g->next) {
gst_object_ref (GST_PLUGIN_FEATURE (g->data));
}
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
return list;
}
GList *list;
GList *g;
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
list = g_list_copy (registry->plugins);
for (g = list; g; g = g->next) {
gst_object_ref (GST_PLUGIN (g->data));
}
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
return list;
}
{
GstPluginFeature *feature;
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
feature = gst_registry_lookup_feature_locked (registry, name);
if (feature)
gst_object_ref (feature);
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
return feature;
}
{
GstPlugin *plugin;
- GST_LOCK (registry);
+ GST_OBJECT_LOCK (registry);
plugin = gst_registry_lookup_locked (registry, filename);
if (plugin)
gst_object_ref (plugin);
- GST_UNLOCK (registry);
+ GST_OBJECT_UNLOCK (registry);
return plugin;
}
GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC |
GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC;
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
clock->thread = g_thread_create ((GThreadFunc) gst_system_clock_async_thread,
clock, TRUE, &error);
if (error)
/* wait for it to spin up */
GST_CLOCK_WAIT (clock);
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
return;
no_thread:
{
g_warning ("could not create async clock thread: %s", error->message);
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
}
}
GList *entries;
/* else we have to stop the thread */
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
sysclock->stopping = TRUE;
/* unschedule all entries */
for (entries = clock->entries; entries; entries = g_list_next (entries)) {
g_list_free (clock->entries);
clock->entries = NULL;
GST_CLOCK_BROADCAST (clock);
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
if (sysclock->thread)
g_thread_join (sysclock->thread);
GstSystemClock *sysclock = GST_SYSTEM_CLOCK (clock);
GST_CAT_DEBUG (GST_CAT_CLOCK, "enter system clock thread");
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
/* signal spinup */
GST_CLOCK_BROADCAST (clock);
/* now enter our (almost) infinite loop */
GST_CAT_DEBUG (GST_CAT_CLOCK, "async entry %p unlocked", entry);
if (entry->func) {
/* unlock before firing the callback */
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
entry->func (clock, entry->time, (GstClockID) entry,
entry->user_data);
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
}
if (entry->type == GST_CLOCK_ENTRY_PERIODIC) {
/* adjust time now */
exit:
/* signal exit */
GST_CLOCK_BROADCAST (clock);
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
GST_CAT_DEBUG (GST_CAT_CLOCK, "exit system clock thread");
}
{
GstClockReturn ret;
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
ret = gst_system_clock_id_wait_unlocked (clock, entry);
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
return ret;
}
{
GST_CAT_DEBUG (GST_CAT_CLOCK, "adding entry %p", entry);
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
/* need to take a ref */
gst_clock_id_ref ((GstClockID) entry);
/* insert the entry in sorted order */
GST_CAT_DEBUG (GST_CAT_CLOCK, "send signal");
GST_CLOCK_BROADCAST (clock);
}
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
return GST_CLOCK_OK;
}
{
GST_CAT_DEBUG (GST_CAT_CLOCK, "unscheduling entry %p", entry);
- GST_LOCK (clock);
+ GST_OBJECT_LOCK (clock);
entry->status = GST_CLOCK_UNSCHEDULED;
GST_CAT_DEBUG (GST_CAT_CLOCK, "send signal");
GST_CLOCK_BROADCAST (clock);
- GST_UNLOCK (clock);
+ GST_OBJECT_UNLOCK (clock);
}
/* we have to grab the lock to get the mutex. We also
* mark our state running so that nobody can mess with
* the mutex. */
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
if (task->state == GST_TASK_STOPPED)
goto exit;
lock = GST_TASK_GET_LOCK (task);
task->running = TRUE;
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
/* locking order is TASK_LOCK, LOCK */
g_static_rec_mutex_lock (lock);
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
while (G_LIKELY (task->state != GST_TASK_STOPPED)) {
while (G_UNLIKELY (task->state == GST_TASK_PAUSED)) {
gint t;
}
GST_TASK_SIGNAL (task);
GST_TASK_WAIT (task);
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
/* locking order.. */
if (t > 0)
g_static_rec_mutex_lock_full (lock, t);
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
if (G_UNLIKELY (task->state == GST_TASK_STOPPED))
goto done;
}
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
task->func (task->data);
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
}
done:
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
g_static_rec_mutex_unlock (lock);
/* now we allow messing with the lock again */
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
task->running = FALSE;
exit:
GST_TASK_SIGNAL (task);
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
GST_DEBUG ("Exit task %p, thread %p", task, g_thread_self ());
void
gst_task_set_lock (GstTask * task, GStaticRecMutex * mutex)
{
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
if (task->running)
goto is_running;
GST_TASK_GET_LOCK (task) = mutex;
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
return;
is_running:
{
g_warning ("cannot call set_lock on a running task");
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
}
}
g_return_val_if_fail (GST_IS_TASK (task), GST_TASK_STOPPED);
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
result = task->state;
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
return result;
}
GST_DEBUG_OBJECT (task, "Starting task %p", task);
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
if (G_UNLIKELY (GST_TASK_GET_LOCK (task) == NULL))
goto no_lock;
/* was OK */
break;
}
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
return TRUE;
GST_DEBUG_OBJECT (task, "Stopping task %p", task);
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
old = task->state;
task->state = GST_TASK_STOPPED;
switch (old) {
case GST_TASK_STARTED:
break;
}
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
return TRUE;
}
GST_DEBUG_OBJECT (task, "Pausing task %p", task);
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
old = task->state;
task->state = GST_TASK_PAUSED;
switch (old) {
case GST_TASK_STARTED:
break;
}
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
return TRUE;
}
GST_DEBUG_OBJECT (task, "Joining task %p", task);
- GST_LOCK (task);
+ GST_OBJECT_LOCK (task);
task->state = GST_TASK_STOPPED;
GST_TASK_SIGNAL (task);
while (task->running)
GST_TASK_WAIT (task);
- GST_UNLOCK (task);
+ GST_OBJECT_UNLOCK (task);
GST_DEBUG_OBJECT (task, "Joined task %p", task);
*
* Wait for the task cond to be signalled
*/
-#define GST_TASK_WAIT(task) g_cond_wait(GST_TASK_GET_COND (task), GST_GET_LOCK (task))
+#define GST_TASK_WAIT(task) g_cond_wait(GST_TASK_GET_COND (task), GST_OBJECT_GET_LOCK (task))
/**
* GST_TASK_SIGNAL:
* @task: Task to signal
srcpads = NULL;
} else {
/* no name given, get the first available pad */
- GST_LOCK (src);
+ GST_OBJECT_LOCK (src);
srcpads = GST_ELEMENT_PADS (src);
srcpad = srcpads ? GST_PAD_CAST (srcpads->data) : NULL;
if (srcpad)
gst_object_ref (srcpad);
- GST_UNLOCK (src);
+ GST_OBJECT_UNLOCK (src);
}
/* get a destination pad */
destpads = NULL;
} else {
/* no name given, get the first available pad */
- GST_LOCK (dest);
+ GST_OBJECT_LOCK (dest);
destpads = GST_ELEMENT_PADS (dest);
destpad = destpads ? GST_PAD_CAST (destpads->data) : NULL;
if (destpad)
gst_object_ref (destpad);
- GST_UNLOCK (dest);
+ GST_OBJECT_UNLOCK (dest);
}
if (srcpadname && destpadname) {
g_return_val_if_fail (GST_IS_PAD (pad), 0);
g_return_val_if_fail (handler != NULL, 0);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
sigid = g_signal_connect (pad, "have-data", handler, data);
GST_PAD_DO_EVENT_SIGNALS (pad)++;
GST_PAD_DO_BUFFER_SIGNALS (pad)++;
GST_DEBUG ("adding data probe to pad %s:%s, now %d data, %d event probes",
GST_DEBUG_PAD_NAME (pad),
GST_PAD_DO_BUFFER_SIGNALS (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return sigid;
}
g_return_val_if_fail (GST_IS_PAD (pad), 0);
g_return_val_if_fail (handler != NULL, 0);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
sigid = g_signal_connect (pad, "have-data::event", handler, data);
GST_PAD_DO_EVENT_SIGNALS (pad)++;
GST_DEBUG ("adding event probe to pad %s:%s, now %d probes",
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return sigid;
}
g_return_val_if_fail (GST_IS_PAD (pad), 0);
g_return_val_if_fail (handler != NULL, 0);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
sigid = g_signal_connect (pad, "have-data::buffer", handler, data);
GST_PAD_DO_BUFFER_SIGNALS (pad)++;
GST_DEBUG ("adding buffer probe to pad %s:%s, now %d probes",
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_BUFFER_SIGNALS (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
return sigid;
}
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (handler_id > 0);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id);
GST_PAD_DO_BUFFER_SIGNALS (pad)--;
GST_PAD_DO_EVENT_SIGNALS (pad)--;
("removed data probe from pad %s:%s, now %d event, %d buffer probes",
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad),
GST_PAD_DO_BUFFER_SIGNALS (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
}
/**
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (handler_id > 0);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id);
GST_PAD_DO_EVENT_SIGNALS (pad)--;
GST_DEBUG ("removed event probe from pad %s:%s, now %d event probes",
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
}
/**
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (handler_id > 0);
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id);
GST_PAD_DO_BUFFER_SIGNALS (pad)--;
GST_DEBUG ("removed buffer probe from pad %s:%s, now %d buffer probes",
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_BUFFER_SIGNALS (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
}
/**
{
GstBaseSink *sink = GST_BASE_SINK (object);
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
switch (prop_id) {
case PROP_PREROLL_QUEUE_LEN:
g_value_set_uint (value, sink->preroll_queue_max_len);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
}
static GstCaps *
gboolean post_paused = FALSE;
gboolean post_playing = FALSE;
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
current = GST_STATE (basesink);
next = GST_STATE_NEXT (basesink);
pending = GST_STATE_PENDING (basesink);
GST_STATE_PENDING (basesink) = GST_STATE_VOID_PENDING;
GST_STATE_RETURN (basesink) = GST_STATE_CHANGE_SUCCESS;
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
if (post_paused) {
message = gst_message_new_state_changed (GST_OBJECT_CAST (basesink),
stopping:
{
/* app is going to READY */
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
return FALSE;
}
}
if (!gst_base_sink_commit_state (basesink))
goto stopping;
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
/* it is possible that commiting the state made us go to PLAYING
* now in which case we don't need to block anymore. */
GST_DEBUG_OBJECT (basesink, "waiting to finish preroll");
GST_PREROLL_WAIT (pad);
GST_DEBUG_OBJECT (basesink, "done preroll");
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
}
GST_PREROLL_UNLOCK (pad);
}
flushing:
{
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
gst_base_sink_preroll_queue_flush (basesink, pad);
GST_PREROLL_UNLOCK (pad);
GST_DEBUG_OBJECT (basesink, "pad is flushing");
if (bclass->event)
bclass->event (basesink, event);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
basesink->flushing = TRUE;
if (basesink->clock_id) {
gst_clock_id_unschedule (basesink->clock_id);
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
GST_PREROLL_LOCK (pad);
/* we need preroll after the flush */
/* now we are completely unblocked and the _chain method
* will return */
GST_STREAM_LOCK (pad);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
basesink->flushing = FALSE;
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
/* we need new segment info after the flush. */
basesink->segment_start = -1;
basesink->segment_stop = -1;
basesink->clock_id = id;
/* release the object lock while waiting */
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
ret = gst_clock_id_wait (id, NULL);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
gst_clock_id_unref (id);
basesink->clock_id = NULL;
if (basesink->clock) {
GstClockTime base_time;
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
base_time = GST_ELEMENT_CAST (basesink)->base_time;
result = gst_base_sink_wait (basesink, stream_start + base_time);
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
GST_LOG_OBJECT (basesink, "clock entry done: %d", result);
} else {
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
if (basesink->clock) {
/* wait for last buffer to finish if we have a valid end time */
if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) {
basesink->end_time = GST_CLOCK_TIME_NONE;
}
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
break;
default:
break;
basesink = GST_BASE_SINK (gst_pad_get_parent (pad));
if (!(basesink->pad_mode == GST_ACTIVATE_PUSH)) {
- GST_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
g_warning ("Push on pad %s:%s, but it was not activated in push mode",
GST_DEBUG_PAD_NAME (pad));
- GST_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
result = GST_FLOW_UNEXPECTED;
goto done;
}
/* step 1, unblock clock sync (if any) or any other blocking thing */
GST_PREROLL_LOCK (pad);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
if (basesink->clock_id) {
gst_clock_id_unschedule (basesink->clock_id);
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
/* unlock any subclasses */
if (bclass->unlock)
GstBaseSink *basesink = GST_BASE_SINK (element);
gboolean result;
- GST_LOCK (element);
+ GST_OBJECT_LOCK (element);
pad = basesink->sinkpad;
gst_object_ref (pad);
- GST_UNLOCK (element);
+ GST_OBJECT_UNLOCK (element);
result = gst_pad_push_event (pad, event);
case GST_FORMAT_TIME:
{
/* we can answer time format */
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
if ((clock = GST_ELEMENT_CLOCK (basesink))) {
GstClockTime now;
gint64 segment_time;
gst_object_ref (clock);
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
now = gst_clock_get_time (clock);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
if (GST_CLOCK_TIME_IS_VALID (basesink->segment_time))
segment_time = basesink->segment_time;
else
res = TRUE;
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
}
default:
break;
bclass = GST_BASE_SINK_GET_CLASS (basesink);
GST_PREROLL_LOCK (basesink->sinkpad);
- GST_LOCK (basesink);
+ GST_OBJECT_LOCK (basesink);
/* unlock clock wait if any */
if (basesink->clock_id) {
gst_clock_id_unschedule (basesink->clock_id);
}
- GST_UNLOCK (basesink);
+ GST_OBJECT_UNLOCK (basesink);
/* unlock any subclasses */
if (bclass->unlock)
basesrc->clock_id = id;
/* release the object lock while waiting */
- GST_UNLOCK (basesrc);
+ GST_OBJECT_UNLOCK (basesrc);
ret = gst_clock_id_wait (id, NULL);
- GST_LOCK (basesrc);
+ GST_OBJECT_LOCK (basesrc);
gst_clock_id_unref (id);
basesrc->clock_id = NULL;
", end: %" GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (end));
/* now do clocking */
- GST_LOCK (basesrc);
+ GST_OBJECT_LOCK (basesrc);
base_time = GST_ELEMENT_CAST (basesrc)->base_time;
GST_LOG_OBJECT (basesrc,
GST_TIME_ARGS (base_time), GST_TIME_ARGS (start));
result = gst_base_src_wait (basesrc, start + base_time);
- GST_UNLOCK (basesrc);
+ GST_OBJECT_UNLOCK (basesrc);
GST_LOG_OBJECT (basesrc, "clock entry done: %d", result);
GST_DEBUG ("live source unlocked");
}
/* FIXME, use another variable to signal stopping */
- GST_LOCK (src->srcpad);
+ GST_OBJECT_LOCK (src->srcpad);
if (GST_PAD_IS_FLUSHING (src->srcpad))
goto flushing;
- GST_UNLOCK (src->srcpad);
+ GST_OBJECT_UNLOCK (src->srcpad);
}
GST_LIVE_UNLOCK (src);
flushing:
{
GST_DEBUG_OBJECT (src, "pad is flushing");
- GST_UNLOCK (src->srcpad);
+ GST_OBJECT_UNLOCK (src->srcpad);
GST_LIVE_UNLOCK (src);
return GST_FLOW_WRONG_STATE;
}
GST_DEBUG ("unschedule clock");
/* and unblock the clock as well, if any */
- GST_LOCK (basesrc);
+ GST_OBJECT_LOCK (basesrc);
if (basesrc->clock_id) {
gst_clock_id_unschedule (basesrc->clock_id);
}
- GST_UNLOCK (basesrc);
+ GST_OBJECT_UNLOCK (basesrc);
GST_DEBUG ("unlock done");
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad))
trans->have_same_caps =
gst_caps_is_equal (GST_PAD_CAPS (trans->sinkpad),
trans->segment_stop = -1;
trans->segment_base = 0;
trans->segment_accum = 0;
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
if (passthrough == FALSE) {
if (bclass->transform_ip || bclass->transform)
trans->passthrough = FALSE;
}
GST_DEBUG_OBJECT (trans, "set passthrough %d", trans->passthrough);
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
}
/**
g_return_val_if_fail (trans != NULL, FALSE);
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
result = trans->passthrough;
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
return result;
}
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
if (in_place) {
if (bclass->transform_ip) {
}
}
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
}
/**
g_return_val_if_fail (trans != NULL, FALSE);
- GST_LOCK (trans);
+ GST_OBJECT_LOCK (trans);
result = trans->always_in_place;
- GST_UNLOCK (trans);
+ GST_OBJECT_UNLOCK (trans);
return result;
}
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECT_PADS (pads));
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->func = func;
pads->user_data = user_data;
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
}
/**
data->pad = pad;
data->buffer = NULL;
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->data = g_slist_append (pads->data, data);
gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_collect_pads_chain));
gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_collect_pads_event));
gst_pad_set_element_private (pad, data);
pads->numpads++;
pads->cookie++;
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
return data;
}
g_return_val_if_fail (pad != NULL, FALSE);
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
list = g_slist_find_custom (pads->data, pad, (GCompareFunc) find_pad);
if (list) {
g_free (list->data);
}
pads->numpads--;
pads->cookie++;
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
return list != NULL;
}
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECT_PADS (pads));
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->started = TRUE;
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
}
/**
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECT_PADS (pads));
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->started = FALSE;
GST_COLLECT_PADS_BROADCAST (pads);
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
}
/**
{
GstFlowReturn ret = GST_FLOW_OK;
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
pads->eospads++;
ret = pads->func (pads, pads->user_data);
}
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
/* We eat this event */
gst_event_unref (event);
pads = data->collect;
size = GST_BUFFER_SIZE (buffer);
- GST_LOCK (pads);
+ GST_OBJECT_LOCK (pads);
/* if not started, bail out */
if (!pads->started)
GST_DEBUG ("Not all active pads have data, continuing");
ret = GST_FLOW_OK;
}
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
return ret;
}
not_started:
{
- GST_UNLOCK (pads);
+ GST_OBJECT_UNLOCK (pads);
GST_DEBUG ("collect_pads not started");
return GST_FLOW_WRONG_STATE;
}
typedef GstFlowReturn (*GstCollectPadsFunction) (GstCollectPads *pads, gpointer user_data);
#define GST_COLLECT_PADS_GET_COND(pads) (((GstCollectPads *)pads)->cond)
-#define GST_COLLECT_PADS_WAIT(pads) (g_cond_wait (GST_COLLECT_PADS_GET_COND (pads), GST_GET_LOCK (pads)))
+#define GST_COLLECT_PADS_WAIT(pads) (g_cond_wait (GST_COLLECT_PADS_GET_COND (pads), GST_OBJECT_GET_LOCK (pads)))
#define GST_COLLECT_PADS_SIGNAL(pads) (g_cond_signal (GST_COLLECT_PADS_GET_COND (pads)))
#define GST_COLLECT_PADS_BROADCAST(pads)(g_cond_broadcast (GST_COLLECT_PADS_GET_COND (pads)))
g_value_set_boolean (value, sink->signal_handoffs);
break;
case PROP_LAST_MESSAGE:
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
g_value_set_string (value, sink->last_message);
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
break;
case PROP_CAN_ACTIVATE_PUSH:
g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_push);
const GstStructure *s;
gchar *sstr;
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
g_free (sink->last_message);
if ((s = gst_event_get_structure (event)))
g_strdup_printf ("event ******* E (type: %d, %s) %p",
GST_EVENT_TYPE (event), sstr, event);
g_free (sstr);
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
GstFakeSink *sink = GST_FAKE_SINK (bsink);
if (!sink->silent) {
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
g_free (sink->last_message);
sink->last_message = g_strdup_printf ("preroll ******* ");
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
if (!sink->silent) {
gchar ts_str[64], dur_str[64];
- GST_LOCK (sink);
+ GST_OBJECT_LOCK (sink);
g_free (sink->last_message);
if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
G_GINT64_FORMAT ", flags: %d) %p", GST_BUFFER_SIZE (buf), ts_str,
dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
GST_MINI_OBJECT (buf)->flags, buf);
- GST_UNLOCK (sink);
+ GST_OBJECT_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
case GST_STATE_CHANGE_READY_TO_NULL:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL)
goto error;
- GST_LOCK (fakesink);
+ GST_OBJECT_LOCK (fakesink);
g_free (fakesink->last_message);
fakesink->last_message = NULL;
- GST_UNLOCK (fakesink);
+ GST_OBJECT_UNLOCK (fakesink);
break;
default:
break;
const GstStructure *s;
gchar *sstr;
- GST_LOCK (src);
+ GST_OBJECT_LOCK (src);
g_free (src->last_message);
if ((s = gst_event_get_structure (event)))
g_strdup_printf ("event ******* E (type: %d, %s) %p",
GST_EVENT_TYPE (event), sstr, event);
g_free (sstr);
- GST_UNLOCK (src);
+ GST_OBJECT_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
}
g_value_set_boolean (value, src->dump);
break;
case PROP_LAST_MESSAGE:
- GST_LOCK (src);
+ GST_OBJECT_LOCK (src);
g_value_set_string (value, src->last_message);
- GST_UNLOCK (src);
+ GST_OBJECT_UNLOCK (src);
break;
case PROP_CAN_ACTIVATE_PUSH:
g_value_set_boolean (value, GST_BASE_SRC (src)->can_activate_push);
if (!src->silent) {
gchar ts_str[64], dur_str[64];
- GST_LOCK (src);
+ GST_OBJECT_LOCK (src);
g_free (src->last_message);
if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
G_GINT64_FORMAT ", flags: %d) %p", GST_BUFFER_SIZE (buf), ts_str,
dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
GST_MINI_OBJECT (buf)->flags, buf);
- GST_UNLOCK (src);
+ GST_OBJECT_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
}
src = GST_FAKE_SRC (basesrc);
- GST_LOCK (src);
+ GST_OBJECT_LOCK (src);
if (src->parent) {
gst_buffer_unref (src->parent);
src->parent = NULL;
}
g_free (src->last_message);
src->last_message = NULL;
- GST_UNLOCK (src);
+ GST_OBJECT_UNLOCK (src);
return TRUE;
}
const GstStructure *s;
gchar *sstr;
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
if ((s = gst_event_get_structure (event)))
GST_DEBUG_PAD_NAME (trans->sinkpad), GST_EVENT_TYPE (event), sstr,
event);
g_free (sstr);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
g_object_notify (G_OBJECT (identity), "last_message");
}
if (identity->drop_probability > 0.0) {
if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
identity->last_message =
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, timestamp: %"
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
GST_BUFFER_FLAGS (buf), buf);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
g_object_notify (G_OBJECT (identity), "last-message");
return GST_FLOW_OK;
}
}
if (!identity->silent) {
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
identity->last_message =
g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, timestamp: %"
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
GST_BUFFER_FLAGS (buf), buf);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
g_object_notify (G_OBJECT (identity), "last-message");
}
if (identity->sync) {
GstClock *clock;
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
if ((clock = GST_ELEMENT (identity)->clock)) {
GstClockReturn cret;
GstClockTime timestamp;
/* save id if we need to unlock */
/* FIXME: actually unlock this somewhere in the state changes */
identity->clock_id = gst_clock_new_single_shot_id (clock, timestamp);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
cret = gst_clock_id_wait (identity->clock_id, NULL);
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
if (identity->clock_id) {
gst_clock_id_unref (identity->clock_id);
identity->clock_id = NULL;
if (cret == GST_CLOCK_UNSCHEDULED)
ret = GST_FLOW_UNEXPECTED;
}
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
}
identity->offset += GST_BUFFER_SIZE (buf);
g_value_set_boolean (value, identity->dump);
break;
case PROP_LAST_MESSAGE:
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_value_set_string (value, identity->last_message);
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
break;
case PROP_SYNC:
g_value_set_boolean (value, identity->sync);
identity = GST_IDENTITY (trans);
- GST_LOCK (identity);
+ GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
identity->last_message = NULL;
- GST_UNLOCK (identity);
+ GST_OBJECT_UNLOCK (identity);
return TRUE;
}
tee = GST_TEE (element);
- GST_LOCK (tee);
+ GST_OBJECT_LOCK (tee);
name = g_strdup_printf ("src%d", tee->pad_counter++);
- GST_UNLOCK (tee);
+ GST_OBJECT_UNLOCK (tee);
srcpad = gst_pad_new_from_template (templ, name);
g_free (name);
{
GstTee *tee = GST_TEE (object);
- GST_LOCK (tee);
+ GST_OBJECT_LOCK (tee);
switch (prop_id) {
case PROP_HAS_SINK_LOOP:
tee->has_sink_loop = g_value_get_boolean (value);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_UNLOCK (tee);
+ GST_OBJECT_UNLOCK (tee);
}
static void
{
GstTee *tee = GST_TEE (object);
- GST_LOCK (tee);
+ GST_OBJECT_LOCK (tee);
switch (prop_id) {
case PROP_NUM_SRC_PADS:
g_value_set_int (value, GST_ELEMENT (tee)->numsrcpads);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_UNLOCK (tee);
+ GST_OBJECT_UNLOCK (tee);
}
typedef struct
--- /dev/null
+#!/bin/bash
+
+set -e
+
+if test -z "$1" -o -n "$2"; then
+ echo "Usage: $0 FILE" >&2
+ exit 1
+fi
+
+file=$1
+
+if grep -q GST_GET_LOCK $file; then
+ echo "$file: GST_GET_LOCK->GST_OBJECT_GET_LOCK"
+ perl -i -p -e 's/GST_GET_LOCK/GST_OBJECT_GET_LOCK/g' $file
+fi
+
+if egrep -q 'GST_LOCK' $file; then
+ echo "$file: GST_LOCK->GST_OBJECT_LOCK"
+ perl -i -p -e 's/GST_LOCK/GST_OBJECT_LOCK/g' $file
+fi
+
+if egrep -q 'GST_UNLOCK' $file; then
+ echo "$file: GST_UNLOCK->GST_OBJECT_UNLOCK"
+ perl -i -p -e 's/GST_UNLOCK/GST_OBJECT_UNLOCK/g' $file
+fi
+
fail_unless (gst_bin_add (GST_BIN (b1), sink));
fail_unless (gst_element_link_pads (src, NULL, i1, NULL));
fail_unless (gst_element_link_pads (i1, NULL, sink, NULL));
- GST_LOCK (b2);
+ GST_OBJECT_LOCK (b2);
fail_unless (b2->numsinkpads == 1);
fail_unless (GST_IS_GHOST_PAD (b2->sinkpads->data));
fail_unless (b2->numsrcpads == 1);
fail_unless (GST_IS_GHOST_PAD (b2->srcpads->data));
- GST_UNLOCK (b2);
+ GST_OBJECT_UNLOCK (b2);
fsrc = gst_element_get_pad (src, "src");
fail_unless (fsrc != NULL);
/* start looping and set/get name repeatedly */
for (i = 0; i < 1000; ++i) {
- GST_LOCK (object);
+ GST_OBJECT_LOCK (object);
g_free (GST_OBJECT_NAME (object));
GST_OBJECT_NAME (object) = g_strdup ("main");
THREAD_SWITCH ();
name = g_strdup (GST_OBJECT_NAME (object));
- GST_UNLOCK (object);
+ GST_OBJECT_UNLOCK (object);
fail_unless (strcmp (name, "main") == 0,
"Name got changed while lock held during run %d", i);
{
gint result;
- GST_LOCK (o);
- GST_LOCK (p);
+ GST_OBJECT_LOCK (o);
+ GST_OBJECT_LOCK (p);
if (o->name == NULL && p->name == NULL) {
result = 0;
result = strcmp (o->name, p->name);
}
- GST_UNLOCK (p);
- GST_UNLOCK (o);
+ GST_OBJECT_UNLOCK (p);
+ GST_OBJECT_UNLOCK (o);
return result;
}