From f4f4fa5e8f4be6b631b82a10507a2c4c59e804f0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 26 May 2011 16:15:52 +0200 Subject: [PATCH] pad: remove old gst_pad_set_blocked methods --- gst/gstpad.c | 68 ++----------------------------------------- gst/gstpad.h | 5 +--- tests/check/generic/sinks.c | 4 +-- tests/check/gst/gstevent.c | 6 ++-- tests/check/gst/gstghostpad.c | 4 +-- tests/check/gst/gstpad.c | 38 ++++++++++++------------ 6 files changed, 30 insertions(+), 95 deletions(-) diff --git a/gst/gstpad.c b/gst/gstpad.c index 041944f..4a70836 100644 --- a/gst/gstpad.c +++ b/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 * @blocked: boolean indicating whether the pad should be blocked or unblocked * @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. * * MT safe. - * - * Since: 0.10.23 */ gboolean -gst_pad_set_blocked_async_full (GstPad * pad, gboolean blocked, +gst_pad_set_blocked (GstPad * pad, gboolean blocked, GstPadBlockCallback callback, gpointer user_data, GDestroyNotify destroy_data) { @@ -1162,68 +1160,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. - * - * - * Pad block handlers are only called for source pads in push mode - * and sink pads in pull mode. - * - * - * 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. - * - * - * Pad blocks are only possible for source pads in push mode - * and sink pads in pull mode. - * - * - * 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: * @pad: the #GstPad to query * diff --git a/gst/gstpad.h b/gst/gstpad.h index aaecf8c..970e1ef 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -804,10 +804,7 @@ gboolean gst_pad_is_active (GstPad *pad); gboolean gst_pad_activate_pull (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_async (GstPad *pad, gboolean blocked, - GstPadBlockCallback callback, gpointer user_data); -gboolean gst_pad_set_blocked_async_full (GstPad *pad, gboolean blocked, +gboolean gst_pad_set_blocked (GstPad *pad, gboolean blocked, GstPadBlockCallback callback, gpointer user_data, GDestroyNotify destroy_data); gboolean gst_pad_is_blocked (GstPad *pad); diff --git a/tests/check/generic/sinks.c b/tests/check/generic/sinks.c index 4482473..3aca7f7 100644 --- a/tests/check/generic/sinks.c +++ b/tests/check/generic/sinks.c @@ -799,7 +799,7 @@ GST_START_TEST (test_add_live2) GST_DEBUG ("blocking srcpad"); /* block source pad */ 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 */ ret = gst_element_set_state (src, GST_STATE_PAUSED); @@ -827,7 +827,7 @@ GST_START_TEST (test_add_live2) GST_DEBUG ("unblocking srcpad"); /* 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"); diff --git a/tests/check/gst/gstevent.c b/tests/check/gst/gstevent.c index 4579317..4e80ccf 100644 --- a/tests/check/gst/gstevent.c +++ b/tests/check/gst/gstevent.c @@ -330,14 +330,16 @@ static void test_event got_event_time.tv_usec = 0; /* 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 */ fail_unless ((peer = gst_pad_get_peer (pad)) != NULL); gst_pad_send_event (peer, event); 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) { /* Wait up to 5 seconds for the event to appear */ diff --git a/tests/check/gst/gstghostpad.c b/tests/check/gst/gstghostpad.c index 457b6eb..bd5080f 100644 --- a/tests/check/gst/gstghostpad.c +++ b/tests/check/gst/gstghostpad.c @@ -514,7 +514,7 @@ GST_START_TEST (test_ghost_pads_block) block_data.cond = g_cond_new (); 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); /* and wait now */ 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 (); 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); /* and wait now */ g_cond_wait (block_data.cond, block_data.mutex); diff --git a/tests/check/gst/gstpad.c b/tests/check/gst/gstpad.c index a65130f..8d0bbbf 100644 --- a/tests/check/gst/gstpad.c +++ b/tests/check/gst/gstpad.c @@ -704,7 +704,7 @@ block_async_cb (GstPad * pad, gboolean blocked, gpointer user_data) 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) @@ -718,7 +718,7 @@ GST_START_TEST (test_block_async) fail_unless (pad != NULL); 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[1] == FALSE); @@ -733,7 +733,7 @@ GST_END_TEST; static void 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 @@ -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 * 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 */ @@ -766,7 +766,7 @@ GST_START_TEST (test_block_async_replace_callback) fail_unless (pad != NULL); 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; gst_pad_push (pad, gst_buffer_new ()); @@ -814,7 +814,7 @@ GST_START_TEST (test_block_async_full_destroy) fail_unless (pad != NULL); 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); 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 ()); /* 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); fail_unless (state == 1); /* 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); fail_unless (state == 2); /* block with the same data, callback is called */ 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); fail_unless (state == 2); /* now change user_data (to NULL in this case) so destroy_notify should be * called */ 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); fail_unless (state == 2); @@ -862,7 +862,7 @@ GST_START_TEST (test_block_async_full_destroy_dispose) fail_unless (pad != NULL); 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); 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; - fail_unless (gst_pad_set_blocked_async (pad, FALSE, unblock_async_no_flush_cb, - user_data)); + fail_unless (gst_pad_set_blocked (pad, FALSE, unblock_async_no_flush_cb, + user_data, NULL)); } 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[2] == FALSE); - fail_unless (gst_pad_set_blocked_async (pad, FALSE, unblock_async_not_called, - NULL)); + fail_unless (gst_pad_set_blocked (pad, FALSE, unblock_async_not_called, + NULL, NULL)); /* replace block_async_first with block_async_second so next time the pad is * blocked the latter should be called */ - fail_unless (gst_pad_set_blocked_async (pad, TRUE, - block_async_second_no_flush, user_data)); + fail_unless (gst_pad_set_blocked (pad, TRUE, + block_async_second_no_flush, user_data, NULL)); } 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); gst_pad_set_active (pad, TRUE); - fail_unless (gst_pad_set_blocked_async (pad, TRUE, block_async_first_no_flush, - bool_user_data)); + fail_unless (gst_pad_set_blocked (pad, TRUE, block_async_first_no_flush, + bool_user_data, NULL)); gst_pad_push (pad, gst_buffer_new ()); fail_unless (bool_user_data[0] == TRUE); -- 2.7.4