playbin: fixed for new pad block API

This commit is contained in:
Wim Taymans 2011-05-30 18:36:14 +02:00
parent 29c3e31ff5
commit c7428aeaae
7 changed files with 128 additions and 207 deletions

View file

@ -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);
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,
(GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
(GDestroyNotify) gst_object_unref);
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);

View file

@ -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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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;

View file

@ -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);

View file

@ -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),
(GDestroyNotify) gst_object_unref);
gst_pad_unblock (self->video_block_pad);
self->video_sink_blocked = FALSE;
if (self->subtitle_sink_blocked) {
gst_pad_unblock (self->subtitle_block_pad);
self->subtitle_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);
goto out;
} else if (target) {
gst_object_unref (target);
@ -755,7 +749,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
if (self->subtitle_sink_blocked && !self->video_sink_blocked) {
GST_DEBUG_OBJECT (self, "Subtitle sink blocked but video not blocked");
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
goto out;
@ -1204,12 +1198,10 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
do_async_done (self);
} else {
GST_DEBUG_OBJECT (self, "Everything worked, unblocking pads");
gst_pad_set_blocked (self->video_block_pad, FALSE,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_set_blocked (self->subtitle_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;
gst_pad_unblock (self->subtitle_block_pad);
self->subtitle_sink_blocked = FALSE;
do_async_done (self);
}
@ -1238,10 +1230,10 @@ gst_subtitle_overlay_change_state (GstElement * element,
GST_SUBTITLE_OVERLAY_LOCK (self);
/* Set the internal pads to blocking */
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_set_blocked (self->subtitle_block_pad, TRUE,
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
@ -1309,14 +1301,14 @@ gst_subtitle_overlay_change_state (GstElement * element,
/* Unblock pads */
if (self->video_block_pad) {
pad = self->video_block_pad;
gst_pad_set_blocked (pad, FALSE, _pad_blocked_cb,
gst_object_ref (self), (GDestroyNotify) gst_object_unref);
gst_pad_unblock (pad);
self->video_sink_blocked = FALSE;
}
if (self->subtitle_block_pad) {
pad = self->subtitle_block_pad;
gst_pad_set_blocked (pad, FALSE, _pad_blocked_cb,
gst_object_ref (self), (GDestroyNotify) gst_object_unref);
gst_pad_unblock (pad);
self->subtitle_sink_blocked = FALSE;
}
/* Remove elements */
@ -1375,11 +1367,11 @@ gst_subtitle_overlay_handle_message (GstBin * bin, GstMessage * message)
GST_SUBTITLE_OVERLAY_LOCK (self);
self->subtitle_error = TRUE;
gst_pad_set_blocked (self->subtitle_block_pad, TRUE,
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
@ -1436,11 +1428,11 @@ gst_subtitle_overlay_set_property (GObject * object, guint prop_id,
else if (self->renderer)
g_object_set (self->renderer, self->silent_property, silent, NULL);
} else {
gst_pad_set_blocked (self->subtitle_block_pad, TRUE,
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
}
@ -1673,11 +1665,11 @@ gst_subtitle_overlay_video_sink_chain (GstPad * pad, GstBuffer * buffer)
gst_flow_get_name (ret));
GST_SUBTITLE_OVERLAY_LOCK (self);
self->subtitle_error = TRUE;
gst_pad_set_blocked (self->subtitle_block_pad, TRUE,
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
@ -1704,11 +1696,11 @@ gst_subtitle_overlay_subtitle_sink_chain (GstPad * pad, GstBuffer * buffer)
gst_flow_get_name (ret));
GST_SUBTITLE_OVERLAY_LOCK (self);
self->subtitle_error = TRUE;
gst_pad_set_blocked (self->subtitle_block_pad, TRUE,
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
@ -1781,11 +1773,11 @@ gst_subtitle_overlay_subtitle_sink_setcaps (GstPad * pad, GstCaps * caps)
self->subtitle_error = FALSE;
gst_pad_set_blocked (self->subtitle_block_pad, TRUE,
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
@ -1822,11 +1814,11 @@ gst_subtitle_overlay_subtitle_sink_link (GstPad * pad, GstPad * peer)
self->subtitle_error = FALSE;
gst_pad_set_blocked (self->subtitle_block_pad, TRUE,
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
@ -1858,12 +1850,12 @@ gst_subtitle_overlay_subtitle_sink_unlink (GstPad * pad)
self->subtitle_error = FALSE;
if (self->subtitle_block_pad)
gst_pad_set_blocked (self->subtitle_block_pad, TRUE,
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
if (self->video_block_pad)
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
@ -1884,11 +1876,11 @@ gst_subtitle_overlay_subtitle_sink_event (GstPad * pad, GstEvent * event)
self->subtitle_flush = TRUE;
self->subtitle_error = FALSE;
if (self->subtitle_block_pad)
gst_pad_set_blocked (self->subtitle_block_pad, TRUE,
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
if (self->video_block_pad)
gst_pad_set_blocked (self->video_block_pad, TRUE,
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
_pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
GST_SUBTITLE_OVERLAY_UNLOCK (self);