}
/**
- * 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
* 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)
{
}
/**
- * 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:
* @pad: the #GstPad to query
*
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)
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);
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
/* 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
*/
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 ());
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);
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);
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 ());
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
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)
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);