*.*: Ran scripts/update-macros. Oh yes. gst/gstobject.h (GST_OBJECT_GET_LOCK, GST_OBJECT_LOCK)

Original commit message from CVS:
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.
This commit is contained in:
Andy Wingo 2005-11-21 16:34:26 +00:00
parent 32d6280888
commit 44c548b205
46 changed files with 738 additions and 699 deletions

View file

@ -1,3 +1,16 @@
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:

View file

@ -202,12 +202,12 @@ GST_START_TEST (test_ghost_pads)
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);

View file

@ -208,12 +208,12 @@ GST_START_TEST (test_fake_object_name_threaded_right)
/* 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);
@ -261,8 +261,8 @@ gst_object_name_compare (GstObject * o, GstObject * p)
{
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;
@ -274,8 +274,8 @@ gst_object_name_compare (GstObject * o, GstObject * p)
result = strcmp (o->name, p->name);
}
GST_UNLOCK (p);
GST_UNLOCK (o);
GST_OBJECT_UNLOCK (p);
GST_OBJECT_UNLOCK (o);
return result;
}

View file

@ -151,7 +151,7 @@ Objects
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
@ -236,9 +236,9 @@ Objects
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
@ -263,11 +263,11 @@ Objects
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)
@ -292,9 +292,9 @@ Objects
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);
@ -350,7 +350,7 @@ Objects
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;
@ -358,14 +358,14 @@ Objects
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 */
@ -380,7 +380,7 @@ Objects
list = g_list_next (list);
}
}
GST_UNLOCK (lock);
GST_OBJECT_UNLOCK (lock);
* GstIterator

View file

@ -1092,10 +1092,10 @@ GST_CLASS_GET_LOCK
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

View file

@ -104,7 +104,7 @@
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>

View file

@ -3,7 +3,7 @@
// 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
@ -15,7 +15,7 @@
queue->level_buffers++;
/* we can unlock now */
GST_UNLOCK (queue);
GST_OBJECT_UNLOCK (queue);
if (tosignal) {
g_mutex_lock (queue->emptylock);
@ -27,7 +27,7 @@
// wait forever
g_cond_wait (queue->emptycond, queue->emptylock);
g_mutex_unlock (queue->emptylock);
GST_LOCK (queue);
GST_OBJECT_LOCK (queue);
}

View file

@ -481,7 +481,7 @@ Fixing Threading
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);
@ -491,18 +491,18 @@ Fixing Threading
/* 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);

View file

@ -368,7 +368,7 @@ gst_base_sink_get_property (GObject * object, guint prop_id, GValue * value,
{
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);
@ -380,7 +380,7 @@ gst_base_sink_get_property (GObject * object, guint prop_id, GValue * value,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_UNLOCK (sink);
GST_OBJECT_UNLOCK (sink);
}
static GstCaps *
@ -489,7 +489,7 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
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);
@ -521,7 +521,7 @@ gst_base_sink_commit_state (GstBaseSink * 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),
@ -546,7 +546,7 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
stopping:
{
/* app is going to READY */
GST_UNLOCK (basesink);
GST_OBJECT_UNLOCK (basesink);
return FALSE;
}
}
@ -752,10 +752,10 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
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. */
@ -781,10 +781,10 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
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);
@ -816,7 +816,7 @@ dropping:
}
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");
@ -883,12 +883,12 @@ gst_base_sink_event (GstPad * pad, GstEvent * event)
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 */
@ -913,9 +913,9 @@ gst_base_sink_event (GstPad * pad, GstEvent * event)
/* 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;
@ -979,11 +979,11 @@ gst_base_sink_wait (GstBaseSink * basesink, GstClockTime time)
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;
@ -1079,7 +1079,7 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
if (basesink->clock) {
GstClockTime base_time;
GST_LOCK (basesink);
GST_OBJECT_LOCK (basesink);
base_time = GST_ELEMENT_CAST (basesink)->base_time;
@ -1097,7 +1097,7 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
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 {
@ -1128,7 +1128,7 @@ gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
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)) {
@ -1136,7 +1136,7 @@ gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
basesink->end_time = GST_CLOCK_TIME_NONE;
}
}
GST_UNLOCK (basesink);
GST_OBJECT_UNLOCK (basesink);
break;
default:
break;
@ -1217,10 +1217,10 @@ gst_base_sink_chain (GstPad * pad, GstBuffer * buf)
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;
}
@ -1277,11 +1277,11 @@ gst_base_sink_deactivate (GstBaseSink * basesink, GstPad * pad)
/* 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)
@ -1428,10 +1428,10 @@ gst_base_sink_send_event (GstElement * element, GstEvent * event)
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);
@ -1464,17 +1464,17 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
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
@ -1492,7 +1492,7 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
res = TRUE;
}
GST_UNLOCK (basesink);
GST_OBJECT_UNLOCK (basesink);
}
default:
break;
@ -1653,12 +1653,12 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
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)

View file

@ -812,11 +812,11 @@ gst_base_src_wait (GstBaseSrc * basesrc, GstClockTime time)
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;
@ -853,7 +853,7 @@ gst_base_src_do_sync (GstBaseSrc * basesrc, GstBuffer * buffer)
", 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,
@ -862,7 +862,7 @@ gst_base_src_do_sync (GstBaseSrc * basesrc, GstBuffer * buffer)
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);
@ -892,10 +892,10 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length,
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);
@ -974,7 +974,7 @@ done:
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;
}
@ -1129,11 +1129,11 @@ gst_base_src_unlock (GstBaseSrc * basesrc)
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");

View file

@ -1422,7 +1422,7 @@ gst_base_transform_change_state (GstElement * element,
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),
@ -1437,7 +1437,7 @@ gst_base_transform_change_state (GstElement * element,
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;
@ -1489,7 +1489,7 @@ gst_base_transform_set_passthrough (GstBaseTransform * trans,
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;
@ -1498,7 +1498,7 @@ gst_base_transform_set_passthrough (GstBaseTransform * trans,
}
GST_DEBUG_OBJECT (trans, "set passthrough %d", trans->passthrough);
GST_UNLOCK (trans);
GST_OBJECT_UNLOCK (trans);
}
/**
@ -1518,9 +1518,9 @@ gst_base_transform_is_passthrough (GstBaseTransform * 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;
}
@ -1549,7 +1549,7 @@ gst_base_transform_set_in_place (GstBaseTransform * trans, gboolean in_place)
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
GST_LOCK (trans);
GST_OBJECT_LOCK (trans);
if (in_place) {
if (bclass->transform_ip) {
@ -1563,7 +1563,7 @@ gst_base_transform_set_in_place (GstBaseTransform * trans, gboolean in_place)
}
}
GST_UNLOCK (trans);
GST_OBJECT_UNLOCK (trans);
}
/**
@ -1583,9 +1583,9 @@ gst_base_transform_is_in_place (GstBaseTransform * 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;
}

View file

@ -158,10 +158,10 @@ gst_collect_pads_set_function (GstCollectPads * pads,
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);
}
/**
@ -197,14 +197,14 @@ gst_collect_pads_add_pad (GstCollectPads * pads, GstPad * pad, guint size)
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;
}
@ -238,7 +238,7 @@ gst_collect_pads_remove_pad (GstCollectPads * pads, GstPad * pad)
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);
@ -246,7 +246,7 @@ gst_collect_pads_remove_pad (GstCollectPads * pads, GstPad * pad)
}
pads->numpads--;
pads->cookie++;
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
return list != NULL;
}
@ -338,9 +338,9 @@ gst_collect_pads_start (GstCollectPads * 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 = TRUE;
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
}
/**
@ -358,10 +358,10 @@ gst_collect_pads_stop (GstCollectPads * 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);
}
/**
@ -581,7 +581,7 @@ gst_collect_pads_event (GstPad * pad, GstEvent * event)
{
GstFlowReturn ret = GST_FLOW_OK;
GST_LOCK (pads);
GST_OBJECT_LOCK (pads);
pads->eospads++;
@ -590,7 +590,7 @@ gst_collect_pads_event (GstPad * pad, GstEvent * event)
ret = pads->func (pads, pads->user_data);
}
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
/* We eat this event */
gst_event_unref (event);
@ -649,7 +649,7 @@ gst_collect_pads_chain (GstPad * pad, GstBuffer * buffer)
pads = data->collect;
size = GST_BUFFER_SIZE (buffer);
GST_LOCK (pads);
GST_OBJECT_LOCK (pads);
/* if not started, bail out */
if (!pads->started)
@ -685,7 +685,7 @@ gst_collect_pads_chain (GstPad * pad, GstBuffer * buffer)
GST_DEBUG ("Not all active pads have data, continuing");
ret = GST_FLOW_OK;
}
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
return ret;
@ -697,7 +697,7 @@ not_ours:
}
not_started:
{
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
GST_DEBUG ("collect_pads not started");
return GST_FLOW_WRONG_STATE;
}

View file

@ -75,7 +75,7 @@ struct _GstCollectData
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)))

View file

@ -274,9 +274,9 @@ gst_fake_sink_get_property (GObject * object, guint prop_id, GValue * value,
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);
@ -299,7 +299,7 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event)
const GstStructure *s;
gchar *sstr;
GST_LOCK (sink);
GST_OBJECT_LOCK (sink);
g_free (sink->last_message);
if ((s = gst_event_get_structure (event)))
@ -311,7 +311,7 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * 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");
}
@ -325,11 +325,11 @@ gst_fake_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
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");
}
@ -344,7 +344,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
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) {
@ -367,7 +367,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
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");
}
@ -419,10 +419,10 @@ gst_fake_sink_change_state (GstElement * element, GstStateChange transition)
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;

View file

@ -354,7 +354,7 @@ gst_fake_src_event_handler (GstBaseSrc * basesrc, GstEvent * event)
const GstStructure *s;
gchar *sstr;
GST_LOCK (src);
GST_OBJECT_LOCK (src);
g_free (src->last_message);
if ((s = gst_event_get_structure (event)))
@ -366,7 +366,7 @@ gst_fake_src_event_handler (GstBaseSrc * basesrc, GstEvent * 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");
}
@ -518,9 +518,9 @@ gst_fake_src_get_property (GObject * object, guint prop_id, GValue * value,
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);
@ -726,7 +726,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
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) {
@ -749,7 +749,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
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");
}
@ -788,14 +788,14 @@ gst_fake_src_stop (GstBaseSrc * basesrc)
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;
}

View file

@ -243,7 +243,7 @@ gst_identity_event (GstBaseTransform * trans, GstEvent * event)
const GstStructure *s;
gchar *sstr;
GST_LOCK (identity);
GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
if ((s = gst_event_get_structure (event)))
@ -256,7 +256,7 @@ gst_identity_event (GstBaseTransform * trans, GstEvent * 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");
}
@ -320,7 +320,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
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: %"
@ -331,7 +331,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
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;
}
@ -342,7 +342,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
}
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: %"
@ -353,7 +353,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
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");
}
@ -371,7 +371,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
if (identity->sync) {
GstClock *clock;
GST_LOCK (identity);
GST_OBJECT_LOCK (identity);
if ((clock = GST_ELEMENT (identity)->clock)) {
GstClockReturn cret;
GstClockTime timestamp;
@ -383,11 +383,11 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
/* 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;
@ -395,7 +395,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
if (cret == GST_CLOCK_UNSCHEDULED)
ret = GST_FLOW_UNEXPECTED;
}
GST_UNLOCK (identity);
GST_OBJECT_UNLOCK (identity);
}
identity->offset += GST_BUFFER_SIZE (buf);
@ -473,9 +473,9 @@ gst_identity_get_property (GObject * object, guint prop_id, GValue * value,
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);
@ -511,10 +511,10 @@ gst_identity_stop (GstBaseTransform * trans)
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;
}

View file

@ -175,9 +175,9 @@ gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ,
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);
@ -197,7 +197,7 @@ gst_tee_set_property (GObject * object, guint prop_id, const GValue * value,
{
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);
@ -214,7 +214,7 @@ gst_tee_set_property (GObject * object, guint prop_id, const GValue * value,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_UNLOCK (tee);
GST_OBJECT_UNLOCK (tee);
}
static void
@ -223,7 +223,7 @@ gst_tee_get_property (GObject * object, guint prop_id, GValue * value,
{
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);
@ -244,7 +244,7 @@ gst_tee_get_property (GObject * object, guint prop_id, GValue * value,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_UNLOCK (tee);
GST_OBJECT_UNLOCK (tee);
}
typedef struct

View file

@ -245,10 +245,10 @@ gst_bin_child_proxy_get_child_by_index (GstChildProxy * child_proxy,
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;
}
@ -261,9 +261,9 @@ gst_bin_child_proxy_get_children_count (GstChildProxy * child_proxy)
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;
}
@ -418,13 +418,13 @@ gst_bin_set_index_func (GstElement * element, GstIndex * index)
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
@ -440,7 +440,7 @@ gst_bin_set_clock_func (GstElement * element, GstClock * clock)
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);
@ -448,7 +448,7 @@ gst_bin_set_clock_func (GstElement * element, GstClock * clock)
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
@ -471,7 +471,7 @@ gst_bin_provide_clock_func (GstElement * element)
bin = GST_BIN (element);
GST_LOCK (bin);
GST_OBJECT_LOCK (bin);
if (!bin->clock_dirty)
goto not_dirty;
@ -503,7 +503,7 @@ gst_bin_provide_clock_func (GstElement * element)
(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);
@ -514,7 +514,7 @@ not_dirty:
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;
}
@ -685,12 +685,12 @@ gst_bin_add_func (GstBin * bin, GstElement * element)
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
@ -728,7 +728,7 @@ gst_bin_add_func (GstBin * bin, GstElement * element)
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);
@ -750,23 +750,23 @@ gst_bin_add_func (GstBin * bin, GstElement * element)
/* 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;
}
@ -831,7 +831,7 @@ gst_bin_remove_func (GstBin * bin, GstElement * element)
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)))
@ -841,14 +841,14 @@ gst_bin_remove_func (GstBin * bin, GstElement * element)
/* 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;
@ -880,7 +880,7 @@ gst_bin_remove_func (GstBin * bin, GstElement * element)
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);
@ -897,9 +897,9 @@ gst_bin_remove_func (GstBin * bin, GstElement * element)
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);
@ -913,13 +913,13 @@ not_in_bin:
{
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;
}
}
@ -1001,19 +1001,19 @@ gst_bin_iterate_elements (GstBin * bin)
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;
}
@ -1051,19 +1051,19 @@ gst_bin_iterate_recurse (GstBin * bin)
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;
}
@ -1077,13 +1077,13 @@ bin_element_is_sink (GstElement * child, GstBin * bin)
/* 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;
}
@ -1163,7 +1163,7 @@ gst_bin_recalc_state (GstBin * bin, gboolean force)
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;
@ -1201,14 +1201,14 @@ restart:
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
@ -1257,7 +1257,7 @@ restart:
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
@ -1285,20 +1285,20 @@ done:
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:
@ -1373,9 +1373,9 @@ reset_degree (GstElement * element, GstBinSortIterator * bit)
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);
@ -1397,7 +1397,7 @@ update_degree (GstElement * element, GstBinSortIterator * bit)
{
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
@ -1411,7 +1411,7 @@ update_degree (GstElement * element, GstBinSortIterator * bit)
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)) {
@ -1434,7 +1434,7 @@ update_degree (GstElement * element, GstBinSortIterator * bit)
}
linked = TRUE;
}
GST_UNLOCK (peer_element);
GST_OBJECT_UNLOCK (peer_element);
gst_object_unref (peer_element);
}
gst_object_unref (peer);
@ -1445,7 +1445,7 @@ update_degree (GstElement * element, GstBinSortIterator * bit)
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
@ -1550,7 +1550,7 @@ gst_bin_sort_iterator_new (GstBin * bin)
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,
@ -1590,9 +1590,9 @@ gst_bin_iterate_sorted (GstBin * bin)
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;
}
@ -1604,9 +1604,9 @@ gst_bin_element_set_state (GstBin * bin, GstElement * element, GstState pending)
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)) {
@ -1645,10 +1645,10 @@ gst_bin_change_state_func (GstElement * element, GstStateChange transition)
/* 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 */
@ -1858,10 +1858,10 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
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) {
@ -1881,7 +1881,7 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
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;
@ -1895,14 +1895,14 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
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 */
@ -1912,11 +1912,11 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
}
}
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:
{
@ -1927,7 +1927,7 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
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. */
@ -1943,7 +1943,7 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
/* 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),
@ -1956,9 +1956,9 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
{
/* 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:
@ -1968,7 +1968,7 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
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. */
@ -1977,7 +1977,7 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
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;
@ -1988,12 +1988,12 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
{
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;
@ -2061,10 +2061,10 @@ bin_query_duration_done (GstBin * bin, QueryFold * fold)
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 */
@ -2103,7 +2103,7 @@ gst_bin_query (GstElement * element, GstQuery * query)
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;
@ -2118,7 +2118,7 @@ gst_bin_query (GstElement * element, GstQuery * query)
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;
@ -2126,7 +2126,7 @@ gst_bin_query (GstElement * element, GstQuery * query)
}
}
}
GST_UNLOCK (bin);
GST_OBJECT_UNLOCK (bin);
fold_func = (GstIteratorFoldFunction) bin_query_duration_fold;
fold_init = bin_query_duration_init;
@ -2187,9 +2187,9 @@ compare_name (GstElement * element, const gchar * name)
{
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);

View file

@ -308,14 +308,14 @@ gst_bus_post (GstBus * bus, GstMessage * message)
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)
@ -383,7 +383,7 @@ is_flushing:
{
GST_DEBUG_OBJECT (bus, "bus is flushing");
gst_message_unref (message);
GST_UNLOCK (bus);
GST_OBJECT_UNLOCK (bus);
return FALSE;
}
@ -432,7 +432,7 @@ gst_bus_set_flushing (GstBus * bus, gboolean flushing)
{
GstMessage *message;
GST_LOCK (bus);
GST_OBJECT_LOCK (bus);
if (flushing) {
GST_OBJECT_FLAG_SET (bus, GST_BUS_FLUSHING);
@ -446,7 +446,7 @@ gst_bus_set_flushing (GstBus * bus, gboolean flushing)
GST_OBJECT_FLAG_UNSET (bus, GST_BUS_FLUSHING);
}
GST_UNLOCK (bus);
GST_OBJECT_UNLOCK (bus);
}
@ -531,7 +531,7 @@ gst_bus_set_sync_handler (GstBus * bus, GstBusSyncHandler func, gpointer data)
{
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 */
@ -540,13 +540,13 @@ gst_bus_set_sync_handler (GstBus * bus, GstBusSyncHandler func, gpointer data)
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;
}
@ -923,7 +923,7 @@ gst_bus_add_signal_watch (GstBus * 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 done;
@ -937,7 +937,7 @@ done:
bus->num_signal_watchers++;
GST_UNLOCK (bus);
GST_OBJECT_UNLOCK (bus);
}
/**
@ -954,7 +954,7 @@ gst_bus_remove_signal_watch (GstBus * 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;
@ -968,13 +968,13 @@ gst_bus_remove_signal_watch (GstBus * bus)
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;
}
}

View file

@ -681,10 +681,10 @@ gst_clock_get_time (GstClock * clock)
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));
@ -729,11 +729,11 @@ gst_clock_set_calibration (GstClock * clock, GstClockTime internal, GstClockTime
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);
}
/**
@ -757,14 +757,14 @@ gst_clock_get_calibration (GstClock * clock, GstClockTime * internal,
{
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

View file

@ -341,7 +341,7 @@ typedef enum {
*
* 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
@ -350,7 +350,7 @@ typedef enum {
* 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

View file

@ -403,9 +403,9 @@ gst_element_set_clock (GstElement * element, GstClock * clock)
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);
}
/**
@ -425,10 +425,10 @@ gst_element_get_clock (GstElement * 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;
}
@ -447,9 +447,9 @@ gst_element_set_base_time (GstElement * element, GstClockTime time)
{
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));
@ -475,9 +475,9 @@ gst_element_get_base_time (GstElement * element)
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;
}
@ -585,14 +585,14 @@ gst_element_add_pad (GstElement * element, GstPad * pad)
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;
@ -619,7 +619,7 @@ gst_element_add_pad (GstElement * element, GstPad * pad)
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);
@ -631,7 +631,7 @@ name_exists:
{
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;
}
@ -640,18 +640,18 @@ had_parent:
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;
}
}
@ -678,13 +678,13 @@ gst_element_remove_pad (GstElement * element, GstPad * pad)
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))) {
@ -699,7 +699,7 @@ gst_element_remove_pad (GstElement * element, GstPad * 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:
@ -717,7 +717,7 @@ gst_element_remove_pad (GstElement * element, GstPad * pad)
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);
@ -728,12 +728,12 @@ gst_element_remove_pad (GstElement * element, GstPad * 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;
}
}
@ -763,9 +763,9 @@ pad_compare_name (GstPad * pad1, const gchar * name)
{
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;
}
@ -792,7 +792,7 @@ gst_element_get_static_pad (GstElement * element, const gchar * name)
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) {
@ -807,7 +807,7 @@ gst_element_get_static_pad (GstElement * element, const gchar * name)
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;
}
@ -943,16 +943,16 @@ gst_element_iterate_pad_list (GstElement * element, GList ** padlist)
{
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;
}
@ -1120,11 +1120,11 @@ gst_element_get_random_pad (GstElement * element, GstPadDirection dir)
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:
@ -1133,24 +1133,24 @@ gst_element_get_random_pad (GstElement * element, GstPadDirection dir)
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;
@ -1361,14 +1361,14 @@ gst_element_post_message (GstElement * element, GstMessage * message)
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);
@ -1378,7 +1378,7 @@ gst_element_post_message (GstElement * element, GstMessage * message)
no_bus:
{
GST_DEBUG ("not posting message %p: no bus", message);
GST_UNLOCK (element);
GST_OBJECT_UNLOCK (element);
gst_message_unref (message);
return FALSE;
}
@ -1511,9 +1511,9 @@ gst_element_is_locked_state (GstElement * element)
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;
}
@ -1538,7 +1538,7 @@ gst_element_set_locked_state (GstElement * element, gboolean locked_state)
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))
@ -1553,12 +1553,12 @@ gst_element_set_locked_state (GstElement * element, gboolean 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;
}
@ -1585,10 +1585,10 @@ gst_element_sync_state_with_parent (GstElement * element)
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)",
@ -1624,7 +1624,7 @@ gst_element_get_state_func (GstElement * element,
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 */
@ -1698,7 +1698,7 @@ done:
"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;
@ -1711,7 +1711,7 @@ interrupted:
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "get_state() interruped");
GST_UNLOCK (element);
GST_OBJECT_UNLOCK (element);
return GST_STATE_CHANGE_FAILURE;
}
@ -1794,7 +1794,7 @@ gst_element_abort_state (GstElement * element)
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 ||
@ -1813,13 +1813,13 @@ gst_element_abort_state (GstElement * element)
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;
}
}
@ -1854,7 +1854,7 @@ gst_element_continue_state (GstElement * element, GstStateChangeReturn ret)
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);
@ -1877,7 +1877,7 @@ gst_element_continue_state (GstElement * element, GstStateChangeReturn ret)
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",
@ -1901,7 +1901,7 @@ gst_element_continue_state (GstElement * element, GstStateChangeReturn ret)
nothing_pending:
{
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "nothing pending");
GST_UNLOCK (element);
GST_OBJECT_UNLOCK (element);
return ret;
}
complete:
@ -1910,7 +1910,7 @@ 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
@ -1956,7 +1956,7 @@ gst_element_lost_state (GstElement * element)
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;
@ -1969,7 +1969,7 @@ gst_element_lost_state (GstElement * element)
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);
@ -1983,7 +1983,7 @@ gst_element_lost_state (GstElement * element)
nothing_lost:
{
GST_UNLOCK (element);
GST_OBJECT_UNLOCK (element);
return;
}
}
@ -2045,7 +2045,7 @@ gst_element_set_state_func (GstElement * element, GstState state)
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 */
@ -2099,7 +2099,7 @@ gst_element_set_state_func (GstElement * element, GstState state)
/* 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);
@ -2114,7 +2114,7 @@ was_busy:
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);
@ -2190,25 +2190,25 @@ gst_element_change_state (GstElement * element, GstStateChange transition)
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;
}
@ -2350,12 +2350,12 @@ gst_element_change_state_func (GstElement * element, GstStateChange transition)
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;
}
@ -2404,10 +2404,10 @@ gst_element_dispose (GObject * object)
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");
@ -2578,10 +2578,10 @@ gst_element_set_bus_func (GstElement * element, GstBus * bus)
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);
}
/**
@ -2624,10 +2624,10 @@ gst_element_get_bus (GstElement * 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);

View file

@ -327,9 +327,9 @@ G_STMT_START { \
#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));

View file

@ -669,9 +669,9 @@ on_int_notify (GstPad * internal, GParamSpec * unused, GstGhostPad * pad)
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)

View file

@ -439,13 +439,13 @@ gst_object_sink (gpointer object)
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);
}
}
@ -503,9 +503,9 @@ gst_object_dispose (GObject * 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);
@ -725,7 +725,7 @@ gst_object_set_name (GstObject * object, const gchar * name)
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))
@ -734,10 +734,10 @@ gst_object_set_name (GstObject * object, const gchar * name)
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;
@ -745,7 +745,7 @@ gst_object_set_name (GstObject * object, const gchar * name)
/* error */
had_parent:
{
GST_UNLOCK (object);
GST_OBJECT_UNLOCK (object);
return FALSE;
}
}
@ -770,9 +770,9 @@ gst_object_get_name (GstObject * object)
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;
}
@ -793,10 +793,10 @@ gst_object_set_name_prefix (GstObject * object, const gchar * name_prefix)
{
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);
}
/**
@ -819,9 +819,9 @@ gst_object_get_name_prefix (GstObject * 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;
}
@ -852,7 +852,7 @@ gst_object_set_parent (GstObject * object, GstObject * parent)
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;
@ -863,9 +863,9 @@ gst_object_set_parent (GstObject * object, GstObject * 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);
}
@ -876,7 +876,7 @@ gst_object_set_parent (GstObject * object, GstObject * parent)
/* ERROR handling */
had_parent:
{
GST_UNLOCK (object);
GST_OBJECT_UNLOCK (object);
return FALSE;
}
}
@ -900,11 +900,11 @@ gst_object_get_parent (GstObject * object)
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;
}
@ -925,20 +925,20 @@ gst_object_unparent (GstObject * object)
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);
}
}
@ -1003,9 +1003,9 @@ gst_object_check_uniqueness (GList * list, const gchar * name)
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;

View file

@ -86,20 +86,20 @@ typedef enum
* 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.
@ -107,14 +107,14 @@ typedef enum
* 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))
/**

View file

@ -537,9 +537,9 @@ gst_pad_get_direction (GstPad * pad)
* 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;
}
@ -556,21 +556,21 @@ pre_activate (GstPad * pad, GstActivateMode new_mode)
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;
}
}
@ -587,10 +587,10 @@ post_activate (GstPad * pad, GstActivateMode new_mode)
/* 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;
}
@ -624,9 +624,9 @@ gst_pad_set_active (GstPad * pad, gboolean active)
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) {
@ -653,10 +653,10 @@ gst_pad_set_active (GstPad * pad, gboolean active)
}
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;
@ -687,9 +687,9 @@ gst_pad_activate_pull (GstPad * pad, gboolean active)
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))
@ -733,10 +733,10 @@ was_ok:
}
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;
}
@ -773,9 +773,9 @@ gst_pad_activate_push (GstPad * pad, gboolean active)
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))
@ -837,9 +837,9 @@ gst_pad_is_active (GstPad * pad)
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;
}
@ -877,7 +877,7 @@ gst_pad_set_blocked_async (GstPad * pad, gboolean blocked,
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
GST_LOCK (pad);
GST_OBJECT_LOCK (pad);
was_blocked = GST_PAD_IS_BLOCKED (pad);
@ -914,7 +914,7 @@ gst_pad_set_blocked_async (GstPad * pad, gboolean blocked,
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "unblocked");
}
}
GST_UNLOCK (pad);
GST_OBJECT_UNLOCK (pad);
return TRUE;
@ -922,7 +922,7 @@ had_right_state:
{
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;
}
}
@ -967,9 +967,9 @@ gst_pad_is_blocked (GstPad * pad)
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;
}
@ -1409,12 +1409,12 @@ gst_pad_unlink (GstPad * srcpad, GstPad * sinkpad)
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;
@ -1433,8 +1433,8 @@ gst_pad_unlink (GstPad * srcpad, GstPad * 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 */
@ -1449,22 +1449,22 @@ gst_pad_unlink (GstPad * srcpad, GstPad * sinkpad)
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;
}
}
@ -1486,9 +1486,9 @@ gst_pad_is_linked (GstPad * pad)
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;
}
@ -1588,7 +1588,7 @@ gst_pad_link_prepare (GstPad * srcpad, GstPad * sinkpad)
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;
@ -1596,7 +1596,7 @@ gst_pad_link_prepare (GstPad * srcpad, GstPad * sinkpad)
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;
@ -1620,7 +1620,7 @@ gst_pad_link_prepare (GstPad * srcpad, GstPad * 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:
@ -1629,14 +1629,14 @@ 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:
@ -1645,22 +1645,22 @@ 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;
}
}
@ -1688,8 +1688,8 @@ gst_pad_link (GstPad * srcpad, GstPad * sinkpad)
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. */
@ -1704,15 +1704,15 @@ gst_pad_link (GstPad * srcpad, GstPad * sinkpad)
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 */
@ -1725,8 +1725,8 @@ gst_pad_link (GstPad * srcpad, GstPad * sinkpad)
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;
@ -1741,9 +1741,9 @@ gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ)
{
/* 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);
@ -1783,9 +1783,9 @@ gst_pad_get_caps_unlocked (GstPad * 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) {
@ -1869,13 +1869,13 @@ gst_pad_get_caps (GstPad * pad)
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;
}
@ -1898,7 +1898,7 @@ gst_pad_peer_get_caps (GstPad * pad)
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);
@ -1908,7 +1908,7 @@ gst_pad_peer_get_caps (GstPad * pad)
goto no_peer;
gst_object_ref (peerpad);
GST_UNLOCK (pad);
GST_OBJECT_UNLOCK (pad);
result = gst_pad_get_caps (peerpad);
@ -1918,7 +1918,7 @@ gst_pad_peer_get_caps (GstPad * pad)
no_peer:
{
GST_UNLOCK (pad);
GST_OBJECT_UNLOCK (pad);
return NULL;
}
}
@ -2035,12 +2035,12 @@ gst_pad_accept_caps (GstPad * pad, GstCaps * caps)
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 */
@ -2083,7 +2083,7 @@ gst_pad_peer_accept_caps (GstPad * pad, GstCaps * caps)
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);
@ -2093,13 +2093,13 @@ gst_pad_peer_accept_caps (GstPad * pad, GstCaps * caps)
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;
}
}
@ -2129,7 +2129,7 @@ gst_pad_set_caps (GstPad * pad, GstCaps * caps)
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);
@ -2142,10 +2142,10 @@ gst_pad_set_caps (GstPad * pad, GstCaps * caps)
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",
@ -2156,7 +2156,7 @@ gst_pad_set_caps (GstPad * pad, GstCaps * caps)
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");
@ -2164,7 +2164,7 @@ gst_pad_set_caps (GstPad * pad, GstCaps * 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);
@ -2173,12 +2173,12 @@ setting_same_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;
}
@ -2286,11 +2286,11 @@ gst_pad_get_peer (GstPad * pad)
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;
}
@ -2320,7 +2320,7 @@ gst_pad_get_allowed_caps (GstPad * srcpad)
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))
@ -2330,7 +2330,7 @@ gst_pad_get_allowed_caps (GstPad * srcpad)
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);
@ -2348,7 +2348,7 @@ no_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;
}
@ -2379,7 +2379,7 @@ gst_pad_get_negotiated_caps (GstPad * pad)
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;
@ -2390,7 +2390,7 @@ gst_pad_get_negotiated_caps (GstPad * pad)
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);
@ -2400,7 +2400,7 @@ no_peer:
{
GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%s:%s: no peer",
GST_DEBUG_PAD_NAME (pad));
GST_UNLOCK (pad);
GST_OBJECT_UNLOCK (pad);
return NULL;
}
@ -2443,7 +2443,7 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
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;
@ -2452,12 +2452,12 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
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;
@ -2473,7 +2473,7 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
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);
@ -2509,7 +2509,7 @@ flushed:
{
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:
@ -2518,13 +2518,13 @@ 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",
@ -2976,9 +2976,9 @@ handle_pad_block (GstPad * pad)
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);
}
@ -2996,9 +2996,9 @@ handle_pad_block (GstPad * 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);
}
@ -3079,7 +3079,7 @@ gst_pad_chain (GstPad * pad, GstBuffer * buffer)
GST_STREAM_LOCK (pad);
GST_LOCK (pad);
GST_OBJECT_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
@ -3087,7 +3087,7 @@ gst_pad_chain (GstPad * pad, GstBuffer * buffer)
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. */
@ -3132,7 +3132,7 @@ flushing:
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;
}
@ -3187,7 +3187,7 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer)
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 */
@ -3199,20 +3199,20 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer)
* 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);
@ -3225,7 +3225,7 @@ flushed:
{
gst_buffer_unref (buffer);
GST_DEBUG_OBJECT (pad, "pad block stopped by flush");
GST_UNLOCK (pad);
GST_OBJECT_UNLOCK (pad);
return ret;
}
dropped:
@ -3239,7 +3239,7 @@ not_linked:
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;
}
}
@ -3269,7 +3269,7 @@ gst_pad_check_pull_range (GstPad * pad)
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;
@ -3277,7 +3277,7 @@ gst_pad_check_pull_range (GstPad * pad)
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)) {
@ -3298,14 +3298,14 @@ gst_pad_check_pull_range (GstPad * pad)
/* 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;
}
}
@ -3337,12 +3337,12 @@ gst_pad_get_range (GstPad * pad, guint64 offset, guint size,
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;
@ -3370,7 +3370,7 @@ flushing:
{
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;
}
@ -3420,7 +3420,7 @@ gst_pad_pull_range (GstPad * pad, guint64 offset, guint size,
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);
@ -3433,7 +3433,7 @@ gst_pad_pull_range (GstPad * pad, guint64 offset, guint size,
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);
@ -3451,7 +3451,7 @@ not_connected:
{
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:
@ -3486,7 +3486,7 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
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);
@ -3505,12 +3505,12 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
}
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)
@ -3518,7 +3518,7 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
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);
@ -3537,7 +3537,7 @@ dropping:
not_linked:
{
gst_event_unref (event);
GST_UNLOCK (pad);
GST_OBJECT_UNLOCK (pad);
return FALSE;
}
}
@ -3577,7 +3577,7 @@ gst_pad_send_event (GstPad * pad, GstEvent * event)
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))
@ -3618,7 +3618,7 @@ gst_pad_send_event (GstPad * pad, GstEvent * 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 */
@ -3644,7 +3644,7 @@ wrong_direction:
{
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;
}
@ -3652,13 +3652,13 @@ no_function:
{
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;
@ -3720,7 +3720,7 @@ gst_pad_start_task (GstPad * pad, GstTaskFunction func, gpointer data)
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);
@ -3728,7 +3728,7 @@ gst_pad_start_task (GstPad * pad, GstTaskFunction func, gpointer data)
GST_PAD_TASK (pad) = task;
}
gst_task_start (task);
GST_UNLOCK (pad);
GST_OBJECT_UNLOCK (pad);
return TRUE;
}
@ -3750,12 +3750,12 @@ gst_pad_pause_task (GstPad * pad)
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);
@ -3765,7 +3765,7 @@ gst_pad_pause_task (GstPad * pad)
no_task:
{
GST_DEBUG_OBJECT (pad, "pad has no task");
GST_UNLOCK (pad);
GST_OBJECT_UNLOCK (pad);
return FALSE;
}
}
@ -3793,13 +3793,13 @@ gst_pad_stop_task (GstPad * pad)
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);
@ -3812,7 +3812,7 @@ gst_pad_stop_task (GstPad * pad)
no_task:
{
GST_UNLOCK (pad);
GST_OBJECT_UNLOCK (pad);
GST_STREAM_LOCK (pad);
GST_STREAM_UNLOCK (pad);

View file

@ -485,7 +485,7 @@ struct _GstPadClass {
#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) */

View file

@ -184,7 +184,7 @@ gst_pipeline_set_property (GObject * object, guint prop_id,
{
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);
@ -193,7 +193,7 @@ gst_pipeline_set_property (GObject * object, guint prop_id,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_UNLOCK (pipeline);
GST_OBJECT_UNLOCK (pipeline);
}
static void
@ -202,7 +202,7 @@ gst_pipeline_get_property (GObject * object, guint prop_id,
{
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);
@ -211,7 +211,7 @@ gst_pipeline_get_property (GObject * object, guint prop_id,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_UNLOCK (pipeline);
GST_OBJECT_UNLOCK (pipeline);
}
static gboolean
@ -245,9 +245,9 @@ do_pipeline_seek (GstElement * element, GstEvent * event)
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 */
@ -308,10 +308,10 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition)
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;
@ -328,11 +328,11 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition)
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) */
@ -376,9 +376,9 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition)
{
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);
@ -387,18 +387,18 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition)
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;
@ -407,16 +407,16 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition)
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;
@ -460,9 +460,9 @@ gst_pipeline_set_new_stream_time (GstPipeline * pipeline, GstClockTime time)
{
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));
@ -491,9 +491,9 @@ gst_pipeline_get_last_stream_time (GstPipeline * pipeline)
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;
}
@ -505,16 +505,16 @@ gst_pipeline_provide_clock_func (GstElement * element)
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));
@ -565,12 +565,12 @@ gst_pipeline_use_clock (GstPipeline * pipeline, GstClock * clock)
{
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"));
@ -609,11 +609,11 @@ gst_pipeline_auto_clock (GstPipeline * pipeline)
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");
}

View file

@ -236,16 +236,16 @@ gst_registry_add_path (GstRegistry * registry, const gchar * path)
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);
}
/**
@ -263,11 +263,11 @@ gst_registry_get_path_list (GstRegistry * 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;
}
@ -289,7 +289,7 @@ gst_registry_add_plugin (GstRegistry * registry, GstPlugin * plugin)
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,
@ -306,7 +306,7 @@ gst_registry_add_plugin (GstRegistry * registry, GstPlugin * plugin)
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));
@ -328,9 +328,9 @@ gst_registry_remove_plugin (GstRegistry * registry, GstPlugin * plugin)
{
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);
}
@ -353,7 +353,7 @@ gst_registry_add_feature (GstRegistry * registry, GstPluginFeature * feature)
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) {
@ -369,7 +369,7 @@ gst_registry_add_feature (GstRegistry * registry, GstPluginFeature * 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,
@ -392,9 +392,9 @@ gst_registry_remove_feature (GstRegistry * registry, GstPluginFeature * feature)
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);
}
@ -422,13 +422,13 @@ gst_registry_plugin_filter (GstRegistry * registry,
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;
}
@ -456,13 +456,13 @@ gst_registry_feature_filter (GstRegistry * registry,
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;
}
@ -564,12 +564,12 @@ gst_registry_get_plugin_list (GstRegistry * registry)
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;
}
@ -598,11 +598,11 @@ gst_registry_lookup_feature (GstRegistry * registry, const char *name)
{
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;
}
@ -645,11 +645,11 @@ gst_registry_lookup (GstRegistry * registry, const char *filename)
{
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;
}

View file

@ -126,7 +126,7 @@ gst_system_clock_init (GstSystemClock * clock)
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)
@ -134,13 +134,13 @@ gst_system_clock_init (GstSystemClock * clock)
/* 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);
}
}
@ -153,7 +153,7 @@ gst_system_clock_dispose (GObject * object)
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)) {
@ -165,7 +165,7 @@ gst_system_clock_dispose (GObject * object)
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);
@ -238,7 +238,7 @@ gst_system_clock_async_thread (GstClock * clock)
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 */
@ -281,10 +281,10 @@ gst_system_clock_async_thread (GstClock * clock)
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 */
@ -320,7 +320,7 @@ gst_system_clock_async_thread (GstClock * clock)
exit:
/* signal exit */
GST_CLOCK_BROADCAST (clock);
GST_UNLOCK (clock);
GST_OBJECT_UNLOCK (clock);
GST_CAT_DEBUG (GST_CAT_CLOCK, "exit system clock thread");
}
@ -413,9 +413,9 @@ gst_system_clock_id_wait (GstClock * clock, GstClockEntry * entry)
{
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;
}
@ -432,7 +432,7 @@ gst_system_clock_id_wait_async (GstClock * clock, GstClockEntry * entry)
{
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 */
@ -446,7 +446,7 @@ gst_system_clock_id_wait_async (GstClock * clock, GstClockEntry * entry)
GST_CAT_DEBUG (GST_CAT_CLOCK, "send signal");
GST_CLOCK_BROADCAST (clock);
}
GST_UNLOCK (clock);
GST_OBJECT_UNLOCK (clock);
return GST_CLOCK_OK;
}
@ -463,9 +463,9 @@ gst_system_clock_id_unschedule (GstClock * clock, GstClockEntry * entry)
{
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);
}

View file

@ -152,16 +152,16 @@ gst_task_func (GstTask * task, GstTaskClass * tclass)
/* 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;
@ -172,31 +172,31 @@ gst_task_func (GstTask * task, GstTaskClass * tclass)
}
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 ());
@ -272,11 +272,11 @@ gst_task_create (GstTaskFunction func, gpointer data)
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;
@ -284,7 +284,7 @@ gst_task_set_lock (GstTask * task, GStaticRecMutex * mutex)
is_running:
{
g_warning ("cannot call set_lock on a running task");
GST_UNLOCK (task);
GST_OBJECT_UNLOCK (task);
}
}
@ -306,9 +306,9 @@ gst_task_get_state (GstTask * 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;
}
@ -333,7 +333,7 @@ gst_task_start (GstTask * task)
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;
@ -362,7 +362,7 @@ gst_task_start (GstTask * task)
/* was OK */
break;
}
GST_UNLOCK (task);
GST_OBJECT_UNLOCK (task);
return TRUE;
@ -398,7 +398,7 @@ gst_task_stop (GstTask * task)
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) {
@ -410,7 +410,7 @@ gst_task_stop (GstTask * task)
case GST_TASK_STARTED:
break;
}
GST_UNLOCK (task);
GST_OBJECT_UNLOCK (task);
return TRUE;
}
@ -437,7 +437,7 @@ gst_task_pause (GstTask * task)
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) {
@ -458,7 +458,7 @@ gst_task_pause (GstTask * task)
case GST_TASK_STARTED:
break;
}
GST_UNLOCK (task);
GST_OBJECT_UNLOCK (task);
return TRUE;
}
@ -486,12 +486,12 @@ gst_task_join (GstTask * task)
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);

View file

@ -83,7 +83,7 @@ typedef enum {
*
* 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

View file

@ -1126,12 +1126,12 @@ gst_element_link_pads (GstElement * src, const gchar * srcpadname,
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 */
@ -1159,12 +1159,12 @@ gst_element_link_pads (GstElement * src, const gchar * srcpadname,
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) {
@ -2442,14 +2442,14 @@ gst_pad_add_data_probe (GstPad * pad, GCallback handler, gpointer data)
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;
}
@ -2473,12 +2473,12 @@ gst_pad_add_event_probe (GstPad * pad, GCallback handler, gpointer data)
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;
}
@ -2502,12 +2502,12 @@ gst_pad_add_buffer_probe (GstPad * pad, GCallback handler, gpointer data)
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;
}
@ -2525,7 +2525,7 @@ gst_pad_remove_data_probe (GstPad * pad, guint handler_id)
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)--;
@ -2533,7 +2533,7 @@ gst_pad_remove_data_probe (GstPad * pad, guint handler_id)
("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);
}
/**
@ -2549,12 +2549,12 @@ gst_pad_remove_event_probe (GstPad * pad, guint handler_id)
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);
}
/**
@ -2570,12 +2570,12 @@ gst_pad_remove_buffer_probe (GstPad * pad, guint handler_id)
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);
}
/**

View file

@ -368,7 +368,7 @@ gst_base_sink_get_property (GObject * object, guint prop_id, GValue * value,
{
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);
@ -380,7 +380,7 @@ gst_base_sink_get_property (GObject * object, guint prop_id, GValue * value,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_UNLOCK (sink);
GST_OBJECT_UNLOCK (sink);
}
static GstCaps *
@ -489,7 +489,7 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
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);
@ -521,7 +521,7 @@ gst_base_sink_commit_state (GstBaseSink * 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),
@ -546,7 +546,7 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
stopping:
{
/* app is going to READY */
GST_UNLOCK (basesink);
GST_OBJECT_UNLOCK (basesink);
return FALSE;
}
}
@ -752,10 +752,10 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
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. */
@ -781,10 +781,10 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
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);
@ -816,7 +816,7 @@ dropping:
}
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");
@ -883,12 +883,12 @@ gst_base_sink_event (GstPad * pad, GstEvent * event)
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 */
@ -913,9 +913,9 @@ gst_base_sink_event (GstPad * pad, GstEvent * event)
/* 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;
@ -979,11 +979,11 @@ gst_base_sink_wait (GstBaseSink * basesink, GstClockTime time)
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;
@ -1079,7 +1079,7 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
if (basesink->clock) {
GstClockTime base_time;
GST_LOCK (basesink);
GST_OBJECT_LOCK (basesink);
base_time = GST_ELEMENT_CAST (basesink)->base_time;
@ -1097,7 +1097,7 @@ gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
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 {
@ -1128,7 +1128,7 @@ gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
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)) {
@ -1136,7 +1136,7 @@ gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
basesink->end_time = GST_CLOCK_TIME_NONE;
}
}
GST_UNLOCK (basesink);
GST_OBJECT_UNLOCK (basesink);
break;
default:
break;
@ -1217,10 +1217,10 @@ gst_base_sink_chain (GstPad * pad, GstBuffer * buf)
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;
}
@ -1277,11 +1277,11 @@ gst_base_sink_deactivate (GstBaseSink * basesink, GstPad * pad)
/* 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)
@ -1428,10 +1428,10 @@ gst_base_sink_send_event (GstElement * element, GstEvent * event)
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);
@ -1464,17 +1464,17 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
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
@ -1492,7 +1492,7 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
res = TRUE;
}
GST_UNLOCK (basesink);
GST_OBJECT_UNLOCK (basesink);
}
default:
break;
@ -1653,12 +1653,12 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
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)

View file

@ -812,11 +812,11 @@ gst_base_src_wait (GstBaseSrc * basesrc, GstClockTime time)
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;
@ -853,7 +853,7 @@ gst_base_src_do_sync (GstBaseSrc * basesrc, GstBuffer * buffer)
", 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,
@ -862,7 +862,7 @@ gst_base_src_do_sync (GstBaseSrc * basesrc, GstBuffer * buffer)
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);
@ -892,10 +892,10 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length,
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);
@ -974,7 +974,7 @@ done:
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;
}
@ -1129,11 +1129,11 @@ gst_base_src_unlock (GstBaseSrc * basesrc)
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");

View file

@ -1422,7 +1422,7 @@ gst_base_transform_change_state (GstElement * element,
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),
@ -1437,7 +1437,7 @@ gst_base_transform_change_state (GstElement * element,
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;
@ -1489,7 +1489,7 @@ gst_base_transform_set_passthrough (GstBaseTransform * trans,
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;
@ -1498,7 +1498,7 @@ gst_base_transform_set_passthrough (GstBaseTransform * trans,
}
GST_DEBUG_OBJECT (trans, "set passthrough %d", trans->passthrough);
GST_UNLOCK (trans);
GST_OBJECT_UNLOCK (trans);
}
/**
@ -1518,9 +1518,9 @@ gst_base_transform_is_passthrough (GstBaseTransform * 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;
}
@ -1549,7 +1549,7 @@ gst_base_transform_set_in_place (GstBaseTransform * trans, gboolean in_place)
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
GST_LOCK (trans);
GST_OBJECT_LOCK (trans);
if (in_place) {
if (bclass->transform_ip) {
@ -1563,7 +1563,7 @@ gst_base_transform_set_in_place (GstBaseTransform * trans, gboolean in_place)
}
}
GST_UNLOCK (trans);
GST_OBJECT_UNLOCK (trans);
}
/**
@ -1583,9 +1583,9 @@ gst_base_transform_is_in_place (GstBaseTransform * 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;
}

View file

@ -158,10 +158,10 @@ gst_collect_pads_set_function (GstCollectPads * pads,
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);
}
/**
@ -197,14 +197,14 @@ gst_collect_pads_add_pad (GstCollectPads * pads, GstPad * pad, guint size)
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;
}
@ -238,7 +238,7 @@ gst_collect_pads_remove_pad (GstCollectPads * pads, GstPad * pad)
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);
@ -246,7 +246,7 @@ gst_collect_pads_remove_pad (GstCollectPads * pads, GstPad * pad)
}
pads->numpads--;
pads->cookie++;
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
return list != NULL;
}
@ -338,9 +338,9 @@ gst_collect_pads_start (GstCollectPads * 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 = TRUE;
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
}
/**
@ -358,10 +358,10 @@ gst_collect_pads_stop (GstCollectPads * 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);
}
/**
@ -581,7 +581,7 @@ gst_collect_pads_event (GstPad * pad, GstEvent * event)
{
GstFlowReturn ret = GST_FLOW_OK;
GST_LOCK (pads);
GST_OBJECT_LOCK (pads);
pads->eospads++;
@ -590,7 +590,7 @@ gst_collect_pads_event (GstPad * pad, GstEvent * event)
ret = pads->func (pads, pads->user_data);
}
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
/* We eat this event */
gst_event_unref (event);
@ -649,7 +649,7 @@ gst_collect_pads_chain (GstPad * pad, GstBuffer * buffer)
pads = data->collect;
size = GST_BUFFER_SIZE (buffer);
GST_LOCK (pads);
GST_OBJECT_LOCK (pads);
/* if not started, bail out */
if (!pads->started)
@ -685,7 +685,7 @@ gst_collect_pads_chain (GstPad * pad, GstBuffer * buffer)
GST_DEBUG ("Not all active pads have data, continuing");
ret = GST_FLOW_OK;
}
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
return ret;
@ -697,7 +697,7 @@ not_ours:
}
not_started:
{
GST_UNLOCK (pads);
GST_OBJECT_UNLOCK (pads);
GST_DEBUG ("collect_pads not started");
return GST_FLOW_WRONG_STATE;
}

View file

@ -75,7 +75,7 @@ struct _GstCollectData
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)))

View file

@ -274,9 +274,9 @@ gst_fake_sink_get_property (GObject * object, guint prop_id, GValue * value,
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);
@ -299,7 +299,7 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event)
const GstStructure *s;
gchar *sstr;
GST_LOCK (sink);
GST_OBJECT_LOCK (sink);
g_free (sink->last_message);
if ((s = gst_event_get_structure (event)))
@ -311,7 +311,7 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * 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");
}
@ -325,11 +325,11 @@ gst_fake_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
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");
}
@ -344,7 +344,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
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) {
@ -367,7 +367,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
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");
}
@ -419,10 +419,10 @@ gst_fake_sink_change_state (GstElement * element, GstStateChange transition)
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;

View file

@ -354,7 +354,7 @@ gst_fake_src_event_handler (GstBaseSrc * basesrc, GstEvent * event)
const GstStructure *s;
gchar *sstr;
GST_LOCK (src);
GST_OBJECT_LOCK (src);
g_free (src->last_message);
if ((s = gst_event_get_structure (event)))
@ -366,7 +366,7 @@ gst_fake_src_event_handler (GstBaseSrc * basesrc, GstEvent * 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");
}
@ -518,9 +518,9 @@ gst_fake_src_get_property (GObject * object, guint prop_id, GValue * value,
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);
@ -726,7 +726,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
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) {
@ -749,7 +749,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
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");
}
@ -788,14 +788,14 @@ gst_fake_src_stop (GstBaseSrc * basesrc)
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;
}

View file

@ -243,7 +243,7 @@ gst_identity_event (GstBaseTransform * trans, GstEvent * event)
const GstStructure *s;
gchar *sstr;
GST_LOCK (identity);
GST_OBJECT_LOCK (identity);
g_free (identity->last_message);
if ((s = gst_event_get_structure (event)))
@ -256,7 +256,7 @@ gst_identity_event (GstBaseTransform * trans, GstEvent * 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");
}
@ -320,7 +320,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
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: %"
@ -331,7 +331,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
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;
}
@ -342,7 +342,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
}
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: %"
@ -353,7 +353,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
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");
}
@ -371,7 +371,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
if (identity->sync) {
GstClock *clock;
GST_LOCK (identity);
GST_OBJECT_LOCK (identity);
if ((clock = GST_ELEMENT (identity)->clock)) {
GstClockReturn cret;
GstClockTime timestamp;
@ -383,11 +383,11 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
/* 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;
@ -395,7 +395,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
if (cret == GST_CLOCK_UNSCHEDULED)
ret = GST_FLOW_UNEXPECTED;
}
GST_UNLOCK (identity);
GST_OBJECT_UNLOCK (identity);
}
identity->offset += GST_BUFFER_SIZE (buf);
@ -473,9 +473,9 @@ gst_identity_get_property (GObject * object, guint prop_id, GValue * value,
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);
@ -511,10 +511,10 @@ gst_identity_stop (GstBaseTransform * trans)
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;
}

View file

@ -175,9 +175,9 @@ gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ,
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);
@ -197,7 +197,7 @@ gst_tee_set_property (GObject * object, guint prop_id, const GValue * value,
{
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);
@ -214,7 +214,7 @@ gst_tee_set_property (GObject * object, guint prop_id, const GValue * value,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_UNLOCK (tee);
GST_OBJECT_UNLOCK (tee);
}
static void
@ -223,7 +223,7 @@ gst_tee_get_property (GObject * object, guint prop_id, GValue * value,
{
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);
@ -244,7 +244,7 @@ gst_tee_get_property (GObject * object, guint prop_id, GValue * value,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_UNLOCK (tee);
GST_OBJECT_UNLOCK (tee);
}
typedef struct

26
scripts/update-macros Executable file
View file

@ -0,0 +1,26 @@
#!/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

View file

@ -202,12 +202,12 @@ GST_START_TEST (test_ghost_pads)
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);

View file

@ -208,12 +208,12 @@ GST_START_TEST (test_fake_object_name_threaded_right)
/* 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);
@ -261,8 +261,8 @@ gst_object_name_compare (GstObject * o, GstObject * p)
{
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;
@ -274,8 +274,8 @@ gst_object_name_compare (GstObject * o, GstObject * p)
result = strcmp (o->name, p->name);
}
GST_UNLOCK (p);
GST_UNLOCK (o);
GST_OBJECT_UNLOCK (p);
GST_OBJECT_UNLOCK (o);
return result;
}