Commit c7428aea authored by Wim Taymans's avatar Wim Taymans
Browse files

playbin: fixed for new pad block API

parent 29c3e31f
......@@ -3455,7 +3455,7 @@ gst_decode_pad_init (GstDecodePad * pad)
}
static void
source_pad_blocked_cb (GstPad * pad, gboolean blocked, GstDecodePad * dpad)
source_pad_blocked_cb (GstPad * pad, GstBlockType type, GstDecodePad * dpad)
{
GstDecodeChain *chain;
GstDecodeBin *dbin;
......@@ -3463,18 +3463,16 @@ source_pad_blocked_cb (GstPad * pad, gboolean blocked, GstDecodePad * dpad)
chain = dpad->chain;
dbin = chain->dbin;
GST_LOG_OBJECT (dpad, "blocked:%d, dpad->chain:%p", blocked, chain);
GST_LOG_OBJECT (dpad, "blocked: dpad->chain:%p", chain);
dpad->blocked = blocked;
dpad->blocked = TRUE;
if (dpad->blocked) {
EXPOSE_LOCK (dbin);
if (gst_decode_chain_is_complete (dbin->decode_chain)) {
if (!gst_decode_bin_expose (dbin))
GST_WARNING_OBJECT (dbin, "Couldn't expose group");
}
EXPOSE_UNLOCK (dbin);
}
}
static gboolean
......@@ -3510,10 +3508,16 @@ gst_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked)
/* do not block if shutting down.
* we do not consider/expect it blocked further below, but use other trick */
if (!blocked || !dbin->shutdown)
gst_pad_set_blocked (opad, blocked,
if (!blocked || !dbin->shutdown) {
if (blocked) {
gst_pad_block (opad, GST_BLOCK_TYPE_DATA,
(GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
(GDestroyNotify) gst_object_unref);
} else {
gst_pad_unblock (opad);
dpad->blocked = FALSE;
}
}
if (blocked) {
if (dbin->shutdown) {
......@@ -3671,9 +3675,8 @@ unblock_pads (GstDecodeBin * dbin)
continue;
GST_DEBUG_OBJECT (dpad, "unblocking");
gst_pad_set_blocked (opad, FALSE,
(GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (opad);
dpad->blocked = FALSE;
/* make flushing, prevent NOT_LINKED */
GST_PAD_SET_FLUSHING (GST_PAD_CAST (dpad));
gst_object_unref (dpad);
......
......@@ -505,18 +505,7 @@ gst_play_bin_dispose (GObject * object)
}
static void
gst_play_bin_vis_unblocked (GstPad * tee_pad, gboolean blocked,
gpointer user_data)
{
GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
if (play_bin->pending_visualisation)
gst_pad_set_blocked (tee_pad, FALSE, gst_play_bin_vis_unblocked,
play_bin, NULL);
}
static void
gst_play_bin_vis_blocked (GstPad * tee_pad, gboolean blocked,
gst_play_bin_vis_blocked (GstPad * tee_pad, GstBlockType type,
gpointer user_data)
{
GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
......@@ -619,8 +608,7 @@ beach:
}
/* Unblock the pad */
gst_pad_set_blocked (tee_pad, FALSE, gst_play_bin_vis_unblocked,
play_bin, NULL);
gst_pad_unblock (tee_pad);
}
static void
......@@ -702,8 +690,8 @@ gst_play_bin_set_property (GObject * object, guint prop_id,
play_bin->pending_visualisation = pending_visualisation;
/* Block with callback */
gst_pad_set_blocked (tee_pad, TRUE, gst_play_bin_vis_blocked,
play_bin, NULL);
gst_pad_block (tee_pad, GST_BLOCK_TYPE_DATA,
gst_play_bin_vis_blocked, play_bin, NULL);
beach:
if (vis_sink_pad) {
gst_object_unref (vis_sink_pad);
......@@ -1565,11 +1553,6 @@ subtitle_failed:
}
}
static void
dummy_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
{
}
static gboolean
setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
{
......@@ -1667,7 +1650,7 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
"file, ghosting to a suitable hierarchy");
/* Block the pad first, because as soon as we add a ghostpad, the queue
* will try and start pushing */
gst_pad_set_blocked (textsrcpad, TRUE, dummy_blocked_cb, NULL, NULL);
gst_pad_block (textsrcpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
origtextsrcpad = gst_object_ref (textsrcpad);
ghost = gst_ghost_pad_new ("text_src", textsrcpad);
......@@ -1711,7 +1694,7 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
if (textsrcpad)
gst_object_unref (textsrcpad);
if (origtextsrcpad) {
gst_pad_set_blocked (origtextsrcpad, FALSE, dummy_blocked_cb, NULL, NULL);
gst_pad_unblock (origtextsrcpad);
gst_object_unref (origtextsrcpad);
}
......@@ -1726,12 +1709,12 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
spu_sink_pad = gst_element_get_static_pad (sink, "subpicture_sink");
if (subpic_pad && spu_sink_pad) {
GST_LOG_OBJECT (play_bin, "Linking DVD subpicture stream onto SPU");
gst_pad_set_blocked (subpic_pad, TRUE, dummy_blocked_cb, NULL, NULL);
gst_pad_block (subpic_pad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
if (gst_pad_link (subpic_pad, spu_sink_pad) != GST_PAD_LINK_OK) {
GST_WARNING_OBJECT (play_bin,
"Failed to link DVD subpicture stream onto SPU");
}
gst_pad_set_blocked (subpic_pad, FALSE, dummy_blocked_cb, NULL, NULL);
gst_pad_unblock (subpic_pad);
}
if (subpic_pad)
gst_object_unref (subpic_pad);
......
......@@ -1583,12 +1583,6 @@ no_channels:
}
}
static void
_suburidecodebin_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
{
GST_DEBUG_OBJECT (pad, "Pad blocked: %d", blocked);
}
static void
gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
{
......@@ -1636,8 +1630,10 @@ gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
switch (gst_iterator_next (it, &item)) {
case GST_ITERATOR_OK:
sinkpad = g_value_get_object (&item);
gst_pad_set_blocked (sinkpad, block, _suburidecodebin_blocked_cb,
NULL, NULL);
if (block)
gst_pad_block (sinkpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
else
gst_pad_unblock (sinkpad);
g_value_reset (&item);
break;
case GST_ITERATOR_DONE:
......@@ -2368,13 +2364,6 @@ selector_active_pad_changed (GObject * selector, GParamSpec * pspec,
g_object_notify (G_OBJECT (playbin), property);
}
static void
selector_blocked (GstPad * pad, gboolean blocked, gpointer user_data)
{
/* no nothing */
GST_DEBUG_OBJECT (pad, "blocked callback, blocked: %d", blocked);
}
/* this callback sends a delayed event once the pad becomes unblocked */
static gboolean
stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
......@@ -2547,7 +2536,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
* streams and connect the sinks, resulting in not-linked errors. After we
* configured the sinks we will unblock them all. */
GST_DEBUG_OBJECT (playbin, "blocking %" GST_PTR_FORMAT, select->srcpad);
gst_pad_set_blocked (select->srcpad, TRUE, selector_blocked, NULL, NULL);
gst_pad_block (select->srcpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
}
/* get sinkpad for the new stream */
......@@ -2861,8 +2850,7 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
if (select->srcpad) {
GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
select->srcpad);
gst_pad_set_blocked (select->srcpad, FALSE, selector_blocked,
NULL, NULL);
gst_pad_unblock (select->srcpad);
}
}
GST_SOURCE_GROUP_UNLOCK (group);
......@@ -2894,8 +2882,7 @@ shutdown:
}
GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
select->srcpad);
gst_pad_set_blocked (select->srcpad, FALSE, selector_blocked,
NULL, NULL);
gst_pad_unblock (select->srcpad);
}
}
GST_SOURCE_GROUP_UNLOCK (group);
......
......@@ -662,19 +662,7 @@ gst_play_sink_get_sink (GstPlaySink * playsink, GstPlaySinkType type)
}
static void
gst_play_sink_vis_unblocked (GstPad * tee_pad, gboolean blocked,
gpointer user_data)
{
GstPlaySink *playsink;
playsink = GST_PLAY_SINK (user_data);
/* nothing to do here, we need a dummy callback here to make the async call
* non-blocking. */
GST_DEBUG_OBJECT (playsink, "vis pad unblocked");
}
static void
gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked,
gst_play_sink_vis_blocked (GstPad * tee_pad, GstBlockType type,
gpointer user_data)
{
GstPlaySink *playsink;
......@@ -713,8 +701,7 @@ gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked,
done:
/* Unblock the pad */
gst_pad_set_blocked (tee_pad, FALSE, gst_play_sink_vis_unblocked,
playsink, NULL);
gst_pad_unblock (tee_pad);
GST_PLAY_SINK_UNLOCK (playsink);
}
......@@ -752,8 +739,8 @@ gst_play_sink_set_vis_plugin (GstPlaySink * playsink, GstElement * vis)
* function returns FALSE but the previous pad block will do the right thing
* anyway. */
GST_DEBUG_OBJECT (playsink, "blocking vis pad");
gst_pad_set_blocked (chain->blockpad, TRUE, gst_play_sink_vis_blocked,
playsink, NULL);
gst_pad_block (chain->blockpad, GST_BLOCK_TYPE_DATA,
gst_play_sink_vis_blocked, playsink, NULL);
done:
GST_PLAY_SINK_UNLOCK (playsink);
......@@ -2872,7 +2859,7 @@ is_raw_pad (GstPad * pad)
}
static void
sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
sinkpad_blocked_cb (GstPad * blockedpad, GstBlockType type, gpointer user_data)
{
GstPlaySink *playsink = (GstPlaySink *) user_data;
GstPad *pad;
......@@ -2881,20 +2868,14 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
pad = GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (blockedpad)));
if (pad == playsink->video_pad) {
playsink->video_pad_blocked = blocked;
GST_DEBUG_OBJECT (pad, "Video pad blocked: %d", blocked);
playsink->video_pad_blocked = TRUE;
GST_DEBUG_OBJECT (pad, "Video pad blocked");
} else if (pad == playsink->audio_pad) {
playsink->audio_pad_blocked = blocked;
GST_DEBUG_OBJECT (pad, "Audio pad blocked: %d", blocked);
playsink->audio_pad_blocked = TRUE;
GST_DEBUG_OBJECT (pad, "Audio pad blocked");
} else if (pad == playsink->text_pad) {
playsink->text_pad_blocked = blocked;
GST_DEBUG_OBJECT (pad, "Text pad blocked: %d", blocked);
}
if (!blocked) {
gst_object_unref (pad);
GST_PLAY_SINK_UNLOCK (playsink);
return;
playsink->text_pad_blocked = TRUE;
GST_DEBUG_OBJECT (pad, "Text pad blocked");
}
if ((!playsink->video_pad || playsink->video_pad_blocked) &&
......@@ -2920,27 +2901,27 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad)));
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_unblock (opad);
gst_object_unref (opad);
playsink->video_pad_blocked = FALSE;
}
if (playsink->audio_pad) {
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad)));
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_unblock (opad);
gst_object_unref (opad);
playsink->audio_pad_blocked = FALSE;
}
if (playsink->text_pad) {
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad)));
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_unblock (opad);
gst_object_unref (opad);
playsink->text_pad_blocked = FALSE;
}
}
......@@ -2984,7 +2965,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad)));
gst_pad_set_blocked (opad, TRUE, sinkpad_blocked_cb,
gst_pad_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad);
}
......@@ -2993,7 +2974,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad)));
gst_pad_set_blocked (opad, TRUE, sinkpad_blocked_cb,
gst_pad_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad);
}
......@@ -3002,7 +2983,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad)));
gst_pad_set_blocked (opad, TRUE, sinkpad_blocked_cb,
gst_pad_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad);
}
......@@ -3117,7 +3098,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
GstPad *blockpad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (res)));
gst_pad_set_blocked (blockpad, TRUE, sinkpad_blocked_cb,
gst_pad_block (blockpad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (blockpad);
}
......@@ -3369,10 +3350,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad)));
if (gst_pad_is_blocked (opad)) {
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
}
gst_pad_unblock (opad);
gst_object_unref (opad);
playsink->video_pad_blocked = FALSE;
}
......@@ -3382,10 +3360,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad)));
if (gst_pad_is_blocked (opad)) {
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
}
gst_pad_unblock (opad);
gst_object_unref (opad);
playsink->audio_pad_blocked = FALSE;
}
......@@ -3394,10 +3369,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad)));
if (gst_pad_is_blocked (opad)) {
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
}
gst_pad_unblock (opad);
gst_object_unref (opad);
playsink->text_pad_blocked = FALSE;
}
......
......@@ -80,10 +80,8 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
gboolean raw;
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
self->sink_proxypad_blocked = blocked;
GST_DEBUG_OBJECT (self, "Pad blocked: %d", blocked);
if (!blocked)
goto done;
self->sink_proxypad_blocked = TRUE;
GST_DEBUG_OBJECT (self, "Pad blocked");
/* There must be a peer at this point */
peer = gst_pad_get_peer (self->sinkpad);
......@@ -206,11 +204,9 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
}
unblock:
gst_pad_set_blocked (self->sink_proxypad, FALSE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (self->sink_proxypad);
self->sink_proxypad_blocked = FALSE;
done:
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
return;
......@@ -220,9 +216,8 @@ link_failed:
(NULL), ("Failed to configure the audio converter."));
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad),
self->sink_proxypad);
gst_pad_set_blocked (self->sink_proxypad, FALSE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (self->sink_proxypad);
self->sink_proxypad_blocked = FALSE;
return;
}
}
......@@ -275,7 +270,7 @@ gst_play_sink_audio_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
reconfigure = TRUE;
gst_pad_set_blocked (self->sink_proxypad, TRUE,
gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
}
......@@ -283,7 +278,7 @@ gst_play_sink_audio_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
if (self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
reconfigure = TRUE;
gst_pad_set_blocked (self->sink_proxypad, TRUE,
gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
}
......@@ -359,10 +354,8 @@ gst_play_sink_audio_convert_change_state (GstElement * element,
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
if (gst_pad_is_blocked (self->sink_proxypad))
gst_pad_set_blocked (self->sink_proxypad, FALSE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (self->sink_proxypad);
self->sink_proxypad_blocked = FALSE;
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
break;
default:
......@@ -400,10 +393,8 @@ gst_play_sink_audio_convert_change_state (GstElement * element,
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
if (!gst_pad_is_blocked (self->sink_proxypad))
gst_pad_set_blocked (self->sink_proxypad, TRUE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (self->sink_proxypad);
self->sink_proxypad_blocked = FALSE;
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
default:
break;
......
......@@ -73,17 +73,15 @@ post_missing_element_message (GstPlaySinkVideoConvert * self,
}
static void
pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkVideoConvert * self)
pad_blocked_cb (GstPad * pad, GstBlockType type, GstPlaySinkVideoConvert * self)
{
GstPad *peer;
GstCaps *caps;
gboolean raw;
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
self->sink_proxypad_blocked = blocked;
GST_DEBUG_OBJECT (self, "Pad blocked: %d", blocked);
if (!blocked)
goto done;
self->sink_proxypad_blocked = TRUE;
GST_DEBUG_OBJECT (self, "Pad blocked");
/* There must be a peer at this point */
peer = gst_pad_get_peer (self->sinkpad);
......@@ -187,11 +185,9 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkVideoConvert * self)
}
unblock:
gst_pad_set_blocked (self->sink_proxypad, FALSE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (self->sink_proxypad);
self->sink_proxypad_blocked = FALSE;
done:
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
return;
......@@ -201,9 +197,8 @@ link_failed:
(NULL), ("Failed to configure the video converter."));
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad),
self->sink_proxypad);
gst_pad_set_blocked (self->sink_proxypad, FALSE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (self->sink_proxypad);
self->sink_proxypad_blocked = FALSE;
return;
}
}
......@@ -257,7 +252,7 @@ gst_play_sink_video_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
reconfigure = TRUE;
gst_pad_set_blocked (self->sink_proxypad, TRUE,
gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
}
......@@ -265,7 +260,7 @@ gst_play_sink_video_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
if (self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
reconfigure = TRUE;
gst_pad_set_blocked (self->sink_proxypad, TRUE,
gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
}
......@@ -338,10 +333,8 @@ gst_play_sink_video_convert_change_state (GstElement * element,
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
if (gst_pad_is_blocked (self->sink_proxypad))
gst_pad_set_blocked (self->sink_proxypad, FALSE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (self->sink_proxypad);
self->sink_proxypad_blocked = FALSE;
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
break;
default:
......@@ -374,7 +367,7 @@ gst_play_sink_video_convert_change_state (GstElement * element,
case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
if (!gst_pad_is_blocked (self->sink_proxypad))
gst_pad_set_blocked (self->sink_proxypad, TRUE,
gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
......
......@@ -82,7 +82,7 @@ enum
#define gst_subtitle_overlay_parent_class parent_class
G_DEFINE_TYPE (GstSubtitleOverlay, gst_subtitle_overlay, GST_TYPE_BIN);
static void _pad_blocked_cb (GstPad * pad, gboolean blocked,
static void _pad_blocked_cb (GstPad * pad, GstBlockType type,
gpointer user_data);
static GQuark _subtitle_overlay_event_marker_id = 0;
......@@ -590,14 +590,13 @@ _setup_passthrough (GstSubtitleOverlay * self)
out:
/* Unblock pads */
gst_pad_set_blocked (self->video_block_pad, FALSE,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (self->video_block_pad);
self->video_sink_blocked = FALSE;
if (self->subtitle_sink_blocked)
gst_pad_set_blocked (self->subtitle_block_pad, FALSE,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
if (self->subtitle_sink_blocked) {
gst_pad_unblock (self->subtitle_block_pad);
self->subtitle_sink_blocked = FALSE;
}
return TRUE;
}
......@@ -669,24 +668,19 @@ _has_font_desc_property (GstElement * element)
}
static void
_pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
_pad_blocked_cb (GstPad * pad, GstBlockType type, gpointer user_data)
{
GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY_CAST (user_data);
GstCaps *subcaps;
GList *l, *factories = NULL;
GST_DEBUG_OBJECT (pad, "Pad blocked: %d", blocked);
GST_DEBUG_OBJECT (pad, "Pad blocked");
GST_SUBTITLE_OVERLAY_LOCK (self);
if (pad == self->video_block_pad)
self->video_sink_blocked = blocked;
self->video_sink_blocked = TRUE;
else if (pad == self->subtitle_block_pad)
self->subtitle_sink_blocked = blocked;
if (!blocked) {
GST_SUBTITLE_OVERLAY_UNLOCK (self);
return;
}
self->subtitle_sink_blocked = TRUE;
/* Now either both or the video sink are blocked */
......@@ -739,14 +733,14 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
gst_object_unref (target);
/* Unblock pads */
gst_pad_set_blocked (self->video_block_pad, FALSE,
_pad_blocked_cb, gst_object_ref (self),