pad: Merge pad mode activation functions

Add the pad mode to the activate function so that we can reuse the same function
for all activation modes. This makes the core logic smaller and allows for some
elements to make their activation code easier. It would allow us to add more
scheduling modes later without having to add more activate functions.
This commit is contained in:
Wim Taymans 2011-11-21 13:29:05 +01:00
parent 9e3aa102d7
commit 2f1ed65339
15 changed files with 558 additions and 618 deletions

View file

@ -1000,11 +1000,9 @@ gst_ghost_pad_construct
gst_ghost_pad_unlink_default
gst_ghost_pad_link_default
gst_ghost_pad_activate_pull_default
gst_ghost_pad_activate_push_default
gst_ghost_pad_activate_mode_default
gst_ghost_pad_internal_activate_push_default
gst_ghost_pad_internal_activate_pull_default
gst_ghost_pad_internal_activate_mode_default
gst_proxy_pad_get_internal
@ -1642,8 +1640,7 @@ gst_pad_proxy_query_accept_caps
gst_pad_set_activate_function
GstPadActivateFunction
gst_pad_set_activatepush_function
gst_pad_set_activatepull_function
gst_pad_set_activatemode_function
GstPadActivateModeFunction
gst_pad_check_reconfigure
@ -1653,8 +1650,7 @@ gst_pad_push
gst_pad_push_event
gst_pad_push_list
gst_pad_pull_range
gst_pad_activate_pull
gst_pad_activate_push
gst_pad_activate_mode
gst_pad_send_event
gst_pad_event_default
@ -1728,7 +1724,7 @@ gst_pad_link_return_get_type
gst_pad_link_check_get_type
gst_pad_presence_get_type
gst_flow_return_get_type
gst_activate_mode_get_type
gst_pad_mode_get_type
gst_probe_return_get_type
gst_probe_type_get_type

View file

@ -458,61 +458,31 @@ G_DEFINE_TYPE (GstGhostPad, gst_ghost_pad, GST_TYPE_PROXY_PAD);
static void gst_ghost_pad_dispose (GObject * object);
/**
* gst_ghost_pad_internal_activate_push_default:
* @pad: the #GstPad to activate or deactivate.
* @parent: the parent of @pad or NULL
* @active: whether the pad should be active or not.
*
* Invoke the default activate push function of a proxy pad that is
* owned by a ghost pad.
*
* Returns: %TRUE if the operation was successful.
*
* Since: 0.10.36
*/
gboolean
static gboolean
gst_ghost_pad_internal_activate_push_default (GstPad * pad, GstObject * parent,
gboolean active)
{
gboolean ret;
GstPad *other;
g_return_val_if_fail (GST_IS_PROXY_PAD (pad), FALSE);
GST_LOG_OBJECT (pad, "%sactivate push on %s:%s, we're ok",
(active ? "" : "de"), GST_DEBUG_PAD_NAME (pad));
/* in both cases (SRC and SINK) we activate just the internal pad. The targets
* will be activated later (or already in case of a ghost sinkpad). */
other = GST_PROXY_PAD_INTERNAL (pad);
ret = gst_pad_activate_push (other, active);
ret = gst_pad_activate_mode (other, GST_PAD_MODE_PUSH, active);
return ret;
}
/**
* gst_ghost_pad_internal_activate_pull_default:
* @pad: the #GstPad to activate or deactivate.
* @parent: the parent of @pad or NULL
* @active: whether the pad should be active or not.
*
* Invoke the default activate pull function of a proxy pad that is
* owned by a ghost pad.
*
* Returns: %TRUE if the operation was successful.
*
* Since: 0.10.36
*/
gboolean
static gboolean
gst_ghost_pad_internal_activate_pull_default (GstPad * pad, GstObject * parent,
gboolean active)
{
gboolean ret;
GstPad *other;
g_return_val_if_fail (GST_IS_PROXY_PAD (pad), FALSE);
GST_LOG_OBJECT (pad, "%sactivate pull on %s:%s", (active ? "" : "de"),
GST_DEBUG_PAD_NAME (pad));
@ -524,12 +494,12 @@ gst_ghost_pad_internal_activate_pull_default (GstPad * pad, GstObject * parent,
* further upstream */
GST_LOG_OBJECT (pad, "pad is src, activate internal");
other = GST_PROXY_PAD_INTERNAL (pad);
ret = gst_pad_activate_pull (other, active);
ret = gst_pad_activate_mode (other, GST_PAD_MODE_PULL, active);
} else if (G_LIKELY ((other = gst_pad_get_peer (pad)))) {
/* We are SINK, the ghostpad is SRC, we propagate the activation upstream
* since we hold a pointer to the upstream peer. */
GST_LOG_OBJECT (pad, "activating peer");
ret = gst_pad_activate_pull (other, active);
ret = gst_pad_activate_mode (other, GST_PAD_MODE_PULL, active);
gst_object_unref (other);
} else {
/* this is failure, we can't activate pull if there is no peer */
@ -541,18 +511,41 @@ gst_ghost_pad_internal_activate_pull_default (GstPad * pad, GstObject * parent,
}
/**
* gst_ghost_pad_activate_push_default:
* gst_ghost_pad_internal_activate_mode_default:
* @pad: the #GstPad to activate or deactivate.
* @parent: the parent of @pad or NULL
* @mode: the requested activation mode
* @active: whether the pad should be active or not.
*
* Invoke the default activate push function of a ghost pad.
* Invoke the default activate mode function of a proxy pad that is
* owned by a ghost pad.
*
* Returns: %TRUE if the operation was successful.
*
* Since: 0.10.36
*/
gboolean
gst_ghost_pad_internal_activate_mode_default (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean res;
g_return_val_if_fail (GST_IS_PROXY_PAD (pad), FALSE);
switch (mode) {
case GST_PAD_MODE_PULL:
res = gst_ghost_pad_internal_activate_pull_default (pad, parent, active);
break;
case GST_PAD_MODE_PUSH:
res = gst_ghost_pad_internal_activate_push_default (pad, parent, active);
break;
default:
GST_LOG_OBJECT (pad, "unknown activation mode %d");
res = FALSE;
break;
}
return res;
}
static gboolean
gst_ghost_pad_activate_push_default (GstPad * pad, GstObject * parent,
gboolean active)
{
@ -566,32 +559,18 @@ gst_ghost_pad_activate_push_default (GstPad * pad, GstObject * parent,
/* just activate the internal pad */
other = GST_PROXY_PAD_INTERNAL (pad);
ret = gst_pad_activate_push (other, active);
ret = gst_pad_activate_mode (other, GST_PAD_MODE_PUSH, active);
return ret;
}
/**
* gst_ghost_pad_activate_pull_default:
* @pad: the #GstPad to activate or deactivate.
* @parent: the parent of @pad or NULL
* @active: whether the pad should be active or not.
*
* Invoke the default activate pull function of a ghost pad.
*
* Returns: %TRUE if the operation was successful.
*
* Since: 0.10.36
*/
gboolean
static gboolean
gst_ghost_pad_activate_pull_default (GstPad * pad, GstObject * parent,
gboolean active)
{
gboolean ret;
GstPad *other;
g_return_val_if_fail (GST_IS_GHOST_PAD (pad), FALSE);
GST_LOG_OBJECT (pad, "%sactivate pull on %s:%s", (active ? "" : "de"),
GST_DEBUG_PAD_NAME (pad));
@ -601,12 +580,12 @@ gst_ghost_pad_activate_pull_default (GstPad * pad, GstObject * parent,
* upstream */
GST_LOG_OBJECT (pad, "pad is src, activate internal");
other = GST_PROXY_PAD_INTERNAL (pad);
ret = gst_pad_activate_pull (other, active);
ret = gst_pad_activate_mode (other, GST_PAD_MODE_PULL, active);
} else if (G_LIKELY ((other = gst_pad_get_peer (pad)))) {
/* We are SINK and activated by the internal pad, propagate activation
* upstream because we hold a ref to the upstream peer */
GST_LOG_OBJECT (pad, "activating peer");
ret = gst_pad_activate_pull (other, active);
ret = gst_pad_activate_mode (other, GST_PAD_MODE_PULL, active);
gst_object_unref (other);
} else {
/* no peer, we fail */
@ -617,6 +596,40 @@ gst_ghost_pad_activate_pull_default (GstPad * pad, GstObject * parent,
return ret;
}
/**
* gst_ghost_pad_activate_mode_default:
* @pad: the #GstPad to activate or deactivate.
* @parent: the parent of @pad or NULL
* @mode: the requested activation mode
* @active: whether the pad should be active or not.
*
* Invoke the default activate mode function of a ghost pad.
*
* Returns: %TRUE if the operation was successful.
*/
gboolean
gst_ghost_pad_activate_mode_default (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean res;
g_return_val_if_fail (GST_IS_GHOST_PAD (pad), FALSE);
switch (mode) {
case GST_PAD_MODE_PULL:
res = gst_ghost_pad_activate_pull_default (pad, parent, active);
break;
case GST_PAD_MODE_PUSH:
res = gst_ghost_pad_activate_push_default (pad, parent, active);
break;
default:
GST_LOG_OBJECT (pad, "unknown activation mode %d");
res = FALSE;
break;
}
return res;
}
/**
* gst_ghost_pad_link_default:
* @pad: the #GstPad to link.
@ -687,10 +700,8 @@ gst_ghost_pad_init (GstGhostPad * pad)
GST_GHOST_PAD_PRIVATE (pad) = G_TYPE_INSTANCE_GET_PRIVATE (pad,
GST_TYPE_GHOST_PAD, GstGhostPadPrivate);
gst_pad_set_activatepull_function (GST_PAD_CAST (pad),
gst_ghost_pad_activate_pull_default);
gst_pad_set_activatepush_function (GST_PAD_CAST (pad),
gst_ghost_pad_activate_push_default);
gst_pad_set_activatemode_function (GST_PAD_CAST (pad),
gst_ghost_pad_activate_mode_default);
}
static void
@ -721,8 +732,7 @@ gst_ghost_pad_dispose (GObject * object)
GST_OBJECT_LOCK (pad);
internal = GST_PROXY_PAD_INTERNAL (pad);
gst_pad_set_activatepull_function (internal, NULL);
gst_pad_set_activatepush_function (internal, NULL);
gst_pad_set_activatemode_function (internal, NULL);
/* disposes of the internal pad, since the ghostpad is the only possible object
* that has a refcount on the internal pad. */
@ -821,10 +831,8 @@ gst_ghost_pad_construct (GstGhostPad * gpad)
GST_PROXY_PAD_INTERNAL (internal) = pad;
/* special activation functions for the internal pad */
gst_pad_set_activatepull_function (internal,
gst_ghost_pad_internal_activate_pull_default);
gst_pad_set_activatepush_function (internal,
gst_ghost_pad_internal_activate_push_default);
gst_pad_set_activatemode_function (internal,
gst_ghost_pad_internal_activate_mode_default);
GST_OBJECT_UNLOCK (pad);

View file

@ -125,13 +125,11 @@ gboolean gst_ghost_pad_construct (GstGhostPad *gpad);
void gst_ghost_pad_unlink_default (GstPad * pad);
GstPadLinkReturn gst_ghost_pad_link_default (GstPad * pad, GstPad * peer);
gboolean gst_ghost_pad_activate_pull_default (GstPad * pad, GstObject * parent, gboolean active);
gboolean gst_ghost_pad_activate_push_default (GstPad * pad, GstObject * parent, gboolean active);
gboolean gst_ghost_pad_activate_mode_default (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
gboolean gst_ghost_pad_internal_activate_push_default (GstPad * pad, GstObject * parent,
gboolean active);
gboolean gst_ghost_pad_internal_activate_pull_default (GstPad * pad, GstObject * parent,
gboolean active);
gboolean gst_ghost_pad_internal_activate_mode_default (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
G_END_DECLS

View file

@ -632,31 +632,30 @@ gst_pad_get_direction (GstPad * pad)
static gboolean
gst_pad_activate_default (GstPad * pad, GstObject * parent)
{
return gst_pad_activate_push (pad, TRUE);
return gst_pad_activate_mode (pad, GST_PAD_MODE_PUSH, TRUE);
}
static void
pre_activate (GstPad * pad, GstPadMode new_mode)
{
switch (new_mode) {
case GST_PAD_MODE_PUSH:
case GST_PAD_MODE_PULL:
GST_OBJECT_LOCK (pad);
GST_DEBUG_OBJECT (pad, "setting ACTIVATE_MODE %d, unset flushing",
new_mode);
GST_PAD_UNSET_FLUSHING (pad);
GST_PAD_MODE (pad) = new_mode;
GST_OBJECT_UNLOCK (pad);
break;
case GST_PAD_MODE_NONE:
GST_OBJECT_LOCK (pad);
GST_DEBUG_OBJECT (pad, "setting ACTIVATE_MODE NONE, set flushing");
GST_DEBUG_OBJECT (pad, "setting PAD_MODE NONE, set flushing");
GST_PAD_SET_FLUSHING (pad);
GST_PAD_MODE (pad) = new_mode;
/* unlock blocked pads so element can resume and stop */
GST_PAD_BLOCK_BROADCAST (pad);
GST_OBJECT_UNLOCK (pad);
break;
case GST_PAD_MODE_PUSH:
case GST_PAD_MODE_PULL:
GST_OBJECT_LOCK (pad);
GST_DEBUG_OBJECT (pad, "setting PAD_MODE %d, unset flushing", new_mode);
GST_PAD_UNSET_FLUSHING (pad);
GST_PAD_MODE (pad) = new_mode;
GST_OBJECT_UNLOCK (pad);
break;
}
}
@ -664,10 +663,6 @@ static void
post_activate (GstPad * pad, GstPadMode new_mode)
{
switch (new_mode) {
case GST_PAD_MODE_PUSH:
case GST_PAD_MODE_PULL:
/* nop */
break;
case GST_PAD_MODE_NONE:
/* ensures that streaming stops */
GST_PAD_STREAM_LOCK (pad);
@ -677,6 +672,10 @@ post_activate (GstPad * pad, GstPadMode new_mode)
GST_OBJECT_UNLOCK (pad);
GST_PAD_STREAM_UNLOCK (pad);
break;
case GST_PAD_MODE_PUSH:
case GST_PAD_MODE_PULL:
/* NOP */
break;
}
}
@ -715,46 +714,26 @@ gst_pad_set_active (GstPad * pad, gboolean active)
GST_OBJECT_UNLOCK (pad);
if (active) {
switch (old) {
case GST_PAD_MODE_PUSH:
GST_DEBUG_OBJECT (pad, "activating pad from push");
ret = TRUE;
break;
case GST_PAD_MODE_PULL:
GST_DEBUG_OBJECT (pad, "activating pad from pull");
ret = TRUE;
break;
case GST_PAD_MODE_NONE:
GST_DEBUG_OBJECT (pad, "activating pad from none");
ret = (GST_PAD_ACTIVATEFUNC (pad)) (pad, parent);
break;
default:
GST_DEBUG_OBJECT (pad, "unknown activation mode!");
break;
if (old == GST_PAD_MODE_NONE) {
GST_DEBUG_OBJECT (pad, "activating pad from none");
ret = (GST_PAD_ACTIVATEFUNC (pad)) (pad, parent);
} else {
GST_DEBUG_OBJECT (pad, "pad was active in mode %d", old);
ret = TRUE;
}
} else {
switch (old) {
case GST_PAD_MODE_PUSH:
GST_DEBUG_OBJECT (pad, "deactivating pad from push");
ret = gst_pad_activate_push (pad, FALSE);
break;
case GST_PAD_MODE_PULL:
GST_DEBUG_OBJECT (pad, "deactivating pad from pull");
ret = gst_pad_activate_pull (pad, FALSE);
break;
case GST_PAD_MODE_NONE:
GST_DEBUG_OBJECT (pad, "deactivating pad from none");
ret = TRUE;
break;
default:
GST_DEBUG_OBJECT (pad, "unknown activation mode!");
break;
if (old == GST_PAD_MODE_NONE) {
GST_DEBUG_OBJECT (pad, "pad was inactive");
ret = TRUE;
} else {
GST_DEBUG_OBJECT (pad, "deactivating pad from mode %d", old);
ret = gst_pad_activate_mode (pad, old, FALSE);
}
}
RELEASE_PARENT (parent);
if (!ret)
if (G_UNLIKELY (!ret))
goto failed;
if (!active) {
@ -786,15 +765,13 @@ failed:
}
/**
* gst_pad_activate_pull:
* gst_pad_activate_mode:
* @pad: the #GstPad to activate or deactivate.
* @mode: the requested activation mode
* @active: whether or not the pad should be active.
*
* Activates or deactivates the given pad in pull mode via dispatching to the
* pad's activatepullfunc. For use from within pad activation functions only.
* When called on sink pads, will first proxy the call to the peer pad, which
* is expected to activate its internally linked pads from within its
* activate_pull function.
* Activates or deactivates the given pad in @mode via dispatching to the
* pad's activatemodefunc. For use from within pad activation functions only.
*
* If you don't know what this is, you probably don't want to call it.
*
@ -803,82 +780,69 @@ failed:
* MT safe.
*/
gboolean
gst_pad_activate_pull (GstPad * pad, gboolean active)
gst_pad_activate_mode (GstPad * pad, GstPadMode mode, gboolean active)
{
gboolean res = FALSE;
GstObject *parent;
GstPadMode old, new;
GstPadDirection dir;
GstPad *peer;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
GST_OBJECT_LOCK (pad);
old = GST_PAD_MODE (pad);
dir = GST_PAD_DIRECTION (pad);
ACQUIRE_PARENT (pad, parent, no_parent);
GST_OBJECT_UNLOCK (pad);
if (active) {
switch (old) {
case GST_PAD_MODE_PULL:
GST_DEBUG_OBJECT (pad, "activating pad from pull, was ok");
goto was_ok;
case GST_PAD_MODE_PUSH:
GST_DEBUG_OBJECT (pad,
"activating pad from push, deactivate push first");
/* pad was activate in the wrong direction, deactivate it
* and reactivate it in pull mode */
if (G_UNLIKELY (!gst_pad_activate_push (pad, FALSE)))
goto deactivate_failed;
/* fallthrough, pad is deactivated now. */
case GST_PAD_MODE_NONE:
GST_DEBUG_OBJECT (pad, "activating pad from none");
break;
}
} else {
switch (old) {
case GST_PAD_MODE_NONE:
GST_DEBUG_OBJECT (pad, "deactivating pad from none, was ok");
goto was_ok;
case GST_PAD_MODE_PUSH:
GST_DEBUG_OBJECT (pad, "deactivating pad from push, weird");
/* pad was activated in the other direction, deactivate it
* in push mode, this should not happen... */
if (G_UNLIKELY (!gst_pad_activate_push (pad, FALSE)))
goto deactivate_failed;
/* everything is fine now */
goto was_ok;
case GST_PAD_MODE_PULL:
GST_DEBUG_OBJECT (pad, "deactivating pad from pull");
break;
}
new = active ? mode : GST_PAD_MODE_NONE;
if (old == new)
goto was_ok;
if (active && old != mode) {
/* pad was activate in the wrong direction, deactivate it
* and reactivate it in the requested mode */
GST_DEBUG_OBJECT (pad, "deactivating pad from mode %d", old);
if (G_UNLIKELY (!gst_pad_activate_mode (pad, old, FALSE)))
goto deactivate_failed;
}
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
if ((peer = gst_pad_get_peer (pad))) {
GST_DEBUG_OBJECT (pad, "calling peer");
if (G_UNLIKELY (!gst_pad_activate_pull (peer, active)))
goto peer_failed;
gst_object_unref (peer);
} else {
/* there is no peer, this is only fatal when we activate. When we
* deactivate, we must assume the application has unlinked the peer and
* will deactivate it eventually. */
if (active)
goto not_linked;
else
GST_DEBUG_OBJECT (pad, "deactivating unlinked pad");
}
} else {
if (G_UNLIKELY (GST_PAD_GETRANGEFUNC (pad) == NULL))
goto failure; /* Can't activate pull on a src without a
switch (mode) {
case GST_PAD_MODE_PULL:
{
if (dir == GST_PAD_SINK) {
if ((peer = gst_pad_get_peer (pad))) {
GST_DEBUG_OBJECT (pad, "calling peer");
if (G_UNLIKELY (!gst_pad_activate_mode (peer, mode, active)))
goto peer_failed;
gst_object_unref (peer);
} else {
/* there is no peer, this is only fatal when we activate. When we
* deactivate, we must assume the application has unlinked the peer and
* will deactivate it eventually. */
if (active)
goto not_linked;
else
GST_DEBUG_OBJECT (pad, "deactivating unlinked pad");
}
} else {
if (G_UNLIKELY (GST_PAD_GETRANGEFUNC (pad) == NULL))
goto failure; /* Can't activate pull on a src without a
getrange function */
}
break;
}
default:
break;
}
new = active ? GST_PAD_MODE_PULL : GST_PAD_MODE_NONE;
pre_activate (pad, new);
if (GST_PAD_ACTIVATEPULLFUNC (pad)) {
if (G_UNLIKELY (!GST_PAD_ACTIVATEPULLFUNC (pad) (pad, parent, active)))
if (GST_PAD_ACTIVATEMODEFUNC (pad)) {
if (G_UNLIKELY (!GST_PAD_ACTIVATEMODEFUNC (pad) (pad, parent, mode,
active)))
goto failure;
} else {
/* can happen for sinks of passthrough elements */
@ -886,8 +850,8 @@ gst_pad_activate_pull (GstPad * pad, gboolean active)
post_activate (pad, new);
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "%s in pull mode",
active ? "activated" : "deactivated");
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "%s in mode %d",
active ? "activated" : "deactivated", mode);
exit_success:
res = TRUE;
@ -904,22 +868,22 @@ no_parent:
}
was_ok:
{
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "already %s in pull mode",
active ? "activated" : "deactivated");
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "already %s in mode %d",
active ? "activated" : "deactivated", mode);
goto exit_success;
}
deactivate_failed:
{
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"failed to %s in switch to pull from mode %d",
(active ? "activate" : "deactivate"), old);
"failed to %s in switch to mode %d from mode %d",
(active ? "activate" : "deactivate"), mode, old);
goto exit;
}
peer_failed:
{
GST_OBJECT_LOCK (peer);
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"activate_pull on peer (%s:%s) failed", GST_DEBUG_PAD_NAME (peer));
"activate_mode on peer (%s:%s) failed", GST_DEBUG_PAD_NAME (peer));
GST_OBJECT_UNLOCK (peer);
gst_object_unref (peer);
goto exit;
@ -933,128 +897,8 @@ not_linked:
failure:
{
GST_OBJECT_LOCK (pad);
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in pull mode",
active ? "activate" : "deactivate");
GST_PAD_SET_FLUSHING (pad);
GST_PAD_MODE (pad) = old;
GST_OBJECT_UNLOCK (pad);
goto exit;
}
}
/**
* gst_pad_activate_push:
* @pad: the #GstPad to activate or deactivate.
* @active: whether the pad should be active or not.
*
* Activates or deactivates the given pad in push mode via dispatching to the
* pad's activatepushfunc. For use from within pad activation functions only.
*
* If you don't know what this is, you probably don't want to call it.
*
* Returns: %TRUE if the operation was successful.
*
* MT safe.
*/
gboolean
gst_pad_activate_push (GstPad * pad, gboolean active)
{
gboolean res = FALSE;
GstObject *parent;
GstPadMode old, new;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "trying to set %s in push mode",
active ? "activated" : "deactivated");
GST_OBJECT_LOCK (pad);
old = GST_PAD_MODE (pad);
ACQUIRE_PARENT (pad, parent, no_parent);
GST_OBJECT_UNLOCK (pad);
if (active) {
switch (old) {
case GST_PAD_MODE_PUSH:
GST_DEBUG_OBJECT (pad, "activating pad from push, was ok");
goto was_ok;
case GST_PAD_MODE_PULL:
GST_DEBUG_OBJECT (pad,
"activating pad from push, deactivating pull first");
/* pad was activate in the wrong direction, deactivate it
* an reactivate it in push mode */
if (G_UNLIKELY (!gst_pad_activate_pull (pad, FALSE)))
goto deactivate_failed;
/* fallthrough, pad is deactivated now. */
case GST_PAD_MODE_NONE:
GST_DEBUG_OBJECT (pad, "activating pad from none");
break;
}
} else {
switch (old) {
case GST_PAD_MODE_NONE:
GST_DEBUG_OBJECT (pad, "deactivating pad from none, was ok");
goto was_ok;
case GST_PAD_MODE_PULL:
GST_DEBUG_OBJECT (pad, "deactivating pad from pull, weird");
/* pad was activated in the other direction, deactivate it
* in pull mode, this should not happen... */
if (G_UNLIKELY (!gst_pad_activate_pull (pad, FALSE)))
goto deactivate_failed;
/* everything is fine now */
goto was_ok;
case GST_PAD_MODE_PUSH:
GST_DEBUG_OBJECT (pad, "deactivating pad from push");
break;
}
}
new = active ? GST_PAD_MODE_PUSH : GST_PAD_MODE_NONE;
pre_activate (pad, new);
if (GST_PAD_ACTIVATEPUSHFUNC (pad)) {
if (G_UNLIKELY (!GST_PAD_ACTIVATEPUSHFUNC (pad) (pad, parent, active))) {
goto failure;
}
} else {
/* quite ok, element relies on state change func to prepare itself */
}
post_activate (pad, new);
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "%s in push mode",
active ? "activated" : "deactivated");
exit_success:
res = TRUE;
exit:
RELEASE_PARENT (parent);
return res;
no_parent:
{
GST_DEBUG_OBJECT (pad, "no parent");
GST_OBJECT_UNLOCK (pad);
return FALSE;
}
was_ok:
{
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "already %s in push mode",
active ? "activated" : "deactivated");
goto exit_success;
}
deactivate_failed:
{
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"failed to %s in switch to push from mode %d",
(active ? "activate" : "deactivate"), old);
goto exit;
}
failure:
{
GST_OBJECT_LOCK (pad);
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in push mode",
active ? "activate" : "deactivate");
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in mode %d",
active ? "activate" : "deactivate", mode);
GST_PAD_SET_FLUSHING (pad);
GST_PAD_MODE (pad) = old;
GST_OBJECT_UNLOCK (pad);
@ -1357,42 +1201,22 @@ gst_pad_set_activate_function (GstPad * pad, GstPadActivateFunction activate)
}
/**
* gst_pad_set_activatepull_function:
* gst_pad_set_activatemode_function:
* @pad: a #GstPad.
* @activatepull: the #GstPadActivateModeFunction to set.
* @activatemode: the #GstPadActivateModeFunction to set.
*
* Sets the given activate_pull function for the pad. An activate_pull function
* prepares the element and any upstream connections for pulling. See XXX
* part-activation.txt for details.
* Sets the given activate_mode function for the pad. An activate_mode function
* prepares the element for data passing.
*/
void
gst_pad_set_activatepull_function (GstPad * pad,
GstPadActivateModeFunction activatepull)
gst_pad_set_activatemode_function (GstPad * pad,
GstPadActivateModeFunction activatemode)
{
g_return_if_fail (GST_IS_PAD (pad));
GST_PAD_ACTIVATEPULLFUNC (pad) = activatepull;
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "activatepullfunc set to %s",
GST_DEBUG_FUNCPTR_NAME (activatepull));
}
/**
* gst_pad_set_activatepush_function:
* @pad: a #GstPad.
* @activatepush: the #GstPadActivateModeFunction to set.
*
* Sets the given activate_push function for the pad. An activate_push function
* prepares the element for pushing. See XXX part-activation.txt for details.
*/
void
gst_pad_set_activatepush_function (GstPad * pad,
GstPadActivateModeFunction activatepush)
{
g_return_if_fail (GST_IS_PAD (pad));
GST_PAD_ACTIVATEPUSHFUNC (pad) = activatepush;
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "activatepushfunc set to %s",
GST_DEBUG_FUNCPTR_NAME (activatepush));
GST_PAD_ACTIVATEMODEFUNC (pad) = activatemode;
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "activatemodefunc set to %s",
GST_DEBUG_FUNCPTR_NAME (activatemode));
}
/**

View file

@ -245,6 +245,7 @@ typedef gboolean (*GstPadActivateFunction) (GstPad *pad, GstObject *parent);
* GstPadActivateModeFunction:
* @pad: a #GstPad
* @parent: the parent of @pad
* @mode: the requested activation mode of @pad
* @active: activate or deactivate the pad.
*
* The prototype of the push and pull activate functions.
@ -252,7 +253,7 @@ typedef gboolean (*GstPadActivateFunction) (GstPad *pad, GstObject *parent);
* Returns: TRUE if the pad could be activated or deactivated.
*/
typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, GstObject *parent,
gboolean active);
GstPadMode mode, gboolean active);
/* data passing */
@ -616,8 +617,7 @@ typedef enum {
* @probes: installed probes
* @mode: current activation mode of the pad
* @activatefunc: pad activation function
* @activatepushfunc: function to activate/deactivate pad in push mode
* @activatepullfunc: function to activate/deactivate pad in pull mode
* @activatemodefunc: function to activate/deactivate pad in the requested mode
* @peer: the pad this pad is linked to
* @linkfunc: function called when pad is linked
* @unlinkfunc: function called when pad is unlinked
@ -653,8 +653,7 @@ struct _GstPad {
GstPadMode mode;
GstPadActivateFunction activatefunc;
GstPadActivateModeFunction activatepushfunc;
GstPadActivateModeFunction activatepullfunc;
GstPadActivateModeFunction activatemodefunc;
/* pad link */
GstPad *peer;
@ -709,8 +708,7 @@ struct _GstPadClass {
#define GST_PAD_MODE(pad) (GST_PAD_CAST(pad)->mode)
#define GST_PAD_ACTIVATEFUNC(pad) (GST_PAD_CAST(pad)->activatefunc)
#define GST_PAD_ACTIVATEPUSHFUNC(pad) (GST_PAD_CAST(pad)->activatepushfunc)
#define GST_PAD_ACTIVATEPULLFUNC(pad) (GST_PAD_CAST(pad)->activatepullfunc)
#define GST_PAD_ACTIVATEMODEFUNC(pad) (GST_PAD_CAST(pad)->activatemodefunc)
#define GST_PAD_CHAINFUNC(pad) (GST_PAD_CAST(pad)->chainfunc)
#define GST_PAD_CHAINLISTFUNC(pad) (GST_PAD_CAST(pad)->chainlistfunc)
#define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc)
@ -814,8 +812,8 @@ GstPadDirection gst_pad_get_direction (GstPad *pad);
gboolean gst_pad_set_active (GstPad *pad, gboolean active);
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_activate_mode (GstPad *pad, GstPadMode mode,
gboolean active);
gulong gst_pad_add_probe (GstPad *pad,
GstPadProbeType mask,
@ -840,8 +838,7 @@ GstFlowReturn gst_pad_sticky_events_foreach (GstPad *pad, Gs
/* data passing setup functions */
void gst_pad_set_activate_function (GstPad *pad, GstPadActivateFunction activate);
void gst_pad_set_activatepull_function (GstPad *pad, GstPadActivateModeFunction activatepull);
void gst_pad_set_activatepush_function (GstPad *pad, GstPadActivateModeFunction activatepush);
void gst_pad_set_activatemode_function (GstPad *pad, GstPadActivateModeFunction activatemode);
void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain);
void gst_pad_set_chain_list_function (GstPad *pad, GstPadChainListFunction chainlist);
void gst_pad_set_getrange_function (GstPad *pad, GstPadGetRangeFunction get);

View file

@ -376,10 +376,8 @@ static GstIndex *gst_base_parse_get_index (GstElement * element);
static gboolean gst_base_parse_sink_activate (GstPad * sinkpad,
GstObject * parent);
static gboolean gst_base_parse_sink_activate_push (GstPad * pad,
GstObject * parent, gboolean active);
static gboolean gst_base_parse_sink_activate_pull (GstPad * pad,
GstObject * parent, gboolean active);
static gboolean gst_base_parse_sink_activate_mode (GstPad * pad,
GstObject * parent, GstPadMode mode, gboolean active);
static gboolean gst_base_parse_handle_seek (GstBaseParse * parse,
GstEvent * event);
static void gst_base_parse_handle_tag (GstBaseParse * parse, GstEvent * event);
@ -535,10 +533,8 @@ gst_base_parse_init (GstBaseParse * parse, GstBaseParseClass * bclass)
GST_DEBUG_FUNCPTR (gst_base_parse_chain));
gst_pad_set_activate_function (parse->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_parse_sink_activate));
gst_pad_set_activatepush_function (parse->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_parse_sink_activate_push));
gst_pad_set_activatepull_function (parse->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_parse_sink_activate_pull));
gst_pad_set_activatemode_function (parse->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_parse_sink_activate_mode));
gst_element_add_pad (GST_ELEMENT (parse), parse->sinkpad);
GST_DEBUG_OBJECT (parse, "sinkpad created");
@ -2957,10 +2953,10 @@ gst_base_parse_sink_activate (GstPad * sinkpad, GstObject * parent)
if (pull_mode) {
GST_DEBUG_OBJECT (parse, "trying to activate in pull mode");
result = gst_pad_activate_pull (sinkpad, TRUE);
result = gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, TRUE);
} else {
GST_DEBUG_OBJECT (parse, "trying to activate in push mode");
result = gst_pad_activate_push (sinkpad, TRUE);
result = gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE);
}
GST_DEBUG_OBJECT (parse, "sink activate return %d", result);
@ -3000,59 +2996,43 @@ gst_base_parse_activate (GstBaseParse * parse, gboolean active)
}
static gboolean
gst_base_parse_sink_activate_push (GstPad * pad, GstObject * parent,
gboolean active)
gst_base_parse_sink_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean result = TRUE;
GstBaseParse *parse;
parse = GST_BASE_PARSE (parent);
GST_DEBUG_OBJECT (parse, "sink activate push %d", active);
result = gst_base_parse_activate (parse, active);
if (result)
parse->priv->pad_mode = active ? GST_PAD_MODE_PUSH : GST_PAD_MODE_NONE;
GST_DEBUG_OBJECT (parse, "sink activate push return: %d", result);
return result;
}
static gboolean
gst_base_parse_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
gboolean active)
{
gboolean result = FALSE;
GstBaseParse *parse;
parse = GST_BASE_PARSE (parent);
GST_DEBUG_OBJECT (parse, "activate pull %d", active);
GST_DEBUG_OBJECT (parse, "sink activate mode %d, %d", mode, active);
result = gst_base_parse_activate (parse, active);
if (result) {
if (active) {
parse->priv->pending_segment = gst_event_new_segment (&parse->segment);
result &=
gst_pad_start_task (sinkpad, (GstTaskFunction) gst_base_parse_loop,
sinkpad);
} else {
result &= gst_pad_stop_task (sinkpad);
switch (mode) {
case GST_PAD_MODE_PULL:
if (active) {
parse->priv->pending_segment =
gst_event_new_segment (&parse->segment);
result &=
gst_pad_start_task (pad, (GstTaskFunction) gst_base_parse_loop,
pad);
} else {
result &= gst_pad_stop_task (pad);
}
break;
default:
break;
}
}
if (result)
parse->priv->pad_mode = active ? GST_PAD_MODE_PULL : GST_PAD_MODE_NONE;
parse->priv->pad_mode = active ? mode : GST_PAD_MODE_NONE;
GST_DEBUG_OBJECT (parse, "sink activate pull return: %d", result);
GST_DEBUG_OBJECT (parse, "sink activate return: %d", result);
return result;
}
/**
* gst_base_parse_set_duration:
* @parse: #GstBaseParse.

View file

@ -394,10 +394,8 @@ static GstFlowReturn gst_base_sink_chain_list (GstPad * pad, GstObject * parent,
static void gst_base_sink_loop (GstPad * pad);
static gboolean gst_base_sink_pad_activate (GstPad * pad, GstObject * parent);
static gboolean gst_base_sink_pad_activate_push (GstPad * pad,
GstObject * parent, gboolean active);
static gboolean gst_base_sink_pad_activate_pull (GstPad * pad,
GstObject * parent, gboolean active);
static gboolean gst_base_sink_pad_activate_mode (GstPad * pad,
GstObject * parent, GstPadMode mode, gboolean active);
static gboolean gst_base_sink_event (GstPad * pad, GstObject * parent,
GstEvent * event);
@ -559,8 +557,7 @@ gst_base_sink_class_init (GstBaseSinkClass * klass)
/* Registering debug symbols for function pointers */
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_fixate);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate_push);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate_pull);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate_mode);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_event);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_chain);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_chain_list);
@ -643,10 +640,8 @@ gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink");
gst_pad_set_activate_function (basesink->sinkpad, gst_base_sink_pad_activate);
gst_pad_set_activatepush_function (basesink->sinkpad,
gst_base_sink_pad_activate_push);
gst_pad_set_activatepull_function (basesink->sinkpad,
gst_base_sink_pad_activate_pull);
gst_pad_set_activatemode_function (basesink->sinkpad,
gst_base_sink_pad_activate_mode);
gst_pad_set_query_function (basesink->sinkpad, gst_base_sink_sink_query);
gst_pad_set_event_function (basesink->sinkpad, gst_base_sink_event);
gst_pad_set_chain_function (basesink->sinkpad, gst_base_sink_chain);
@ -4165,7 +4160,7 @@ gst_base_sink_pad_activate (GstPad * pad, GstObject * parent)
}
/* ok activate now */
if (!gst_pad_activate_pull (pad, TRUE)) {
if (!gst_pad_activate_mode (pad, GST_PAD_MODE_PULL, TRUE)) {
/* clear any pending caps */
GST_OBJECT_LOCK (basesink);
gst_caps_replace (&basesink->priv->pull_caps, NULL);
@ -4181,7 +4176,7 @@ gst_base_sink_pad_activate (GstPad * pad, GstObject * parent)
/* push mode fallback */
fallback:
GST_DEBUG_OBJECT (basesink, "Falling back to push mode");
if ((result = gst_pad_activate_push (pad, TRUE))) {
if ((result = gst_pad_activate_mode (pad, GST_PAD_MODE_PUSH, TRUE))) {
GST_DEBUG_OBJECT (basesink, "Success activating push mode");
}
@ -4359,6 +4354,27 @@ activate_failed:
}
}
static gboolean
gst_base_sink_pad_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean res;
switch (mode) {
case GST_PAD_MODE_PULL:
res = gst_base_sink_pad_activate_pull (pad, parent, active);
break;
case GST_PAD_MODE_PUSH:
res = gst_base_sink_pad_activate_push (pad, parent, active);
break;
default:
GST_LOG_OBJECT (pad, "unknown activation mode %d", mode);
res = FALSE;
break;
}
return res;
}
/* send an event to our sinkpad peer. */
static gboolean
gst_base_sink_send_event (GstElement * element, GstEvent * event)

View file

@ -284,10 +284,8 @@ static void gst_base_src_default_fixate (GstBaseSrc * src, GstCaps * caps);
static void gst_base_src_fixate (GstBaseSrc * src, GstCaps * caps);
static gboolean gst_base_src_is_random_access (GstBaseSrc * src);
static gboolean gst_base_src_activate_push (GstPad * pad, GstObject * parent,
gboolean active);
static gboolean gst_base_src_activate_pull (GstPad * pad, GstObject * parent,
gboolean active);
static gboolean gst_base_src_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
static void gst_base_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_base_src_get_property (GObject * object, guint prop_id,
@ -384,8 +382,7 @@ gst_base_src_class_init (GstBaseSrcClass * klass)
klass->alloc = GST_DEBUG_FUNCPTR (gst_base_src_default_alloc);
/* Registering debug symbols for function pointers */
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_activate_push);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_activate_pull);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_activate_mode);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_event);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_query);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_getrange);
@ -416,8 +413,7 @@ gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class)
pad = gst_pad_new_from_template (pad_template, "src");
GST_DEBUG_OBJECT (basesrc, "setting functions on src pad");
gst_pad_set_activatepush_function (pad, gst_base_src_activate_push);
gst_pad_set_activatepull_function (pad, gst_base_src_activate_pull);
gst_pad_set_activatemode_function (pad, gst_base_src_activate_mode);
gst_pad_set_event_function (pad, gst_base_src_event);
gst_pad_set_query_function (pad, gst_base_src_query);
gst_pad_set_getrange_function (pad, gst_base_src_getrange);
@ -3182,6 +3178,28 @@ error_stop:
}
}
static gboolean
gst_base_src_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean res;
switch (mode) {
case GST_PAD_MODE_PULL:
res = gst_base_src_activate_pull (pad, parent, active);
break;
case GST_PAD_MODE_PUSH:
res = gst_base_src_activate_push (pad, parent, active);
break;
default:
GST_LOG_OBJECT (pad, "unknown activation mode %d");
res = FALSE;
break;
}
return res;
}
static GstStateChangeReturn
gst_base_src_change_state (GstElement * element, GstStateChange transition)
{

View file

@ -298,10 +298,10 @@ static void gst_base_transform_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_base_transform_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_base_transform_src_activate_pull (GstPad * pad,
GstObject * parent, gboolean active);
static gboolean gst_base_transform_sink_activate_push (GstPad * pad,
GstObject * parent, gboolean active);
static gboolean gst_base_transform_src_activate_mode (GstPad * pad,
GstObject * parent, GstPadMode mode, gboolean active);
static gboolean gst_base_transform_sink_activate_mode (GstPad * pad,
GstObject * parent, GstPadMode mode, gboolean active);
static gboolean gst_base_transform_activate (GstBaseTransform * trans,
gboolean active);
static gboolean gst_base_transform_get_unit_size (GstBaseTransform * trans,
@ -418,8 +418,8 @@ gst_base_transform_init (GstBaseTransform * trans,
GST_DEBUG_FUNCPTR (gst_base_transform_sink_event));
gst_pad_set_chain_function (trans->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_transform_chain));
gst_pad_set_activatepush_function (trans->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_transform_sink_activate_push));
gst_pad_set_activatemode_function (trans->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_transform_sink_activate_mode));
gst_pad_set_query_function (trans->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_transform_query));
gst_element_add_pad (GST_ELEMENT (trans), trans->sinkpad);
@ -432,8 +432,8 @@ gst_base_transform_init (GstBaseTransform * trans,
GST_DEBUG_FUNCPTR (gst_base_transform_src_event));
gst_pad_set_getrange_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_getrange));
gst_pad_set_activatepull_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_src_activate_pull));
gst_pad_set_activatemode_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_src_activate_mode));
gst_pad_set_query_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_query));
gst_element_add_pad (GST_ELEMENT (trans), trans->srcpad);
@ -2152,38 +2152,57 @@ gst_base_transform_activate (GstBaseTransform * trans, gboolean active)
}
static gboolean
gst_base_transform_sink_activate_push (GstPad * pad, GstObject * parent,
gboolean active)
{
gboolean result = TRUE;
GstBaseTransform *trans;
trans = GST_BASE_TRANSFORM (parent);
result = gst_base_transform_activate (trans, active);
if (result)
trans->priv->pad_mode = active ? GST_PAD_MODE_PUSH : GST_PAD_MODE_NONE;
return result;
}
static gboolean
gst_base_transform_src_activate_pull (GstPad * pad, GstObject * parent,
gboolean active)
gst_base_transform_sink_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean result = FALSE;
GstBaseTransform *trans;
trans = GST_BASE_TRANSFORM (parent);
result = gst_pad_activate_pull (trans->sinkpad, active);
switch (mode) {
case GST_PAD_MODE_PUSH:
{
result = gst_base_transform_activate (trans, active);
if (result)
result &= gst_base_transform_activate (trans, active);
if (result)
trans->priv->pad_mode = active ? GST_PAD_MODE_PUSH : GST_PAD_MODE_NONE;
if (result)
trans->priv->pad_mode = active ? GST_PAD_MODE_PULL : GST_PAD_MODE_NONE;
break;
}
default:
result = TRUE;
break;
}
return result;
}
static gboolean
gst_base_transform_src_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean result = FALSE;
GstBaseTransform *trans;
trans = GST_BASE_TRANSFORM (parent);
switch (mode) {
case GST_PAD_MODE_PULL:
{
result =
gst_pad_activate_mode (trans->sinkpad, GST_PAD_MODE_PULL, active);
if (result)
result &= gst_base_transform_activate (trans, active);
if (result)
trans->priv->pad_mode = active ? mode : GST_PAD_MODE_NONE;
break;
}
default:
result = TRUE;
break;
}
return result;
}

View file

@ -1383,21 +1383,30 @@ was_eos:
}
static gboolean
gst_multi_queue_sink_activate_push (GstPad * pad, GstObject * parent,
gboolean active)
gst_multi_queue_sink_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean res;
GstSingleQueue *sq;
sq = (GstSingleQueue *) gst_pad_get_element_private (pad);
if (active) {
/* All pads start off linked until they push one buffer */
sq->srcresult = GST_FLOW_OK;
} else {
sq->srcresult = GST_FLOW_WRONG_STATE;
gst_data_queue_flush (sq->queue);
switch (mode) {
case GST_PAD_MODE_PUSH:
if (active) {
/* All pads start off linked until they push one buffer */
sq->srcresult = GST_FLOW_OK;
} else {
sq->srcresult = GST_FLOW_WRONG_STATE;
gst_data_queue_flush (sq->queue);
}
res = TRUE;
break;
default:
res = FALSE;
break;
}
return TRUE;
return res;
}
static gboolean
@ -1520,24 +1529,31 @@ gst_multi_queue_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
}
static gboolean
gst_multi_queue_src_activate_push (GstPad * pad, GstObject * parent,
gboolean active)
gst_multi_queue_src_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
GstMultiQueue *mq;
GstSingleQueue *sq;
gboolean result = FALSE;
gboolean result;
sq = (GstSingleQueue *) gst_pad_get_element_private (pad);
mq = sq->mqueue;
GST_DEBUG_OBJECT (mq, "SingleQueue %d", sq->id);
if (active) {
result = gst_single_queue_flush (mq, sq, FALSE);
} else {
result = gst_single_queue_flush (mq, sq, TRUE);
/* make sure streaming finishes */
result |= gst_pad_stop_task (pad);
switch (mode) {
case GST_PAD_MODE_PUSH:
if (active) {
result = gst_single_queue_flush (mq, sq, FALSE);
} else {
result = gst_single_queue_flush (mq, sq, TRUE);
/* make sure streaming finishes */
result |= gst_pad_stop_task (pad);
}
break;
default:
result = FALSE;
break;
}
return result;
}
@ -1899,8 +1915,8 @@ gst_single_queue_new (GstMultiQueue * mqueue, guint id)
gst_pad_set_chain_function (sq->sinkpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_chain));
gst_pad_set_activatepush_function (sq->sinkpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_sink_activate_push));
gst_pad_set_activatemode_function (sq->sinkpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_sink_activate_mode));
gst_pad_set_event_function (sq->sinkpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_sink_event));
gst_pad_set_query_function (sq->sinkpad,
@ -1913,8 +1929,8 @@ gst_single_queue_new (GstMultiQueue * mqueue, guint id)
sq->srcpad = gst_pad_new_from_static_template (&srctemplate, name);
g_free (name);
gst_pad_set_activatepush_function (sq->srcpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_src_activate_push));
gst_pad_set_activatemode_function (sq->srcpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_src_activate_mode));
gst_pad_set_event_function (sq->srcpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_src_event));
gst_pad_set_query_function (sq->srcpad,

View file

@ -211,10 +211,10 @@ static GstPadLinkReturn gst_queue_link_sink (GstPad * pad, GstPad * peer);
static GstPadLinkReturn gst_queue_link_src (GstPad * pad, GstPad * peer);
static void gst_queue_locked_flush (GstQueue * queue);
static gboolean gst_queue_src_activate_push (GstPad * pad, GstObject * parent,
gboolean active);
static gboolean gst_queue_sink_activate_push (GstPad * pad, GstObject * parent,
gboolean active);
static gboolean gst_queue_src_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
static gboolean gst_queue_sink_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
static gboolean gst_queue_is_empty (GstQueue * queue);
static gboolean gst_queue_is_filled (GstQueue * queue);
@ -373,8 +373,7 @@ gst_queue_class_init (GstQueueClass * klass)
gst_static_pad_template_get (&sinktemplate));
/* Registering debug symbols for function pointers */
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_src_activate_push);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_sink_activate_push);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_src_activate_mode);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_link_sink);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_link_src);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_handle_sink_event);
@ -390,8 +389,8 @@ gst_queue_init (GstQueue * queue)
queue->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
gst_pad_set_chain_function (queue->sinkpad, gst_queue_chain);
gst_pad_set_activatepush_function (queue->sinkpad,
gst_queue_sink_activate_push);
gst_pad_set_activatemode_function (queue->sinkpad,
gst_queue_sink_activate_mode);
gst_pad_set_event_function (queue->sinkpad, gst_queue_handle_sink_event);
gst_pad_set_query_function (queue->sinkpad, gst_queue_handle_sink_query);
gst_pad_set_link_function (queue->sinkpad, gst_queue_link_sink);
@ -399,8 +398,8 @@ gst_queue_init (GstQueue * queue)
queue->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");
gst_pad_set_activatepush_function (queue->srcpad,
gst_queue_src_activate_push);
gst_pad_set_activatemode_function (queue->srcpad,
gst_queue_src_activate_mode);
gst_pad_set_link_function (queue->srcpad, gst_queue_link_src);
gst_pad_set_event_function (queue->srcpad, gst_queue_handle_src_event);
gst_pad_set_query_function (queue->srcpad, gst_queue_handle_src_query);
@ -1283,63 +1282,79 @@ gst_queue_handle_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
}
static gboolean
gst_queue_sink_activate_push (GstPad * pad, GstObject * parent, gboolean active)
gst_queue_sink_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
gboolean active)
{
gboolean result = TRUE;
gboolean result;
GstQueue *queue;
queue = GST_QUEUE (parent);
if (active) {
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_OK;
queue->eos = FALSE;
queue->unexpected = FALSE;
GST_QUEUE_MUTEX_UNLOCK (queue);
} else {
/* step 1, unblock chain function */
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_WRONG_STATE;
gst_queue_locked_flush (queue);
GST_QUEUE_MUTEX_UNLOCK (queue);
switch (mode) {
case GST_PAD_MODE_PUSH:
if (active) {
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_OK;
queue->eos = FALSE;
queue->unexpected = FALSE;
GST_QUEUE_MUTEX_UNLOCK (queue);
} else {
/* step 1, unblock chain function */
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_WRONG_STATE;
gst_queue_locked_flush (queue);
GST_QUEUE_MUTEX_UNLOCK (queue);
}
result = TRUE;
break;
default:
result = FALSE;
break;
}
return result;
}
static gboolean
gst_queue_src_activate_push (GstPad * pad, GstObject * parent, gboolean active)
gst_queue_src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
gboolean active)
{
gboolean result = FALSE;
gboolean result;
GstQueue *queue;
queue = GST_QUEUE (parent);
if (active) {
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_OK;
queue->eos = FALSE;
queue->unexpected = FALSE;
/* we do not start the task yet if the pad is not connected */
if (gst_pad_is_linked (pad))
result = gst_pad_start_task (pad, (GstTaskFunction) gst_queue_loop, pad);
else {
GST_INFO_OBJECT (queue, "not starting task as pad is not linked");
result = TRUE;
}
GST_QUEUE_MUTEX_UNLOCK (queue);
} else {
/* step 1, unblock loop function */
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_WRONG_STATE;
/* the item add signal will unblock */
g_cond_signal (queue->item_add);
GST_QUEUE_MUTEX_UNLOCK (queue);
switch (mode) {
case GST_PAD_MODE_PUSH:
if (active) {
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_OK;
queue->eos = FALSE;
queue->unexpected = FALSE;
/* we do not start the task yet if the pad is not connected */
if (gst_pad_is_linked (pad))
result =
gst_pad_start_task (pad, (GstTaskFunction) gst_queue_loop, pad);
else {
GST_INFO_OBJECT (queue, "not starting task as pad is not linked");
result = TRUE;
}
GST_QUEUE_MUTEX_UNLOCK (queue);
} else {
/* step 1, unblock loop function */
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_WRONG_STATE;
/* the item add signal will unblock */
g_cond_signal (queue->item_add);
GST_QUEUE_MUTEX_UNLOCK (queue);
/* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad);
/* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad);
}
break;
default:
result = FALSE;
break;
}
return result;
}

View file

@ -243,12 +243,10 @@ static gboolean gst_queue2_handle_query (GstElement * element,
static GstFlowReturn gst_queue2_get_range (GstPad * pad, GstObject * parent,
guint64 offset, guint length, GstBuffer ** buffer);
static gboolean gst_queue2_src_activate_pull (GstPad * pad, GstObject * parent,
gboolean active);
static gboolean gst_queue2_src_activate_push (GstPad * pad, GstObject * parent,
gboolean active);
static gboolean gst_queue2_sink_activate_push (GstPad * pad, GstObject * parent,
gboolean active);
static gboolean gst_queue2_src_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
static gboolean gst_queue2_sink_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
static GstStateChangeReturn gst_queue2_change_state (GstElement * element,
GstStateChange transition);
@ -381,8 +379,8 @@ gst_queue2_init (GstQueue2 * queue)
gst_pad_set_chain_function (queue->sinkpad,
GST_DEBUG_FUNCPTR (gst_queue2_chain));
gst_pad_set_activatepush_function (queue->sinkpad,
GST_DEBUG_FUNCPTR (gst_queue2_sink_activate_push));
gst_pad_set_activatemode_function (queue->sinkpad,
GST_DEBUG_FUNCPTR (gst_queue2_sink_activate_mode));
gst_pad_set_event_function (queue->sinkpad,
GST_DEBUG_FUNCPTR (gst_queue2_handle_sink_event));
gst_pad_set_query_function (queue->sinkpad,
@ -392,10 +390,8 @@ gst_queue2_init (GstQueue2 * queue)
queue->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");
gst_pad_set_activatepull_function (queue->srcpad,
GST_DEBUG_FUNCPTR (gst_queue2_src_activate_pull));
gst_pad_set_activatepush_function (queue->srcpad,
GST_DEBUG_FUNCPTR (gst_queue2_src_activate_push));
gst_pad_set_activatemode_function (queue->srcpad,
GST_DEBUG_FUNCPTR (gst_queue2_src_activate_mode));
gst_pad_set_getrange_function (queue->srcpad,
GST_DEBUG_FUNCPTR (gst_queue2_get_range));
gst_pad_set_event_function (queue->srcpad,
@ -2668,33 +2664,40 @@ out_unexpected:
/* sink currently only operates in push mode */
static gboolean
gst_queue2_sink_activate_push (GstPad * pad, GstObject * parent,
gboolean active)
gst_queue2_sink_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean result = TRUE;
gboolean result;
GstQueue2 *queue;
queue = GST_QUEUE2 (parent);
if (active) {
GST_QUEUE2_MUTEX_LOCK (queue);
GST_DEBUG_OBJECT (queue, "activating push mode");
queue->srcresult = GST_FLOW_OK;
queue->sinkresult = GST_FLOW_OK;
queue->is_eos = FALSE;
queue->unexpected = FALSE;
reset_rate_timer (queue);
GST_QUEUE2_MUTEX_UNLOCK (queue);
} else {
/* unblock chain function */
GST_QUEUE2_MUTEX_LOCK (queue);
GST_DEBUG_OBJECT (queue, "deactivating push mode");
queue->srcresult = GST_FLOW_WRONG_STATE;
queue->sinkresult = GST_FLOW_WRONG_STATE;
gst_queue2_locked_flush (queue);
GST_QUEUE2_MUTEX_UNLOCK (queue);
switch (mode) {
case GST_PAD_MODE_PUSH:
if (active) {
GST_QUEUE2_MUTEX_LOCK (queue);
GST_DEBUG_OBJECT (queue, "activating push mode");
queue->srcresult = GST_FLOW_OK;
queue->sinkresult = GST_FLOW_OK;
queue->is_eos = FALSE;
queue->unexpected = FALSE;
reset_rate_timer (queue);
GST_QUEUE2_MUTEX_UNLOCK (queue);
} else {
/* unblock chain function */
GST_QUEUE2_MUTEX_LOCK (queue);
GST_DEBUG_OBJECT (queue, "deactivating push mode");
queue->srcresult = GST_FLOW_WRONG_STATE;
queue->sinkresult = GST_FLOW_WRONG_STATE;
gst_queue2_locked_flush (queue);
GST_QUEUE2_MUTEX_UNLOCK (queue);
}
result = TRUE;
break;
default:
result = FALSE;
break;
}
return result;
}
@ -2786,6 +2789,27 @@ gst_queue2_src_activate_pull (GstPad * pad, GstObject * parent, gboolean active)
return result;
}
static gboolean
gst_queue2_src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
gboolean active)
{
gboolean res;
switch (mode) {
case GST_PAD_MODE_PULL:
res = gst_queue2_src_activate_pull (pad, parent, active);
break;
case GST_PAD_MODE_PUSH:
res = gst_queue2_src_activate_push (pad, parent, active);
break;
default:
GST_LOG_OBJECT (pad, "unknown activation mode %d");
res = FALSE;
break;
}
return res;
}
static GstStateChangeReturn
gst_queue2_change_state (GstElement * element, GstStateChange transition)
{

View file

@ -144,12 +144,12 @@ static gboolean gst_tee_sink_event (GstPad * pad, GstObject * parent,
GstEvent * event);
static gboolean gst_tee_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_tee_sink_activate_push (GstPad * pad, GstObject * parent,
gboolean active);
static gboolean gst_tee_sink_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
static gboolean gst_tee_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_tee_src_activate_pull (GstPad * pad, GstObject * parent,
gboolean active);
static gboolean gst_tee_src_activate_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
static GstFlowReturn gst_tee_src_get_range (GstPad * pad, GstObject * parent,
guint64 offset, guint length, GstBuffer ** buf);
@ -258,8 +258,8 @@ gst_tee_init (GstTee * tee)
GST_DEBUG_FUNCPTR (gst_tee_sink_event));
gst_pad_set_query_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_tee_sink_query));
gst_pad_set_activatepush_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_tee_sink_activate_push));
gst_pad_set_activatemode_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_tee_sink_activate_mode));
gst_pad_set_chain_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_chain));
gst_pad_set_chain_list_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_tee_chain_list));
@ -327,7 +327,7 @@ gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ,
/* we already have a src pad in pull mode, and our pull mode can only be
SINGLE, so fall through to activate this new pad in push mode */
case GST_PAD_MODE_PUSH:
res = gst_pad_activate_push (srcpad, TRUE);
res = gst_pad_activate_mode (srcpad, GST_PAD_MODE_PUSH, TRUE);
break;
default:
res = TRUE;
@ -337,8 +337,8 @@ gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ,
if (!res)
goto activate_failed;
gst_pad_set_activatepull_function (srcpad,
GST_DEBUG_FUNCPTR (gst_tee_src_activate_pull));
gst_pad_set_activatemode_function (srcpad,
GST_DEBUG_FUNCPTR (gst_tee_src_activate_mode));
gst_pad_set_query_function (srcpad, GST_DEBUG_FUNCPTR (gst_tee_src_query));
gst_pad_set_getrange_function (srcpad,
GST_DEBUG_FUNCPTR (gst_tee_src_get_range));
@ -727,20 +727,31 @@ gst_tee_chain_list (GstPad * pad, GstObject * parent, GstBufferList * list)
}
static gboolean
gst_tee_sink_activate_push (GstPad * pad, GstObject * parent, gboolean active)
gst_tee_sink_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
gboolean active)
{
gboolean res;
GstTee *tee;
tee = GST_TEE (parent);
GST_OBJECT_LOCK (tee);
tee->sink_mode = active && GST_PAD_MODE_PUSH;
switch (mode) {
case GST_PAD_MODE_PUSH:
{
GST_OBJECT_LOCK (tee);
tee->sink_mode = active ? mode : GST_PAD_MODE_NONE;
if (active && !tee->has_chain)
goto no_chain;
GST_OBJECT_UNLOCK (tee);
return TRUE;
if (active && !tee->has_chain)
goto no_chain;
GST_OBJECT_UNLOCK (tee);
res = TRUE;
break;
}
default:
res = FALSE;
break;
}
return res;
/* ERRORS */
no_chain:
@ -753,7 +764,8 @@ no_chain:
}
static gboolean
gst_tee_src_activate_pull (GstPad * pad, GstObject * parent, gboolean active)
gst_tee_src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
gboolean active)
{
GstTee *tee;
gboolean res;
@ -761,35 +773,43 @@ gst_tee_src_activate_pull (GstPad * pad, GstObject * parent, gboolean active)
tee = GST_TEE (parent);
GST_OBJECT_LOCK (tee);
switch (mode) {
case GST_PAD_MODE_PULL:
{
GST_OBJECT_LOCK (tee);
if (tee->pull_mode == GST_TEE_PULL_MODE_NEVER)
goto cannot_pull;
if (tee->pull_mode == GST_TEE_PULL_MODE_NEVER)
goto cannot_pull;
if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE && active && tee->pull_pad)
goto cannot_pull_multiple_srcs;
if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE && active && tee->pull_pad)
goto cannot_pull_multiple_srcs;
sinkpad = gst_object_ref (tee->sinkpad);
sinkpad = gst_object_ref (tee->sinkpad);
GST_OBJECT_UNLOCK (tee);
GST_OBJECT_UNLOCK (tee);
res = gst_pad_activate_pull (sinkpad, active);
gst_object_unref (sinkpad);
res = gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, active);
gst_object_unref (sinkpad);
if (!res)
goto sink_activate_failed;
if (!res)
goto sink_activate_failed;
GST_OBJECT_LOCK (tee);
if (active) {
if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE)
tee->pull_pad = pad;
} else {
if (pad == tee->pull_pad)
tee->pull_pad = NULL;
GST_OBJECT_LOCK (tee);
if (active) {
if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE)
tee->pull_pad = pad;
} else {
if (pad == tee->pull_pad)
tee->pull_pad = NULL;
}
tee->sink_mode = active & GST_PAD_MODE_PULL;
GST_OBJECT_UNLOCK (tee);
break;
}
default:
res = TRUE;
break;
}
tee->sink_mode = active & GST_PAD_MODE_PULL;
GST_OBJECT_UNLOCK (tee);
return res;
/* ERRORS */

View file

@ -159,8 +159,8 @@ gst_type_find_element_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_type_find_element_activate (GstPad * pad,
GstObject * parent);
static gboolean gst_type_find_element_activate_src_pull (GstPad * pad,
GstObject * parent, gboolean active);
static gboolean gst_type_find_element_activate_src_mode (GstPad * pad,
GstObject * parent, GstPadMode mode, gboolean active);
static GstFlowReturn
gst_type_find_element_chain_do_typefinding (GstTypeFindElement * typefind,
gboolean check_avail);
@ -271,8 +271,8 @@ gst_type_find_element_init (GstTypeFindElement * typefind)
typefind->src =
gst_pad_new_from_static_template (&type_find_element_src_template, "src");
gst_pad_set_activatepull_function (typefind->src,
GST_DEBUG_FUNCPTR (gst_type_find_element_activate_src_pull));
gst_pad_set_activatemode_function (typefind->src,
GST_DEBUG_FUNCPTR (gst_type_find_element_activate_src_mode));
gst_pad_set_getrange_function (typefind->src,
GST_DEBUG_FUNCPTR (gst_type_find_element_getrange));
gst_pad_set_event_function (typefind->src,
@ -872,14 +872,23 @@ gst_type_find_element_getrange (GstPad * srcpad, GstObject * parent,
}
static gboolean
gst_type_find_element_activate_src_pull (GstPad * pad, GstObject * parent,
gboolean active)
gst_type_find_element_activate_src_mode (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active)
{
gboolean res;
GstTypeFindElement *typefind;
typefind = GST_TYPE_FIND_ELEMENT (parent);
return gst_pad_activate_pull (typefind->sink, active);
switch (mode) {
case GST_PAD_MODE_PULL:
res = gst_pad_activate_mode (typefind->sink, mode, active);
break;
default:
res = TRUE;
break;
}
return res;
}
static gboolean
@ -929,7 +938,7 @@ gst_type_find_element_activate (GstPad * pad, GstObject * parent)
if (!pull_mode)
goto typefind_push;
if (!gst_pad_activate_pull (pad, TRUE))
if (!gst_pad_activate_mode (pad, GST_PAD_MODE_PULL, TRUE))
goto typefind_push;
/* 2 */
@ -946,7 +955,7 @@ gst_type_find_element_activate (GstPad * pad, GstObject * parent)
if (!gst_pad_query_duration (peer, GST_FORMAT_BYTES, &size)) {
GST_WARNING_OBJECT (typefind, "Could not query upstream length!");
gst_object_unref (peer);
gst_pad_activate_pull (pad, FALSE);
gst_pad_activate_mode (pad, GST_PAD_MODE_PULL, FALSE);
return FALSE;
}
@ -956,7 +965,7 @@ gst_type_find_element_activate (GstPad * pad, GstObject * parent)
GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND,
(_("Stream contains no data.")), ("Can't typefind empty stream"));
gst_object_unref (peer);
gst_pad_activate_pull (pad, FALSE);
gst_pad_activate_mode (pad, GST_PAD_MODE_PULL, FALSE);
return FALSE;
}
ext = gst_type_find_get_extension (typefind, pad);
@ -989,12 +998,12 @@ gst_type_find_element_activate (GstPad * pad, GstObject * parent)
/* 3 */
GST_DEBUG ("Deactivate pull mode");
gst_pad_activate_pull (pad, FALSE);
gst_pad_activate_mode (pad, GST_PAD_MODE_PULL, FALSE);
#if 0
/* 4 */
GST_DEBUG ("Deactivate push mode mode");
gst_pad_activate_push (typefind->src, FALSE);
gst_pad_activate_mode (typefind->src, GST_PAD_MODE_PUSH, FALSE);
#endif
/* 5 */
@ -1027,14 +1036,14 @@ really_done:
gboolean ret;
GST_DEBUG ("Activating in push mode");
ret = gst_pad_activate_push (typefind->src, TRUE);
ret &= gst_pad_activate_push (pad, TRUE);
ret = gst_pad_activate_mode (typefind->src, GST_PAD_MODE_PUSH, TRUE);
ret &= gst_pad_activate_mode (pad, GST_PAD_MODE_PUSH, TRUE);
return ret;
}
typefind_push:
{
start_typefinding (typefind);
return gst_pad_activate_push (pad, TRUE);
return gst_pad_activate_mode (pad, GST_PAD_MODE_PUSH, TRUE);
}
}

View file

@ -186,7 +186,7 @@ GST_START_TEST (test_pull)
fail_unless (pad != NULL);
/* activate the pad in pull mode */
res = gst_pad_activate_pull (pad, TRUE);
res = gst_pad_activate_mode (pad, GST_PAD_MODE_PULL, TRUE);
fail_unless (res == TRUE);
/* not start playing */