mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 21:35:44 +00:00
pad: add parent to activate functions
This commit is contained in:
parent
12d5f03453
commit
39a5e26ea9
13 changed files with 189 additions and 122 deletions
|
@ -461,6 +461,7 @@ 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
|
||||
|
@ -471,7 +472,8 @@ static void gst_ghost_pad_dispose (GObject * object);
|
|||
* Since: 0.10.36
|
||||
*/
|
||||
gboolean
|
||||
gst_ghost_pad_internal_activate_push_default (GstPad * pad, gboolean active)
|
||||
gst_ghost_pad_internal_activate_push_default (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean ret;
|
||||
GstPad *other;
|
||||
|
@ -492,6 +494,7 @@ gst_ghost_pad_internal_activate_push_default (GstPad * pad, gboolean active)
|
|||
/**
|
||||
* 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
|
||||
|
@ -502,7 +505,8 @@ gst_ghost_pad_internal_activate_push_default (GstPad * pad, gboolean active)
|
|||
* Since: 0.10.36
|
||||
*/
|
||||
gboolean
|
||||
gst_ghost_pad_internal_activate_pull_default (GstPad * pad, gboolean active)
|
||||
gst_ghost_pad_internal_activate_pull_default (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean ret;
|
||||
GstPad *other;
|
||||
|
@ -539,6 +543,7 @@ gst_ghost_pad_internal_activate_pull_default (GstPad * pad, gboolean active)
|
|||
/**
|
||||
* gst_ghost_pad_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 ghost pad.
|
||||
|
@ -548,7 +553,8 @@ gst_ghost_pad_internal_activate_pull_default (GstPad * pad, gboolean active)
|
|||
* Since: 0.10.36
|
||||
*/
|
||||
gboolean
|
||||
gst_ghost_pad_activate_push_default (GstPad * pad, gboolean active)
|
||||
gst_ghost_pad_activate_push_default (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean ret;
|
||||
GstPad *other;
|
||||
|
@ -568,6 +574,7 @@ gst_ghost_pad_activate_push_default (GstPad * pad, gboolean active)
|
|||
/**
|
||||
* 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.
|
||||
|
@ -577,7 +584,8 @@ gst_ghost_pad_activate_push_default (GstPad * pad, gboolean active)
|
|||
* Since: 0.10.36
|
||||
*/
|
||||
gboolean
|
||||
gst_ghost_pad_activate_pull_default (GstPad * pad, gboolean active)
|
||||
gst_ghost_pad_activate_pull_default (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean ret;
|
||||
GstPad *other;
|
||||
|
|
|
@ -124,11 +124,14 @@ 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, gboolean active);
|
||||
gboolean gst_ghost_pad_activate_push_default (GstPad * pad, gboolean active);
|
||||
|
||||
gboolean gst_ghost_pad_internal_activate_push_default (GstPad * pad, gboolean active);
|
||||
gboolean gst_ghost_pad_internal_activate_pull_default (GstPad * pad, gboolean active);
|
||||
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_internal_activate_push_default (GstPad * pad, GstObject * parent,
|
||||
gboolean active);
|
||||
gboolean gst_ghost_pad_internal_activate_pull_default (GstPad * pad, GstObject * parent,
|
||||
gboolean active);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
120
gst/gstpad.c
120
gst/gstpad.c
|
@ -140,7 +140,7 @@ static void gst_pad_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static void gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ);
|
||||
static gboolean gst_pad_activate_default (GstPad * pad);
|
||||
static gboolean gst_pad_activate_default (GstPad * pad, GstObject * parent);
|
||||
static GstFlowReturn gst_pad_chain_list_default (GstPad * pad,
|
||||
GstObject * parent, GstBufferList * list);
|
||||
|
||||
|
@ -589,6 +589,20 @@ gst_pad_new_from_static_template (GstStaticPadTemplate * templ,
|
|||
return pad;
|
||||
}
|
||||
|
||||
#define ACQUIRE_PARENT(pad, parent, label) \
|
||||
G_STMT_START { \
|
||||
if (G_LIKELY ((parent = GST_OBJECT_PARENT (pad)))) \
|
||||
gst_object_ref (parent); \
|
||||
else if (G_LIKELY (GST_PAD_NEEDS_PARENT (pad))) \
|
||||
goto label; \
|
||||
} G_STMT_END
|
||||
|
||||
#define RELEASE_PARENT(parent) \
|
||||
G_STMT_START { \
|
||||
if (G_LIKELY (parent)) \
|
||||
gst_object_unref (parent); \
|
||||
} G_STMT_END
|
||||
|
||||
/**
|
||||
* gst_pad_get_direction:
|
||||
* @pad: a #GstPad to get the direction of.
|
||||
|
@ -616,7 +630,7 @@ gst_pad_get_direction (GstPad * pad)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_pad_activate_default (GstPad * pad)
|
||||
gst_pad_activate_default (GstPad * pad, GstObject * parent)
|
||||
{
|
||||
return gst_pad_activate_push (pad, TRUE);
|
||||
}
|
||||
|
@ -689,6 +703,7 @@ post_activate (GstPad * pad, GstPadMode new_mode)
|
|||
gboolean
|
||||
gst_pad_set_active (GstPad * pad, gboolean active)
|
||||
{
|
||||
GstObject *parent;
|
||||
GstPadMode old;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
|
@ -696,6 +711,7 @@ gst_pad_set_active (GstPad * pad, gboolean active)
|
|||
|
||||
GST_OBJECT_LOCK (pad);
|
||||
old = GST_PAD_MODE (pad);
|
||||
ACQUIRE_PARENT (pad, parent, no_parent);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
|
||||
if (active) {
|
||||
|
@ -710,7 +726,7 @@ gst_pad_set_active (GstPad * pad, gboolean active)
|
|||
break;
|
||||
case GST_PAD_MODE_NONE:
|
||||
GST_DEBUG_OBJECT (pad, "activating pad from none");
|
||||
ret = (GST_PAD_ACTIVATEFUNC (pad)) (pad);
|
||||
ret = (GST_PAD_ACTIVATEFUNC (pad)) (pad, parent);
|
||||
break;
|
||||
default:
|
||||
GST_DEBUG_OBJECT (pad, "unknown activation mode!");
|
||||
|
@ -736,7 +752,27 @@ gst_pad_set_active (GstPad * pad, gboolean active)
|
|||
}
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
RELEASE_PARENT (parent);
|
||||
|
||||
if (!ret)
|
||||
goto failed;
|
||||
|
||||
if (!active) {
|
||||
GST_OBJECT_LOCK (pad);
|
||||
GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_NEED_RECONFIGURE);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
}
|
||||
return ret;
|
||||
|
||||
/* ERRORS */
|
||||
no_parent:
|
||||
{
|
||||
GST_DEBUG_OBJECT (pad, "no parent");
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
return FALSE;
|
||||
}
|
||||
failed:
|
||||
{
|
||||
GST_OBJECT_LOCK (pad);
|
||||
if (!active) {
|
||||
g_critical ("Failed to deactivate pad %s:%s, very bad",
|
||||
|
@ -745,15 +781,8 @@ gst_pad_set_active (GstPad * pad, gboolean active)
|
|||
GST_WARNING_OBJECT (pad, "Failed to activate pad");
|
||||
}
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
} else {
|
||||
if (!active) {
|
||||
GST_OBJECT_LOCK (pad);
|
||||
GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_NEED_RECONFIGURE);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -776,6 +805,8 @@ gst_pad_set_active (GstPad * pad, gboolean active)
|
|||
gboolean
|
||||
gst_pad_activate_pull (GstPad * pad, gboolean active)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
GstObject *parent;
|
||||
GstPadMode old, new;
|
||||
GstPad *peer;
|
||||
|
||||
|
@ -783,6 +814,7 @@ gst_pad_activate_pull (GstPad * pad, gboolean active)
|
|||
|
||||
GST_OBJECT_LOCK (pad);
|
||||
old = GST_PAD_MODE (pad);
|
||||
ACQUIRE_PARENT (pad, parent, no_parent);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
|
||||
if (active) {
|
||||
|
@ -846,7 +878,7 @@ gst_pad_activate_pull (GstPad * pad, gboolean active)
|
|||
pre_activate (pad, new);
|
||||
|
||||
if (GST_PAD_ACTIVATEPULLFUNC (pad)) {
|
||||
if (G_UNLIKELY (!GST_PAD_ACTIVATEPULLFUNC (pad) (pad, active)))
|
||||
if (G_UNLIKELY (!GST_PAD_ACTIVATEPULLFUNC (pad) (pad, parent, active)))
|
||||
goto failure;
|
||||
} else {
|
||||
/* can happen for sinks of passthrough elements */
|
||||
|
@ -857,20 +889,31 @@ gst_pad_activate_pull (GstPad * pad, gboolean active)
|
|||
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "%s in pull mode",
|
||||
active ? "activated" : "deactivated");
|
||||
|
||||
return TRUE;
|
||||
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 pull mode",
|
||||
active ? "activated" : "deactivated");
|
||||
return TRUE;
|
||||
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);
|
||||
return FALSE;
|
||||
goto exit;
|
||||
}
|
||||
peer_failed:
|
||||
{
|
||||
|
@ -879,13 +922,13 @@ peer_failed:
|
|||
"activate_pull on peer (%s:%s) failed", GST_DEBUG_PAD_NAME (peer));
|
||||
GST_OBJECT_UNLOCK (peer);
|
||||
gst_object_unref (peer);
|
||||
return FALSE;
|
||||
goto exit;
|
||||
}
|
||||
not_linked:
|
||||
{
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "can't activate unlinked sink "
|
||||
"pad in pull mode");
|
||||
return FALSE;
|
||||
goto exit;
|
||||
}
|
||||
failure:
|
||||
{
|
||||
|
@ -895,7 +938,7 @@ failure:
|
|||
GST_PAD_SET_FLUSHING (pad);
|
||||
GST_PAD_MODE (pad) = old;
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
return FALSE;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -916,6 +959,8 @@ failure:
|
|||
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);
|
||||
|
@ -924,6 +969,7 @@ gst_pad_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
GST_OBJECT_LOCK (pad);
|
||||
old = GST_PAD_MODE (pad);
|
||||
ACQUIRE_PARENT (pad, parent, no_parent);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
|
||||
if (active) {
|
||||
|
@ -966,7 +1012,7 @@ gst_pad_activate_push (GstPad * pad, gboolean active)
|
|||
pre_activate (pad, new);
|
||||
|
||||
if (GST_PAD_ACTIVATEPUSHFUNC (pad)) {
|
||||
if (G_UNLIKELY (!GST_PAD_ACTIVATEPUSHFUNC (pad) (pad, active))) {
|
||||
if (G_UNLIKELY (!GST_PAD_ACTIVATEPUSHFUNC (pad) (pad, parent, active))) {
|
||||
goto failure;
|
||||
}
|
||||
} else {
|
||||
|
@ -977,20 +1023,32 @@ gst_pad_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "%s in push mode",
|
||||
active ? "activated" : "deactivated");
|
||||
return TRUE;
|
||||
|
||||
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");
|
||||
return TRUE;
|
||||
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);
|
||||
return FALSE;
|
||||
goto exit;
|
||||
}
|
||||
failure:
|
||||
{
|
||||
|
@ -1000,7 +1058,7 @@ failure:
|
|||
GST_PAD_SET_FLUSHING (pad);
|
||||
GST_PAD_MODE (pad) = old;
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
return FALSE;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2191,20 +2249,6 @@ not_accepted:
|
|||
}
|
||||
}
|
||||
|
||||
#define ACQUIRE_PARENT(pad, parent, label) \
|
||||
G_STMT_START { \
|
||||
if (G_LIKELY ((parent = GST_OBJECT_PARENT (pad)))) \
|
||||
gst_object_ref (parent); \
|
||||
else if (G_LIKELY (GST_PAD_NEEDS_PARENT (pad))) \
|
||||
goto label; \
|
||||
} G_STMT_END
|
||||
|
||||
#define RELEASE_PARENT(parent) \
|
||||
G_STMT_START { \
|
||||
if (G_LIKELY (parent)) \
|
||||
gst_object_unref (parent); \
|
||||
} G_STMT_END
|
||||
|
||||
/* function to send all pending events on the sinkpad to the event
|
||||
* function and collect the results. This function should be called with
|
||||
* the object lock. The object lock might be released by this function.
|
||||
|
|
|
@ -239,7 +239,7 @@ typedef enum {
|
|||
*
|
||||
* Returns: TRUE if the pad could be activated.
|
||||
*/
|
||||
typedef gboolean (*GstPadActivateFunction) (GstPad *pad);
|
||||
typedef gboolean (*GstPadActivateFunction) (GstPad *pad, GstObject *parent);
|
||||
/**
|
||||
* GstPadActivateModeFunction:
|
||||
* @pad: a #GstPad
|
||||
|
@ -249,7 +249,8 @@ typedef gboolean (*GstPadActivateFunction) (GstPad *pad);
|
|||
*
|
||||
* Returns: TRUE if the pad could be activated or deactivated.
|
||||
*/
|
||||
typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, gboolean active);
|
||||
typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, GstObject *parent,
|
||||
gboolean active);
|
||||
|
||||
|
||||
/* data passing */
|
||||
|
|
|
@ -374,11 +374,12 @@ static void gst_base_parse_reset (GstBaseParse * parse);
|
|||
static void gst_base_parse_set_index (GstElement * element, GstIndex * index);
|
||||
static GstIndex *gst_base_parse_get_index (GstElement * element);
|
||||
|
||||
static gboolean gst_base_parse_sink_activate (GstPad * sinkpad);
|
||||
static gboolean gst_base_parse_sink_activate (GstPad * sinkpad,
|
||||
GstObject * parent);
|
||||
static gboolean gst_base_parse_sink_activate_push (GstPad * pad,
|
||||
gboolean active);
|
||||
GstObject * parent, gboolean active);
|
||||
static gboolean gst_base_parse_sink_activate_pull (GstPad * pad,
|
||||
gboolean active);
|
||||
GstObject * parent, gboolean active);
|
||||
static gboolean gst_base_parse_handle_seek (GstBaseParse * parse,
|
||||
GstEvent * event);
|
||||
static void gst_base_parse_handle_tag (GstBaseParse * parse, GstEvent * event);
|
||||
|
@ -2934,14 +2935,14 @@ pause:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_parse_sink_activate (GstPad * sinkpad)
|
||||
gst_base_parse_sink_activate (GstPad * sinkpad, GstObject * parent)
|
||||
{
|
||||
GstBaseParse *parse;
|
||||
gboolean result = TRUE;
|
||||
GstQuery *query;
|
||||
gboolean pull_mode;
|
||||
|
||||
parse = GST_BASE_PARSE (gst_pad_get_parent (sinkpad));
|
||||
parse = GST_BASE_PARSE (parent);
|
||||
|
||||
GST_DEBUG_OBJECT (parse, "sink activate");
|
||||
|
||||
|
@ -2964,7 +2965,6 @@ gst_base_parse_sink_activate (GstPad * sinkpad)
|
|||
}
|
||||
|
||||
GST_DEBUG_OBJECT (parse, "sink activate return %d", result);
|
||||
gst_object_unref (parse);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -3001,12 +3001,13 @@ gst_base_parse_activate (GstBaseParse * parse, gboolean active)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_parse_sink_activate_push (GstPad * pad, gboolean active)
|
||||
gst_base_parse_sink_activate_push (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean result = TRUE;
|
||||
GstBaseParse *parse;
|
||||
|
||||
parse = GST_BASE_PARSE (gst_pad_get_parent (pad));
|
||||
parse = GST_BASE_PARSE (parent);
|
||||
|
||||
GST_DEBUG_OBJECT (parse, "sink activate push %d", active);
|
||||
|
||||
|
@ -3017,17 +3018,17 @@ gst_base_parse_sink_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
GST_DEBUG_OBJECT (parse, "sink activate push return: %d", result);
|
||||
|
||||
gst_object_unref (parse);
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_parse_sink_activate_pull (GstPad * sinkpad, gboolean active)
|
||||
gst_base_parse_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
GstBaseParse *parse;
|
||||
|
||||
parse = GST_BASE_PARSE (gst_pad_get_parent (sinkpad));
|
||||
parse = GST_BASE_PARSE (parent);
|
||||
|
||||
GST_DEBUG_OBJECT (parse, "activate pull %d", active);
|
||||
|
||||
|
@ -3049,7 +3050,6 @@ gst_base_parse_sink_activate_pull (GstPad * sinkpad, gboolean active)
|
|||
|
||||
GST_DEBUG_OBJECT (parse, "sink activate pull return: %d", result);
|
||||
|
||||
gst_object_unref (parse);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -393,9 +393,11 @@ static GstFlowReturn gst_base_sink_chain_list (GstPad * pad, GstObject * parent,
|
|||
GstBufferList * list);
|
||||
|
||||
static void gst_base_sink_loop (GstPad * pad);
|
||||
static gboolean gst_base_sink_pad_activate (GstPad * pad);
|
||||
static gboolean gst_base_sink_pad_activate_push (GstPad * pad, gboolean active);
|
||||
static gboolean gst_base_sink_pad_activate_pull (GstPad * pad, gboolean active);
|
||||
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_event (GstPad * pad, GstObject * parent,
|
||||
GstEvent * event);
|
||||
|
||||
|
@ -2059,8 +2061,8 @@ gst_base_sink_wait_clock (GstBaseSink * sink, GstClockTime time,
|
|||
/* FIXME: Casting to GstClockEntry only works because the types
|
||||
* are the same */
|
||||
if (G_LIKELY (sink->priv->cached_clock_id != NULL
|
||||
&& GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->
|
||||
priv->cached_clock_id) == clock)) {
|
||||
&& GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->priv->
|
||||
cached_clock_id) == clock)) {
|
||||
if (!gst_clock_single_shot_id_reinit (clock, sink->priv->cached_clock_id,
|
||||
time)) {
|
||||
gst_clock_id_unref (sink->priv->cached_clock_id);
|
||||
|
@ -4113,14 +4115,14 @@ gst_base_sink_default_activate_pull (GstBaseSink * basesink, gboolean active)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_sink_pad_activate (GstPad * pad)
|
||||
gst_base_sink_pad_activate (GstPad * pad, GstObject * parent)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
GstBaseSink *basesink;
|
||||
GstQuery *query;
|
||||
gboolean pull_mode;
|
||||
|
||||
basesink = GST_BASE_SINK (gst_pad_get_parent (pad));
|
||||
basesink = GST_BASE_SINK (parent);
|
||||
|
||||
GST_DEBUG_OBJECT (basesink, "Trying pull mode first");
|
||||
|
||||
|
@ -4189,18 +4191,17 @@ done:
|
|||
gst_base_sink_set_flushing (basesink, pad, TRUE);
|
||||
}
|
||||
|
||||
gst_object_unref (basesink);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_sink_pad_activate_push (GstPad * pad, gboolean active)
|
||||
gst_base_sink_pad_activate_push (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean result;
|
||||
GstBaseSink *basesink;
|
||||
|
||||
basesink = GST_BASE_SINK (gst_pad_get_parent (pad));
|
||||
basesink = GST_BASE_SINK (parent);
|
||||
|
||||
if (active) {
|
||||
if (!basesink->can_activate_push) {
|
||||
|
@ -4221,8 +4222,6 @@ gst_base_sink_pad_activate_push (GstPad * pad, gboolean active)
|
|||
}
|
||||
}
|
||||
|
||||
gst_object_unref (basesink);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -4290,13 +4289,14 @@ could_not_set_caps:
|
|||
|
||||
/* this won't get called until we implement an activate function */
|
||||
static gboolean
|
||||
gst_base_sink_pad_activate_pull (GstPad * pad, gboolean active)
|
||||
gst_base_sink_pad_activate_pull (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
GstBaseSink *basesink;
|
||||
GstBaseSinkClass *bclass;
|
||||
|
||||
basesink = GST_BASE_SINK (gst_pad_get_parent (pad));
|
||||
basesink = GST_BASE_SINK (parent);
|
||||
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
||||
|
||||
if (active) {
|
||||
|
@ -4345,7 +4345,6 @@ gst_base_sink_pad_activate_pull (GstPad * pad, gboolean active)
|
|||
GST_OBJECT_UNLOCK (basesink);
|
||||
}
|
||||
}
|
||||
gst_object_unref (basesink);
|
||||
|
||||
return result;
|
||||
|
||||
|
|
|
@ -284,8 +284,10 @@ 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, gboolean active);
|
||||
static gboolean gst_base_src_activate_pull (GstPad * pad, gboolean active);
|
||||
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 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,
|
||||
|
@ -3051,12 +3053,12 @@ gst_base_src_set_playing (GstBaseSrc * basesrc, gboolean live_play)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_src_activate_push (GstPad * pad, gboolean active)
|
||||
gst_base_src_activate_push (GstPad * pad, GstObject * parent, gboolean active)
|
||||
{
|
||||
GstBaseSrc *basesrc;
|
||||
GstEvent *event;
|
||||
|
||||
basesrc = GST_BASE_SRC (GST_OBJECT_PARENT (pad));
|
||||
basesrc = GST_BASE_SRC (parent);
|
||||
|
||||
/* prepare subclass first */
|
||||
if (active) {
|
||||
|
@ -3129,11 +3131,11 @@ error_stop:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_src_activate_pull (GstPad * pad, gboolean active)
|
||||
gst_base_src_activate_pull (GstPad * pad, GstObject * parent, gboolean active)
|
||||
{
|
||||
GstBaseSrc *basesrc;
|
||||
|
||||
basesrc = GST_BASE_SRC (GST_OBJECT_PARENT (pad));
|
||||
basesrc = GST_BASE_SRC (parent);
|
||||
|
||||
/* prepare subclass first */
|
||||
if (active) {
|
||||
|
|
|
@ -299,9 +299,9 @@ static void gst_base_transform_set_property (GObject * object, guint prop_id,
|
|||
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,
|
||||
gboolean active);
|
||||
GstObject * parent, gboolean active);
|
||||
static gboolean gst_base_transform_sink_activate_push (GstPad * pad,
|
||||
gboolean active);
|
||||
GstObject * parent, gboolean active);
|
||||
static gboolean gst_base_transform_activate (GstBaseTransform * trans,
|
||||
gboolean active);
|
||||
static gboolean gst_base_transform_get_unit_size (GstBaseTransform * trans,
|
||||
|
@ -2152,30 +2152,30 @@ gst_base_transform_activate (GstBaseTransform * trans, gboolean active)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_transform_sink_activate_push (GstPad * pad, gboolean active)
|
||||
gst_base_transform_sink_activate_push (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean result = TRUE;
|
||||
GstBaseTransform *trans;
|
||||
|
||||
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
|
||||
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;
|
||||
|
||||
gst_object_unref (trans);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_transform_src_activate_pull (GstPad * pad, gboolean active)
|
||||
gst_base_transform_src_activate_pull (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
GstBaseTransform *trans;
|
||||
|
||||
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
|
||||
trans = GST_BASE_TRANSFORM (parent);
|
||||
|
||||
result = gst_pad_activate_pull (trans->sinkpad, active);
|
||||
|
||||
|
@ -2185,8 +2185,6 @@ gst_base_transform_src_activate_pull (GstPad * pad, gboolean active)
|
|||
if (result)
|
||||
trans->priv->pad_mode = active ? GST_PAD_MODE_PULL : GST_PAD_MODE_NONE;
|
||||
|
||||
gst_object_unref (trans);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1383,7 +1383,8 @@ was_eos:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_multi_queue_sink_activate_push (GstPad * pad, gboolean active)
|
||||
gst_multi_queue_sink_activate_push (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
GstSingleQueue *sq;
|
||||
|
||||
|
@ -1519,7 +1520,8 @@ gst_multi_queue_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_multi_queue_src_activate_push (GstPad * pad, gboolean active)
|
||||
gst_multi_queue_src_activate_push (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
GstMultiQueue *mq;
|
||||
GstSingleQueue *sq;
|
||||
|
|
|
@ -211,8 +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, gboolean active);
|
||||
static gboolean gst_queue_sink_activate_push (GstPad * pad, gboolean active);
|
||||
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_is_empty (GstQueue * queue);
|
||||
static gboolean gst_queue_is_filled (GstQueue * queue);
|
||||
|
@ -1281,12 +1283,12 @@ gst_queue_handle_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_queue_sink_activate_push (GstPad * pad, gboolean active)
|
||||
gst_queue_sink_activate_push (GstPad * pad, GstObject * parent, gboolean active)
|
||||
{
|
||||
gboolean result = TRUE;
|
||||
GstQueue *queue;
|
||||
|
||||
queue = GST_QUEUE (GST_PAD_PARENT (pad));
|
||||
queue = GST_QUEUE (parent);
|
||||
|
||||
if (active) {
|
||||
GST_QUEUE_MUTEX_LOCK (queue);
|
||||
|
@ -1306,12 +1308,12 @@ gst_queue_sink_activate_push (GstPad * pad, gboolean active)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_queue_src_activate_push (GstPad * pad, gboolean active)
|
||||
gst_queue_src_activate_push (GstPad * pad, GstObject * parent, gboolean active)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
GstQueue *queue;
|
||||
|
||||
queue = GST_QUEUE (GST_PAD_PARENT (pad));
|
||||
queue = GST_QUEUE (parent);
|
||||
|
||||
if (active) {
|
||||
GST_QUEUE_MUTEX_LOCK (queue);
|
||||
|
|
|
@ -243,9 +243,12 @@ 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, gboolean active);
|
||||
static gboolean gst_queue2_src_activate_push (GstPad * pad, gboolean active);
|
||||
static gboolean gst_queue2_sink_activate_push (GstPad * pad, gboolean active);
|
||||
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 GstStateChangeReturn gst_queue2_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
|
||||
|
@ -2659,12 +2662,13 @@ out_unexpected:
|
|||
|
||||
/* sink currently only operates in push mode */
|
||||
static gboolean
|
||||
gst_queue2_sink_activate_push (GstPad * pad, gboolean active)
|
||||
gst_queue2_sink_activate_push (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
gboolean result = TRUE;
|
||||
GstQueue2 *queue;
|
||||
|
||||
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
||||
queue = GST_QUEUE2 (parent);
|
||||
|
||||
if (active) {
|
||||
GST_QUEUE2_MUTEX_LOCK (queue);
|
||||
|
@ -2691,12 +2695,12 @@ gst_queue2_sink_activate_push (GstPad * pad, gboolean active)
|
|||
/* src operating in push mode, we start a task on the source pad that pushes out
|
||||
* buffers from the queue */
|
||||
static gboolean
|
||||
gst_queue2_src_activate_push (GstPad * pad, gboolean active)
|
||||
gst_queue2_src_activate_push (GstPad * pad, GstObject * parent, gboolean active)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
GstQueue2 *queue;
|
||||
|
||||
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
||||
queue = GST_QUEUE2 (parent);
|
||||
|
||||
if (active) {
|
||||
GST_QUEUE2_MUTEX_LOCK (queue);
|
||||
|
@ -2726,12 +2730,12 @@ gst_queue2_src_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
/* pull mode, downstream will call our getrange function */
|
||||
static gboolean
|
||||
gst_queue2_src_activate_pull (GstPad * pad, gboolean active)
|
||||
gst_queue2_src_activate_pull (GstPad * pad, GstObject * parent, gboolean active)
|
||||
{
|
||||
gboolean result;
|
||||
GstQueue2 *queue;
|
||||
|
||||
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
||||
queue = GST_QUEUE2 (parent);
|
||||
|
||||
if (active) {
|
||||
GST_QUEUE2_MUTEX_LOCK (queue);
|
||||
|
|
|
@ -144,10 +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, gboolean active);
|
||||
static gboolean gst_tee_sink_activate_push (GstPad * pad, GstObject * parent,
|
||||
gboolean active);
|
||||
static gboolean gst_tee_src_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query);
|
||||
static gboolean gst_tee_src_activate_pull (GstPad * pad, gboolean active);
|
||||
static gboolean gst_tee_src_activate_pull (GstPad * pad, GstObject * parent,
|
||||
gboolean active);
|
||||
static GstFlowReturn gst_tee_src_get_range (GstPad * pad, GstObject * parent,
|
||||
guint64 offset, guint length, GstBuffer ** buf);
|
||||
|
||||
|
@ -725,11 +727,11 @@ gst_tee_chain_list (GstPad * pad, GstObject * parent, GstBufferList * list)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_tee_sink_activate_push (GstPad * pad, gboolean active)
|
||||
gst_tee_sink_activate_push (GstPad * pad, GstObject * parent, gboolean active)
|
||||
{
|
||||
GstTee *tee;
|
||||
|
||||
tee = GST_TEE (GST_OBJECT_PARENT (pad));
|
||||
tee = GST_TEE (parent);
|
||||
|
||||
GST_OBJECT_LOCK (tee);
|
||||
tee->sink_mode = active && GST_PAD_MODE_PUSH;
|
||||
|
@ -751,13 +753,13 @@ no_chain:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_tee_src_activate_pull (GstPad * pad, gboolean active)
|
||||
gst_tee_src_activate_pull (GstPad * pad, GstObject * parent, gboolean active)
|
||||
{
|
||||
GstTee *tee;
|
||||
gboolean res;
|
||||
GstPad *sinkpad;
|
||||
|
||||
tee = GST_TEE (GST_PAD_PARENT (pad));
|
||||
tee = GST_TEE (parent);
|
||||
|
||||
GST_OBJECT_LOCK (tee);
|
||||
|
||||
|
|
|
@ -157,9 +157,10 @@ static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad,
|
|||
static GstStateChangeReturn
|
||||
gst_type_find_element_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
static gboolean gst_type_find_element_activate (GstPad * pad);
|
||||
static gboolean
|
||||
gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active);
|
||||
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 GstFlowReturn
|
||||
gst_type_find_element_chain_do_typefinding (GstTypeFindElement * typefind,
|
||||
gboolean check_avail);
|
||||
|
@ -871,17 +872,18 @@ gst_type_find_element_getrange (GstPad * srcpad, GstObject * parent,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active)
|
||||
gst_type_find_element_activate_src_pull (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
GstTypeFindElement *typefind;
|
||||
|
||||
typefind = GST_TYPE_FIND_ELEMENT (GST_OBJECT_PARENT (pad));
|
||||
typefind = GST_TYPE_FIND_ELEMENT (parent);
|
||||
|
||||
return gst_pad_activate_pull (typefind->sink, active);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_type_find_element_activate (GstPad * pad)
|
||||
gst_type_find_element_activate (GstPad * pad, GstObject * parent)
|
||||
{
|
||||
GstTypeFindProbability probability = GST_TYPE_FIND_NONE;
|
||||
GstCaps *found_caps = NULL;
|
||||
|
@ -889,7 +891,7 @@ gst_type_find_element_activate (GstPad * pad)
|
|||
GstQuery *query;
|
||||
gboolean pull_mode;
|
||||
|
||||
typefind = GST_TYPE_FIND_ELEMENT (GST_OBJECT_PARENT (pad));
|
||||
typefind = GST_TYPE_FIND_ELEMENT (parent);
|
||||
|
||||
/* if we have force caps, use those */
|
||||
GST_OBJECT_LOCK (typefind);
|
||||
|
|
Loading…
Reference in a new issue