mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-24 17:44:14 +00:00
pad: remove old gst_pad_set_blocked methods
This commit is contained in:
parent
5076688c1f
commit
f4f4fa5e8f
6 changed files with 30 additions and 95 deletions
68
gst/gstpad.c
68
gst/gstpad.c
|
@ -1061,7 +1061,7 @@ gst_pad_is_active (GstPad * pad)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_pad_set_blocked_async_full:
|
* gst_pad_set_blocked:
|
||||||
* @pad: the #GstPad to block or unblock
|
* @pad: the #GstPad to block or unblock
|
||||||
* @blocked: boolean indicating whether the pad should be blocked or unblocked
|
* @blocked: boolean indicating whether the pad should be blocked or unblocked
|
||||||
* @callback: #GstPadBlockCallback that will be called when the
|
* @callback: #GstPadBlockCallback that will be called when the
|
||||||
|
@ -1089,11 +1089,9 @@ gst_pad_is_active (GstPad * pad)
|
||||||
* wrong parameters were passed or the pad was already in the requested state.
|
* wrong parameters were passed or the pad was already in the requested state.
|
||||||
*
|
*
|
||||||
* MT safe.
|
* MT safe.
|
||||||
*
|
|
||||||
* Since: 0.10.23
|
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_pad_set_blocked_async_full (GstPad * pad, gboolean blocked,
|
gst_pad_set_blocked (GstPad * pad, gboolean blocked,
|
||||||
GstPadBlockCallback callback, gpointer user_data,
|
GstPadBlockCallback callback, gpointer user_data,
|
||||||
GDestroyNotify destroy_data)
|
GDestroyNotify destroy_data)
|
||||||
{
|
{
|
||||||
|
@ -1161,68 +1159,6 @@ had_right_state:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_pad_set_blocked_async:
|
|
||||||
* @pad: the #GstPad to block or unblock
|
|
||||||
* @blocked: boolean indicating whether the pad should be blocked or unblocked
|
|
||||||
* @callback: #GstPadBlockCallback that will be called when the
|
|
||||||
* operation succeeds
|
|
||||||
* @user_data: (closure): user data passed to the callback
|
|
||||||
*
|
|
||||||
* Blocks or unblocks the dataflow on a pad. The provided callback
|
|
||||||
* is called when the operation succeeds; this happens right before the next
|
|
||||||
* attempt at pushing a buffer on the pad.
|
|
||||||
*
|
|
||||||
* This can take a while as the pad can only become blocked when real dataflow
|
|
||||||
* is happening.
|
|
||||||
* When the pipeline is stalled, for example in PAUSED, this can
|
|
||||||
* take an indeterminate amount of time.
|
|
||||||
* You can pass NULL as the callback to make this call block. Be careful with
|
|
||||||
* this blocking call as it might not return for reasons stated above.
|
|
||||||
*
|
|
||||||
* <note>
|
|
||||||
* Pad block handlers are only called for source pads in push mode
|
|
||||||
* and sink pads in pull mode.
|
|
||||||
* </note>
|
|
||||||
*
|
|
||||||
* Returns: TRUE if the pad could be blocked. This function can fail if the
|
|
||||||
* wrong parameters were passed or the pad was already in the requested state.
|
|
||||||
*
|
|
||||||
* MT safe.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_pad_set_blocked_async (GstPad * pad, gboolean blocked,
|
|
||||||
GstPadBlockCallback callback, gpointer user_data)
|
|
||||||
{
|
|
||||||
return gst_pad_set_blocked_async_full (pad, blocked,
|
|
||||||
callback, user_data, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_pad_set_blocked:
|
|
||||||
* @pad: the #GstPad to block or unblock
|
|
||||||
* @blocked: boolean indicating we should block or unblock
|
|
||||||
*
|
|
||||||
* Blocks or unblocks the dataflow on a pad. This function is
|
|
||||||
* a shortcut for gst_pad_set_blocked_async() with a NULL
|
|
||||||
* callback.
|
|
||||||
*
|
|
||||||
* <note>
|
|
||||||
* Pad blocks are only possible for source pads in push mode
|
|
||||||
* and sink pads in pull mode.
|
|
||||||
* </note>
|
|
||||||
*
|
|
||||||
* Returns: TRUE if the pad could be blocked. This function can fail if the
|
|
||||||
* wrong parameters were passed or the pad was already in the requested state.
|
|
||||||
*
|
|
||||||
* MT safe.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_pad_set_blocked (GstPad * pad, gboolean blocked)
|
|
||||||
{
|
|
||||||
return gst_pad_set_blocked_async (pad, blocked, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_pad_is_blocked:
|
* gst_pad_is_blocked:
|
||||||
* @pad: the #GstPad to query
|
* @pad: the #GstPad to query
|
||||||
|
|
|
@ -804,10 +804,7 @@ gboolean gst_pad_is_active (GstPad *pad);
|
||||||
gboolean gst_pad_activate_pull (GstPad *pad, gboolean active);
|
gboolean gst_pad_activate_pull (GstPad *pad, gboolean active);
|
||||||
gboolean gst_pad_activate_push (GstPad *pad, gboolean active);
|
gboolean gst_pad_activate_push (GstPad *pad, gboolean active);
|
||||||
|
|
||||||
gboolean gst_pad_set_blocked (GstPad *pad, gboolean blocked);
|
gboolean gst_pad_set_blocked (GstPad *pad, gboolean blocked,
|
||||||
gboolean gst_pad_set_blocked_async (GstPad *pad, gboolean blocked,
|
|
||||||
GstPadBlockCallback callback, gpointer user_data);
|
|
||||||
gboolean gst_pad_set_blocked_async_full (GstPad *pad, gboolean blocked,
|
|
||||||
GstPadBlockCallback callback, gpointer user_data,
|
GstPadBlockCallback callback, gpointer user_data,
|
||||||
GDestroyNotify destroy_data);
|
GDestroyNotify destroy_data);
|
||||||
gboolean gst_pad_is_blocked (GstPad *pad);
|
gboolean gst_pad_is_blocked (GstPad *pad);
|
||||||
|
|
|
@ -799,7 +799,7 @@ GST_START_TEST (test_add_live2)
|
||||||
GST_DEBUG ("blocking srcpad");
|
GST_DEBUG ("blocking srcpad");
|
||||||
/* block source pad */
|
/* block source pad */
|
||||||
srcpad = gst_element_get_static_pad (src, "src");
|
srcpad = gst_element_get_static_pad (src, "src");
|
||||||
gst_pad_set_blocked_async (srcpad, TRUE, pad_blocked_cb, NULL);
|
gst_pad_set_blocked (srcpad, TRUE, pad_blocked_cb, NULL, NULL);
|
||||||
|
|
||||||
/* set source to PAUSED without adding it to the pipeline */
|
/* set source to PAUSED without adding it to the pipeline */
|
||||||
ret = gst_element_set_state (src, GST_STATE_PAUSED);
|
ret = gst_element_set_state (src, GST_STATE_PAUSED);
|
||||||
|
@ -827,7 +827,7 @@ GST_START_TEST (test_add_live2)
|
||||||
GST_DEBUG ("unblocking srcpad");
|
GST_DEBUG ("unblocking srcpad");
|
||||||
|
|
||||||
/* and unblock */
|
/* and unblock */
|
||||||
gst_pad_set_blocked_async (srcpad, FALSE, pad_blocked_cb, NULL);
|
gst_pad_set_blocked (srcpad, FALSE, pad_blocked_cb, NULL, NULL);
|
||||||
|
|
||||||
GST_DEBUG ("getting state");
|
GST_DEBUG ("getting state");
|
||||||
|
|
||||||
|
|
|
@ -330,14 +330,16 @@ static void test_event
|
||||||
got_event_time.tv_usec = 0;
|
got_event_time.tv_usec = 0;
|
||||||
|
|
||||||
/* We block the pad so the stream lock is released and we can send the event */
|
/* We block the pad so the stream lock is released and we can send the event */
|
||||||
fail_unless (gst_pad_set_blocked (fake_srcpad, TRUE) == TRUE);
|
fail_unless (gst_pad_set_blocked (fake_srcpad, TRUE, NULL, NULL,
|
||||||
|
NULL) == TRUE);
|
||||||
|
|
||||||
/* We send on the peer pad, since the pad is blocked */
|
/* We send on the peer pad, since the pad is blocked */
|
||||||
fail_unless ((peer = gst_pad_get_peer (pad)) != NULL);
|
fail_unless ((peer = gst_pad_get_peer (pad)) != NULL);
|
||||||
gst_pad_send_event (peer, event);
|
gst_pad_send_event (peer, event);
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
|
|
||||||
fail_unless (gst_pad_set_blocked (fake_srcpad, FALSE) == TRUE);
|
fail_unless (gst_pad_set_blocked (fake_srcpad, FALSE, NULL, NULL,
|
||||||
|
NULL) == TRUE);
|
||||||
|
|
||||||
if (expect_before_q) {
|
if (expect_before_q) {
|
||||||
/* Wait up to 5 seconds for the event to appear */
|
/* Wait up to 5 seconds for the event to appear */
|
||||||
|
|
|
@ -514,7 +514,7 @@ GST_START_TEST (test_ghost_pads_block)
|
||||||
block_data.cond = g_cond_new ();
|
block_data.cond = g_cond_new ();
|
||||||
|
|
||||||
g_mutex_lock (block_data.mutex);
|
g_mutex_lock (block_data.mutex);
|
||||||
gst_pad_set_blocked_async (srcghost, TRUE, block_callback, &block_data);
|
gst_pad_set_blocked (srcghost, TRUE, block_callback, &block_data, NULL);
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||||
/* and wait now */
|
/* and wait now */
|
||||||
g_cond_wait (block_data.cond, block_data.mutex);
|
g_cond_wait (block_data.cond, block_data.mutex);
|
||||||
|
@ -555,7 +555,7 @@ GST_START_TEST (test_ghost_pads_probes)
|
||||||
block_data.cond = g_cond_new ();
|
block_data.cond = g_cond_new ();
|
||||||
|
|
||||||
g_mutex_lock (block_data.mutex);
|
g_mutex_lock (block_data.mutex);
|
||||||
gst_pad_set_blocked_async (srcghost, TRUE, block_callback, &block_data);
|
gst_pad_set_blocked (srcghost, TRUE, block_callback, &block_data, NULL);
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||||
/* and wait now */
|
/* and wait now */
|
||||||
g_cond_wait (block_data.cond, block_data.mutex);
|
g_cond_wait (block_data.cond, block_data.mutex);
|
||||||
|
|
|
@ -704,7 +704,7 @@ block_async_cb (GstPad * pad, gboolean blocked, gpointer user_data)
|
||||||
|
|
||||||
bool_user_data[0] = blocked;
|
bool_user_data[0] = blocked;
|
||||||
|
|
||||||
gst_pad_set_blocked_async (pad, FALSE, unblock_async_cb, user_data);
|
gst_pad_set_blocked (pad, FALSE, unblock_async_cb, user_data, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_START_TEST (test_block_async)
|
GST_START_TEST (test_block_async)
|
||||||
|
@ -718,7 +718,7 @@ GST_START_TEST (test_block_async)
|
||||||
fail_unless (pad != NULL);
|
fail_unless (pad != NULL);
|
||||||
|
|
||||||
gst_pad_set_active (pad, TRUE);
|
gst_pad_set_active (pad, TRUE);
|
||||||
gst_pad_set_blocked_async (pad, TRUE, block_async_cb, &data);
|
gst_pad_set_blocked (pad, TRUE, block_async_cb, &data, NULL);
|
||||||
|
|
||||||
fail_unless (data[0] == FALSE);
|
fail_unless (data[0] == FALSE);
|
||||||
fail_unless (data[1] == FALSE);
|
fail_unless (data[1] == FALSE);
|
||||||
|
@ -733,7 +733,7 @@ GST_END_TEST;
|
||||||
static void
|
static void
|
||||||
block_async_second (GstPad * pad, gboolean blocked, gpointer user_data)
|
block_async_second (GstPad * pad, gboolean blocked, gpointer user_data)
|
||||||
{
|
{
|
||||||
gst_pad_set_blocked_async (pad, FALSE, unblock_async_cb, NULL);
|
gst_pad_set_blocked (pad, FALSE, unblock_async_cb, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -750,7 +750,7 @@ block_async_first (GstPad * pad, gboolean blocked, gpointer user_data)
|
||||||
|
|
||||||
/* replace block_async_first with block_async_second so next time the pad is
|
/* replace block_async_first with block_async_second so next time the pad is
|
||||||
* blocked the latter should be called */
|
* blocked the latter should be called */
|
||||||
gst_pad_set_blocked_async (pad, TRUE, block_async_second, NULL);
|
gst_pad_set_blocked (pad, TRUE, block_async_second, NULL, NULL);
|
||||||
|
|
||||||
/* unblock temporarily, in the next push block_async_second should be called
|
/* unblock temporarily, in the next push block_async_second should be called
|
||||||
*/
|
*/
|
||||||
|
@ -766,7 +766,7 @@ GST_START_TEST (test_block_async_replace_callback)
|
||||||
fail_unless (pad != NULL);
|
fail_unless (pad != NULL);
|
||||||
gst_pad_set_active (pad, TRUE);
|
gst_pad_set_active (pad, TRUE);
|
||||||
|
|
||||||
gst_pad_set_blocked_async (pad, TRUE, block_async_first, &blocked);
|
gst_pad_set_blocked (pad, TRUE, block_async_first, &blocked, NULL);
|
||||||
blocked = FALSE;
|
blocked = FALSE;
|
||||||
|
|
||||||
gst_pad_push (pad, gst_buffer_new ());
|
gst_pad_push (pad, gst_buffer_new ());
|
||||||
|
@ -814,7 +814,7 @@ GST_START_TEST (test_block_async_full_destroy)
|
||||||
fail_unless (pad != NULL);
|
fail_unless (pad != NULL);
|
||||||
gst_pad_set_active (pad, TRUE);
|
gst_pad_set_active (pad, TRUE);
|
||||||
|
|
||||||
gst_pad_set_blocked_async_full (pad, TRUE, block_async_full_cb,
|
gst_pad_set_blocked (pad, TRUE, block_async_full_cb,
|
||||||
&state, block_async_full_destroy);
|
&state, block_async_full_destroy);
|
||||||
fail_unless (state == 0);
|
fail_unless (state == 0);
|
||||||
|
|
||||||
|
@ -825,25 +825,25 @@ GST_START_TEST (test_block_async_full_destroy)
|
||||||
gst_pad_push_event (pad, gst_event_new_flush_stop ());
|
gst_pad_push_event (pad, gst_event_new_flush_stop ());
|
||||||
|
|
||||||
/* pad was already blocked so nothing happens */
|
/* pad was already blocked so nothing happens */
|
||||||
gst_pad_set_blocked_async_full (pad, TRUE, block_async_full_cb,
|
gst_pad_set_blocked (pad, TRUE, block_async_full_cb,
|
||||||
&state, block_async_full_destroy);
|
&state, block_async_full_destroy);
|
||||||
fail_unless (state == 1);
|
fail_unless (state == 1);
|
||||||
|
|
||||||
/* unblock with the same data, callback is called */
|
/* unblock with the same data, callback is called */
|
||||||
gst_pad_set_blocked_async_full (pad, FALSE, block_async_full_cb,
|
gst_pad_set_blocked (pad, FALSE, block_async_full_cb,
|
||||||
&state, block_async_full_destroy);
|
&state, block_async_full_destroy);
|
||||||
fail_unless (state == 2);
|
fail_unless (state == 2);
|
||||||
|
|
||||||
/* block with the same data, callback is called */
|
/* block with the same data, callback is called */
|
||||||
state = 1;
|
state = 1;
|
||||||
gst_pad_set_blocked_async_full (pad, TRUE, block_async_full_cb,
|
gst_pad_set_blocked (pad, TRUE, block_async_full_cb,
|
||||||
&state, block_async_full_destroy);
|
&state, block_async_full_destroy);
|
||||||
fail_unless (state == 2);
|
fail_unless (state == 2);
|
||||||
|
|
||||||
/* now change user_data (to NULL in this case) so destroy_notify should be
|
/* now change user_data (to NULL in this case) so destroy_notify should be
|
||||||
* called */
|
* called */
|
||||||
state = 1;
|
state = 1;
|
||||||
gst_pad_set_blocked_async_full (pad, FALSE, block_async_full_cb,
|
gst_pad_set_blocked (pad, FALSE, block_async_full_cb,
|
||||||
NULL, block_async_full_destroy);
|
NULL, block_async_full_destroy);
|
||||||
fail_unless (state == 2);
|
fail_unless (state == 2);
|
||||||
|
|
||||||
|
@ -862,7 +862,7 @@ GST_START_TEST (test_block_async_full_destroy_dispose)
|
||||||
fail_unless (pad != NULL);
|
fail_unless (pad != NULL);
|
||||||
gst_pad_set_active (pad, TRUE);
|
gst_pad_set_active (pad, TRUE);
|
||||||
|
|
||||||
gst_pad_set_blocked_async_full (pad, TRUE, block_async_full_cb,
|
gst_pad_set_blocked (pad, TRUE, block_async_full_cb,
|
||||||
&state, block_async_full_destroy);
|
&state, block_async_full_destroy);
|
||||||
|
|
||||||
gst_pad_push (pad, gst_buffer_new ());
|
gst_pad_push (pad, gst_buffer_new ());
|
||||||
|
@ -916,8 +916,8 @@ block_async_second_no_flush (GstPad * pad, gboolean blocked, gpointer user_data)
|
||||||
|
|
||||||
bool_user_data[1] = TRUE;
|
bool_user_data[1] = TRUE;
|
||||||
|
|
||||||
fail_unless (gst_pad_set_blocked_async (pad, FALSE, unblock_async_no_flush_cb,
|
fail_unless (gst_pad_set_blocked (pad, FALSE, unblock_async_no_flush_cb,
|
||||||
user_data));
|
user_data, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -938,13 +938,13 @@ block_async_first_no_flush (GstPad * pad, gboolean blocked, gpointer user_data)
|
||||||
fail_unless (bool_user_data[1] == FALSE);
|
fail_unless (bool_user_data[1] == FALSE);
|
||||||
fail_unless (bool_user_data[2] == FALSE);
|
fail_unless (bool_user_data[2] == FALSE);
|
||||||
|
|
||||||
fail_unless (gst_pad_set_blocked_async (pad, FALSE, unblock_async_not_called,
|
fail_unless (gst_pad_set_blocked (pad, FALSE, unblock_async_not_called,
|
||||||
NULL));
|
NULL, NULL));
|
||||||
|
|
||||||
/* replace block_async_first with block_async_second so next time the pad is
|
/* replace block_async_first with block_async_second so next time the pad is
|
||||||
* blocked the latter should be called */
|
* blocked the latter should be called */
|
||||||
fail_unless (gst_pad_set_blocked_async (pad, TRUE,
|
fail_unless (gst_pad_set_blocked (pad, TRUE,
|
||||||
block_async_second_no_flush, user_data));
|
block_async_second_no_flush, user_data, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_START_TEST (test_block_async_replace_callback_no_flush)
|
GST_START_TEST (test_block_async_replace_callback_no_flush)
|
||||||
|
@ -956,8 +956,8 @@ GST_START_TEST (test_block_async_replace_callback_no_flush)
|
||||||
fail_unless (pad != NULL);
|
fail_unless (pad != NULL);
|
||||||
gst_pad_set_active (pad, TRUE);
|
gst_pad_set_active (pad, TRUE);
|
||||||
|
|
||||||
fail_unless (gst_pad_set_blocked_async (pad, TRUE, block_async_first_no_flush,
|
fail_unless (gst_pad_set_blocked (pad, TRUE, block_async_first_no_flush,
|
||||||
bool_user_data));
|
bool_user_data, NULL));
|
||||||
|
|
||||||
gst_pad_push (pad, gst_buffer_new ());
|
gst_pad_push (pad, gst_buffer_new ());
|
||||||
fail_unless (bool_user_data[0] == TRUE);
|
fail_unless (bool_user_data[0] == TRUE);
|
||||||
|
|
Loading…
Reference in a new issue