summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-11-09 10:02:39 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2011-11-09 10:02:39 +0100
commit93d8ee4ffadcdfc540d50fbabd9dde949ba0d75f (patch)
treeff3e50cf729847c849be19e71dab93e76bf2f5da
parent642a4697fe1a48db2948d8bb006e6164291bb45e (diff)
pad: make internal links a GstQueryintlinks-query
-rw-r--r--gst/gstghostpad.c65
-rw-r--r--gst/gstpad.c95
-rw-r--r--gst/gstpad.h24
-rw-r--r--gst/gstquark.c3
-rw-r--r--gst/gstquark.h4
-rw-r--r--gst/gstquery.c66
-rw-r--r--gst/gstquery.h11
-rw-r--r--plugins/elements/gstinputselector.c99
-rw-r--r--plugins/elements/gstmultiqueue.c59
-rw-r--r--tools/gst-inspect.c4
10 files changed, 247 insertions, 183 deletions
diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c
index 2f52c6187..8faffcb11 100644
--- a/gst/gstghostpad.c
+++ b/gst/gstghostpad.c
@@ -142,16 +142,39 @@ gboolean
gst_proxy_pad_query_default (GstPad * pad, GstQuery * query)
{
gboolean res;
- GstPad *target;
g_return_val_if_fail (GST_IS_PROXY_PAD (pad), FALSE);
g_return_val_if_fail (GST_IS_QUERY (query), FALSE);
- if (!(target = gst_proxy_pad_get_target (pad)))
- goto no_target;
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_INTERNAL_LINKS:
+ {
+ GstIterator *iter = NULL;
+ GstPad *internal;
+ GValue v = { 0, };
+
+ internal = GST_PROXY_PAD_INTERNAL (pad);
+ g_value_init (&v, GST_TYPE_PAD);
+ g_value_set_object (&v, internal);
+ iter = gst_iterator_new_single (GST_TYPE_PAD, &v);
+ g_value_unset (&v);
+
+ gst_query_set_internal_links_iterator (query, iter);
+ res = TRUE;
+ break;
+ }
+ default:
+ {
+ GstPad *target;
- res = gst_pad_query (target, query);
- gst_object_unref (target);
+ if (!(target = gst_proxy_pad_get_target (pad)))
+ goto no_target;
+
+ res = gst_pad_query (target, query);
+ gst_object_unref (target);
+ break;
+ }
+ }
return res;
@@ -164,35 +187,6 @@ no_target:
}
/**
- * gst_proyx_pad_iterate_internal_links_default:
- * @pad: the #GstPad to get the internal links of.
- *
- * Invoke the default iterate internal links function of the proxy pad.
- *
- * Returns: a #GstIterator of #GstPad, or NULL if @pad has no parent. Unref each
- * returned pad with gst_object_unref().
- *
- * Since: 0.10.36
- */
-GstIterator *
-gst_proxy_pad_iterate_internal_links_default (GstPad * pad)
-{
- GstIterator *res = NULL;
- GstPad *internal;
- GValue v = { 0, };
-
- g_return_val_if_fail (GST_IS_PROXY_PAD (pad), NULL);
-
- internal = GST_PROXY_PAD_INTERNAL (pad);
- g_value_init (&v, GST_TYPE_PAD);
- g_value_set_object (&v, internal);
- res = gst_iterator_new_single (GST_TYPE_PAD, &v);
- g_value_unset (&v);
-
- return res;
-}
-
-/**
* gst_proxy_pad_chain_default:
* @pad: a sink #GstPad, returns GST_FLOW_ERROR if not.
* @buffer: (transfer full): the #GstBuffer to send, return GST_FLOW_ERROR
@@ -490,7 +484,6 @@ gst_proxy_pad_class_init (GstProxyPadClass * klass)
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_query_type_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_event_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_query_default);
- GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_iterate_internal_links_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_getcaps_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_acceptcaps_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_fixatecaps_default);
@@ -511,8 +504,6 @@ gst_proxy_pad_init (GstProxyPad * ppad)
gst_pad_set_query_type_function (pad, gst_proxy_pad_query_type_default);
gst_pad_set_event_function (pad, gst_proxy_pad_event_default);
gst_pad_set_query_function (pad, gst_proxy_pad_query_default);
- gst_pad_set_iterate_internal_links_function (pad,
- gst_proxy_pad_iterate_internal_links_default);
gst_pad_set_getcaps_function (pad, gst_proxy_pad_getcaps_default);
gst_pad_set_acceptcaps_function (pad, gst_proxy_pad_acceptcaps_default);
diff --git a/gst/gstpad.c b/gst/gstpad.c
index b82880e17..283b952be 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -302,7 +302,6 @@ gst_pad_class_init (GstPadClass * klass)
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_event_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_get_query_types_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_query_default);
- GST_DEBUG_REGISTER_FUNCPTR (gst_pad_iterate_internal_links_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_acceptcaps_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_chain_list_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_fixate_caps_default);
@@ -319,7 +318,6 @@ gst_pad_init (GstPad * pad)
GST_PAD_EVENTFUNC (pad) = gst_pad_event_default;
GST_PAD_QUERYTYPEFUNC (pad) = gst_pad_get_query_types_default;
GST_PAD_QUERYFUNC (pad) = gst_pad_query_default;
- GST_PAD_ITERINTLINKFUNC (pad) = gst_pad_iterate_internal_links_default;
GST_PAD_ACCEPTCAPSFUNC (pad) = gst_pad_acceptcaps_default;
GST_PAD_FIXATECAPSFUNC (pad) = gst_pad_fixate_caps_default;
GST_PAD_CHAINLISTFUNC (pad) = gst_pad_chain_list_default;
@@ -1530,26 +1528,6 @@ gst_pad_get_query_types_default (GstPad * pad)
}
/**
- * gst_pad_set_iterate_internal_links_function:
- * @pad: a #GstPad of either direction.
- * @iterintlink: the #GstPadIterIntLinkFunction to set.
- *
- * Sets the given internal link iterator function for the pad.
- *
- * Since: 0.10.21
- */
-void
-gst_pad_set_iterate_internal_links_function (GstPad * pad,
- GstPadIterIntLinkFunction iterintlink)
-{
- g_return_if_fail (GST_IS_PAD (pad));
-
- GST_PAD_ITERINTLINKFUNC (pad) = iterintlink;
- GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "internal link iterator set to %s",
- GST_DEBUG_FUNCPTR_NAME (iterintlink));
-}
-
-/**
* gst_pad_set_link_function:
* @pad: a #GstPad.
* @link: the #GstPadLinkFunction to set.
@@ -2926,7 +2904,7 @@ no_peer:
}
/**
- * gst_pad_iterate_internal_links_default:
+ * query_internal_links:
* @pad: the #GstPad to get the internal links of.
*
* Iterate the list of pads to which the given pad is linked to inside of
@@ -2938,56 +2916,51 @@ no_peer:
*
* Returns: a #GstIterator of #GstPad, or NULL if @pad has no parent. Unref each
* returned pad with gst_object_unref().
- *
- * Since: 0.10.21
*/
-GstIterator *
-gst_pad_iterate_internal_links_default (GstPad * pad)
+static gboolean
+query_internal_links (GstPad * pad, GstQuery * query)
{
- GstIterator *res;
+ GstIterator *iter;
GList **padlist;
guint32 *cookie;
GMutex *lock;
gpointer owner;
+ GstElement *parent;
- g_return_val_if_fail (GST_IS_PAD (pad), NULL);
-
- {
- GstElement *parent;
-
- GST_OBJECT_LOCK (pad);
- parent = GST_PAD_PARENT (pad);
- if (!parent || !GST_IS_ELEMENT (parent))
- goto no_parent;
+ GST_OBJECT_LOCK (pad);
+ parent = GST_PAD_PARENT (pad);
+ if (!parent || !GST_IS_ELEMENT (parent))
+ goto no_parent;
- gst_object_ref (parent);
- GST_OBJECT_UNLOCK (pad);
+ gst_object_ref (parent);
+ GST_OBJECT_UNLOCK (pad);
- if (pad->direction == GST_PAD_SRC)
- padlist = &parent->sinkpads;
- else
- padlist = &parent->srcpads;
+ if (pad->direction == GST_PAD_SRC)
+ padlist = &parent->sinkpads;
+ else
+ padlist = &parent->srcpads;
- GST_DEBUG_OBJECT (pad, "Making iterator");
+ GST_DEBUG_OBJECT (pad, "Making iterator");
- cookie = &parent->pads_cookie;
- owner = parent;
- lock = GST_OBJECT_GET_LOCK (parent);
- }
+ cookie = &parent->pads_cookie;
+ owner = parent;
+ lock = GST_OBJECT_GET_LOCK (parent);
- res = gst_iterator_new_list (GST_TYPE_PAD,
+ iter = gst_iterator_new_list (GST_TYPE_PAD,
lock, cookie, padlist, (GObject *) owner, NULL);
+ gst_query_set_internal_links_iterator (query, iter);
+
gst_object_unref (owner);
- return res;
+ return TRUE;
/* ERRORS */
no_parent:
{
GST_OBJECT_UNLOCK (pad);
GST_DEBUG_OBJECT (pad, "no parent element");
- return NULL;
+ return FALSE;
}
}
@@ -3013,13 +2986,25 @@ GstIterator *
gst_pad_iterate_internal_links (GstPad * pad)
{
GstIterator *res = NULL;
+ GstQuery *query;
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
- if (GST_PAD_ITERINTLINKFUNC (pad))
- res = GST_PAD_ITERINTLINKFUNC (pad) (pad);
+ query = gst_query_new_internal_links ();
+ if (!gst_pad_query (pad, query))
+ goto query_failed;
+
+ gst_query_parse_internal_links_iterator (query, &res);
+ gst_query_unref (query);
return res;
+
+ /* ERRORS */
+query_failed:
+ {
+ GST_DEBUG_OBJECT (pad, "internal links query failed");
+ return NULL;
+ }
}
/**
@@ -3200,6 +3185,10 @@ gst_pad_query_default (GstPad * pad, GstQuery * query)
case GST_QUERY_SCHEDULING:
forward = FALSE;
break;
+ case GST_QUERY_INTERNAL_LINKS:
+ ret = query_internal_links (pad, query);
+ forward = FALSE;
+ break;
case GST_QUERY_POSITION:
case GST_QUERY_SEEKING:
case GST_QUERY_FORMATS:
diff --git a/gst/gstpad.h b/gst/gstpad.h
index f7bd96d21..f067defe2 100644
--- a/gst/gstpad.h
+++ b/gst/gstpad.h
@@ -349,22 +349,6 @@ typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, guint64 offset,
typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
-/* internal links */
-/**
- * GstPadIterIntLinkFunction:
- * @pad: The #GstPad to query.
- *
- * The signature of the internal pad link iterator function.
- *
- * Returns: a new #GstIterator that will iterate over all pads that are
- * linked to the given pad on the inside of the parent element.
- *
- * the caller must call gst_iterator_free() after usage.
- *
- * Since 0.10.21
- */
-typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad);
-
/* generic query function */
/**
* GstPadQueryTypeFunction:
@@ -704,9 +688,6 @@ struct _GstPad {
GstPadQueryTypeFunction querytypefunc;
GstPadQueryFunction queryfunc;
- /* internal links */
- GstPadIterIntLinkFunction iterintlinkfunc;
-
/*< private >*/
/* counts number of probes attached. */
gint num_probes;
@@ -748,7 +729,6 @@ struct _GstPadClass {
#define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc)
#define GST_PAD_QUERYTYPEFUNC(pad) (GST_PAD_CAST(pad)->querytypefunc)
#define GST_PAD_QUERYFUNC(pad) (GST_PAD_CAST(pad)->queryfunc)
-#define GST_PAD_ITERINTLINKFUNC(pad) (GST_PAD_CAST(pad)->iterintlinkfunc)
#define GST_PAD_PEER(pad) (GST_PAD_CAST(pad)->peer)
#define GST_PAD_LINKFUNC(pad) (GST_PAD_CAST(pad)->linkfunc)
@@ -937,11 +917,7 @@ gboolean gst_pad_pause_task (GstPad *pad);
gboolean gst_pad_stop_task (GstPad *pad);
/* internal links */
-void gst_pad_set_iterate_internal_links_function (GstPad * pad,
- GstPadIterIntLinkFunction iterintlink);
GstIterator * gst_pad_iterate_internal_links (GstPad * pad);
-GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad);
-
/* generic query function */
void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func);
diff --git a/gst/gstquark.c b/gst/gstquark.c
index 26b3f16d6..78bcb35ec 100644
--- a/gst/gstquark.c
+++ b/gst/gstquark.c
@@ -54,7 +54,8 @@ static const gchar *_quark_strings[] = {
"min-buffers", "max-buffers", "prefix", "postfix", "align", "time",
"GstQueryAllocation", "need-pool", "meta", "pool", "GstEventCaps",
"GstEventReconfigure", "segment", "GstQueryScheduling", "pull-mode",
- "random-access", "sequential", "allocator", "GstEventFlushStop", "options"
+ "random-access", "sequential", "allocator", "GstEventFlushStop", "options",
+ "GstQueryInternalLinks", "iterator"
};
GQuark _priv_gst_quark_table[GST_QUARK_MAX];
diff --git a/gst/gstquark.h b/gst/gstquark.h
index 06eb709f9..7cdae0e2d 100644
--- a/gst/gstquark.h
+++ b/gst/gstquark.h
@@ -155,8 +155,10 @@ typedef enum _GstQuarkId
GST_QUARK_ALLOCATOR = 126,
GST_QUARK_EVENT_FLUSH_STOP = 127,
GST_QUARK_OPTIONS = 128,
+ GST_QUARK_QUERY_INTERNAL_LINKS = 129,
+ GST_QUARK_ITERATOR = 130,
- GST_QUARK_MAX = 129
+ GST_QUARK_MAX = 131
} GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
diff --git a/gst/gstquery.c b/gst/gstquery.c
index 505378236..8840154e2 100644
--- a/gst/gstquery.c
+++ b/gst/gstquery.c
@@ -105,6 +105,7 @@ static GstQueryTypeDefinition standard_definitions[] = {
{GST_QUERY_URI, "uri", "URI of the source or sink", 0},
{GST_QUERY_ALLOCATION, "allocation", "Allocation properties", 0},
{GST_QUERY_SCHEDULING, "scheduling", "Scheduling properties", 0},
+ {GST_QUERY_INTERNAL_LINKS, "internal-links", "Internal links", 0},
{GST_QUERY_NONE, NULL, NULL, 0}
};
@@ -1982,7 +1983,7 @@ gst_query_set_scheduling (GstQuery * query, gboolean pull_mode,
* @maxsize: the suggested maximum size of pull requests:
* @align: the suggested alignment of pull requests
*
- * Set the scheduling properties.
+ * Parse the scheduling properties.
*/
void
gst_query_parse_scheduling (GstQuery * query, gboolean * pull_mode,
@@ -2002,3 +2003,66 @@ gst_query_parse_scheduling (GstQuery * query, gboolean * pull_mode,
GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize,
GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
}
+
+/**
+ * gst_query_new_internal_links
+ *
+ * Constructs a new query object for querying the internal links. This query is
+ * sent on a pad to get an iterator for the pads to which the given pad is
+ * linked to inside of the parent element.
+ *
+ * Free-function: gst_query_unref
+ *
+ * Returns: (transfer full): a new #GstQuery
+ */
+GstQuery *
+gst_query_new_internal_links (void)
+{
+ GstQuery *query;
+ GstStructure *structure;
+
+ structure = gst_structure_new_id (GST_QUARK (QUERY_INTERNAL_LINKS),
+ GST_QUARK (ITERATOR), GST_TYPE_ITERATOR, NULL, NULL);
+ query = gst_query_new (GST_QUERY_INTERNAL_LINKS, structure);
+
+ return query;
+}
+
+/**
+ * gst_query_set_internal_links_iterator:
+ * @query: A valid #GstQuery of type GST_QUERY_INTERNAL_LINKS.
+ * @it: a #GstIterator
+ *
+ * Set the iterator for the internally linked pads.
+ */
+void
+gst_query_set_internal_links_iterator (GstQuery * query, GstIterator * it)
+{
+ GstStructure *structure;
+
+ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_INTERNAL_LINKS);
+ g_return_if_fail (gst_query_is_writable (query));
+
+ structure = GST_QUERY_STRUCTURE (query);
+ gst_structure_id_set (structure,
+ GST_QUARK (ITERATOR), GST_TYPE_ITERATOR, it, NULL);
+}
+
+/**
+ * gst_query_parse_internal_links_iterator:
+ * @query: A valid #GstQuery of type GST_QUERY_INTERNAL_LINKS.
+ * @it: a #GstIterator
+ *
+ * Parse the iterator for the internally linked pads.
+ */
+void
+gst_query_parse_internal_links_iterator (GstQuery * query, GstIterator ** it)
+{
+ GstStructure *structure;
+
+ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_INTERNAL_LINKS);
+
+ structure = GST_QUERY_STRUCTURE (query);
+ gst_structure_id_get (structure,
+ GST_QUARK (ITERATOR), GST_TYPE_ITERATOR, it, NULL);
+}
diff --git a/gst/gstquery.h b/gst/gstquery.h
index 7b83cbc14..7844e8f47 100644
--- a/gst/gstquery.h
+++ b/gst/gstquery.h
@@ -55,6 +55,8 @@ G_BEGIN_DECLS
* @GST_QUERY_URI: query the URI of the source or sink. Since 0.10.22.
* @GST_QUERY_ALLOCATION: the buffer allocation properties
* @GST_QUERY_SCHEDULING: the scheduling properties
+ * @GST_QUERY_INTERNAL_LINKS: query the internal links, when executed on a pad
+ * it returns the internally linked pads of the element.
*
* Standard predefined Query types
*/
@@ -75,7 +77,10 @@ typedef enum {
GST_QUERY_CUSTOM,
GST_QUERY_URI,
GST_QUERY_ALLOCATION,
- GST_QUERY_SCHEDULING
+ GST_QUERY_SCHEDULING,
+ GST_QUERY_INTERNAL_LINKS,
+
+ GST_QUERY_LAST
} GstQueryType;
/**
@@ -378,6 +383,10 @@ void gst_query_set_scheduling (GstQuery *query, gboolean pul
void gst_query_parse_scheduling (GstQuery *query, gboolean *pull_mode,
gboolean *random_access, gboolean *sequential,
gint *minsize, gint *maxsize, gint *align);
+/* internal links query */
+GstQuery * gst_query_new_internal_links (void);
+void gst_query_set_internal_links_iterator (GstQuery *query, GstIterator *it);
+void gst_query_parse_internal_links_iterator (GstQuery *query, GstIterator **it);
G_END_DECLS
diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index b9ece3310..fbe97aac1 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -179,9 +179,9 @@ static void gst_selector_pad_set_property (GObject * object,
static gint64 gst_selector_pad_get_running_time (GstSelectorPad * pad);
static void gst_selector_pad_reset (GstSelectorPad * pad);
static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
+static gboolean gst_selector_pad_query (GstPad * pad, GstQuery * query);
static GstCaps *gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter);
static gboolean gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps);
-static GstIterator *gst_selector_pad_iterate_linked_pads (GstPad * pad);
static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
G_DEFINE_TYPE (GstSelectorPad, gst_selector_pad, GST_TYPE_PAD);
@@ -327,33 +327,6 @@ gst_selector_pad_reset (GstSelectorPad * pad)
GST_OBJECT_UNLOCK (pad);
}
-/* strictly get the linked pad from the sinkpad. If the pad is active we return
- * the srcpad else we return NULL */
-static GstIterator *
-gst_selector_pad_iterate_linked_pads (GstPad * pad)
-{
- GstInputSelector *sel;
- GstPad *otherpad;
- GstIterator *it = NULL;
- GValue val = { 0, };
-
- sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
- if (G_UNLIKELY (sel == NULL))
- return NULL;
-
- otherpad = gst_input_selector_get_linked_pad (sel, pad, TRUE);
- if (otherpad) {
- g_value_init (&val, GST_TYPE_PAD);
- g_value_set_object (&val, otherpad);
- it = gst_iterator_new_single (GST_TYPE_PAD, &val);
- g_value_unset (&val);
- gst_object_unref (otherpad);
- }
- gst_object_unref (sel);
-
- return it;
-}
-
static gboolean
gst_selector_pad_event (GstPad * pad, GstEvent * event)
{
@@ -528,6 +501,49 @@ gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps)
return res;
}
+static gboolean
+gst_selector_pad_query (GstPad * pad, GstQuery * query)
+{
+ gboolean res = FALSE;
+ GstInputSelector *sel;
+ GstPad *otherpad;
+
+ sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
+ if (G_UNLIKELY (sel == NULL))
+ return FALSE;
+
+ otherpad = gst_input_selector_get_linked_pad (sel, pad, TRUE);
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_INTERNAL_LINKS:
+ {
+ GstIterator *it = NULL;
+
+ if (otherpad) {
+ GValue val = { 0, };
+
+ g_value_init (&val, GST_TYPE_PAD);
+ g_value_take_object (&val, otherpad);
+ it = gst_iterator_new_single (GST_TYPE_PAD, &val);
+ g_value_unset (&val);
+ }
+ gst_query_set_internal_links_iterator (query, it);
+ res = TRUE;
+ break;
+ }
+ default:
+ if (otherpad)
+ res = gst_pad_peer_query (otherpad, query);
+ break;
+ }
+ if (otherpad)
+ gst_object_unref (otherpad);
+
+ gst_object_unref (sel);
+
+ return res;
+}
+
/* must be called with the SELECTOR_LOCK, will block while the pad is blocked
* or return TRUE when flushing */
static gboolean
@@ -901,8 +917,6 @@ static void
gst_input_selector_init (GstInputSelector * sel)
{
sel->srcpad = gst_pad_new ("src", GST_PAD_SRC);
- gst_pad_set_iterate_internal_links_function (sel->srcpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_iterate_linked_pads));
gst_pad_set_getcaps_function (sel->srcpad,
GST_DEBUG_FUNCPTR (gst_input_selector_getcaps));
gst_pad_set_query_function (sel->srcpad,
@@ -1126,7 +1140,7 @@ gst_input_selector_event (GstPad * pad, GstEvent * event)
static gboolean
gst_input_selector_query (GstPad * pad, GstQuery * query)
{
- gboolean res = TRUE;
+ gboolean res = FALSE;
GstInputSelector *sel;
GstPad *otherpad;
@@ -1147,9 +1161,6 @@ gst_input_selector_query (GstPad * pad, GstQuery * query)
resmax = -1;
reslive = FALSE;
- /* assume FALSE, we become TRUE if one query succeeds */
- res = FALSE;
-
/* perform the query on all sinkpads and combine the results. We take the
* max of min and the min of max for the result latency. */
GST_INPUT_SELECTOR_LOCK (sel);
@@ -1194,6 +1205,22 @@ gst_input_selector_query (GstPad * pad, GstQuery * query)
break;
}
+ case GST_QUERY_INTERNAL_LINKS:
+ {
+ GstIterator *it = NULL;
+
+ if (otherpad) {
+ GValue val = { 0, };
+
+ g_value_init (&val, GST_TYPE_PAD);
+ g_value_take_object (&val, otherpad);
+ it = gst_iterator_new_single (GST_TYPE_PAD, &val);
+ g_value_unset (&val);
+ }
+ gst_query_set_internal_links_iterator (query, it);
+ res = TRUE;
+ break;
+ }
default:
if (otherpad)
res = gst_pad_peer_query (otherpad, query);
@@ -1301,8 +1328,8 @@ gst_input_selector_request_new_pad (GstElement * element,
GST_DEBUG_FUNCPTR (gst_selector_pad_acceptcaps));
gst_pad_set_chain_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
- gst_pad_set_iterate_internal_links_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_iterate_linked_pads));
+ gst_pad_set_query_function (sinkpad,
+ GST_DEBUG_FUNCPTR (gst_selector_pad_query));
gst_pad_set_active (sinkpad, TRUE);
gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c
index ed5cc70f0..99146b95f 100644
--- a/plugins/elements/gstmultiqueue.c
+++ b/plugins/elements/gstmultiqueue.c
@@ -574,8 +574,8 @@ gst_multi_queue_get_property (GObject * object, guint prop_id,
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
}
-static GstIterator *
-gst_multi_queue_iterate_internal_links (GstPad * pad)
+static gboolean
+gst_multi_queue_query_internal_links (GstPad * pad, GstQuery * query)
{
GstIterator *it = NULL;
GstPad *opad;
@@ -606,9 +606,10 @@ out:
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
gst_object_unref (mq);
- return it;
-}
+ gst_query_set_internal_links_iterator (query, it);
+ return it ? TRUE : FALSE;
+}
/*
* GstElement methods
@@ -1518,6 +1519,24 @@ was_eos:
}
}
+static gboolean
+gst_multi_queue_sink_query (GstPad * pad, GstQuery * query)
+{
+ GstSingleQueue *sq = gst_pad_get_element_private (pad);
+ gboolean res;
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_INTERNAL_LINKS:
+ res = gst_multi_queue_query_internal_links (pad, query);
+ break;
+ default:
+ /* default handling */
+ res = gst_pad_peer_query (sq->srcpad, query);
+ break;
+ }
+ return res;
+}
+
static GstCaps *
gst_multi_queue_getcaps (GstPad * pad, GstCaps * filter)
{
@@ -1586,27 +1605,19 @@ static gboolean
gst_multi_queue_src_query (GstPad * pad, GstQuery * query)
{
GstSingleQueue *sq = gst_pad_get_element_private (pad);
- GstPad *peerpad;
gboolean res;
/* FIXME, Handle position offset depending on queue size */
-
- /* default handling */
- if (!(peerpad = gst_pad_get_peer (sq->sinkpad)))
- goto no_peer;
-
- res = gst_pad_query (peerpad, query);
-
- gst_object_unref (peerpad);
-
- return res;
-
- /* ERRORS */
-no_peer:
- {
- GST_LOG_OBJECT (sq->sinkpad, "Couldn't send query because we have no peer");
- return FALSE;
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_INTERNAL_LINKS:
+ res = gst_multi_queue_query_internal_links (pad, query);
+ break;
+ default:
+ /* default handling */
+ res = gst_pad_peer_query (sq->sinkpad, query);
+ break;
}
+ return res;
}
/*
@@ -1951,8 +1962,8 @@ gst_single_queue_new (GstMultiQueue * mqueue, guint id)
GST_DEBUG_FUNCPTR (gst_multi_queue_getcaps));
gst_pad_set_acceptcaps_function (sq->sinkpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_acceptcaps));
- gst_pad_set_iterate_internal_links_function (sq->sinkpad,
- GST_DEBUG_FUNCPTR (gst_multi_queue_iterate_internal_links));
+ gst_pad_set_query_function (sq->sinkpad,
+ GST_DEBUG_FUNCPTR (gst_multi_queue_sink_query));
name = g_strdup_printf ("src_%u", sq->id);
sq->srcpad = gst_pad_new_from_static_template (&srctemplate, name);
@@ -1968,8 +1979,6 @@ gst_single_queue_new (GstMultiQueue * mqueue, guint id)
GST_DEBUG_FUNCPTR (gst_multi_queue_src_event));
gst_pad_set_query_function (sq->srcpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_src_query));
- gst_pad_set_iterate_internal_links_function (sq->srcpad,
- GST_DEBUG_FUNCPTR (gst_multi_queue_iterate_internal_links));
gst_pad_set_element_private (sq->sinkpad, (gpointer) sq);
gst_pad_set_element_private (sq->srcpad, (gpointer) sq);
diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c
index 6fb3407e9..61df40ef1 100644
--- a/tools/gst-inspect.c
+++ b/tools/gst-inspect.c
@@ -829,10 +829,6 @@ print_pad_info (GstElement * element)
}
}
- if (pad->iterintlinkfunc != gst_pad_iterate_internal_links_default)
- n_print (" Has custom iterintlinkfunc(): %s\n",
- GST_DEBUG_FUNCPTR_NAME (pad->iterintlinkfunc));
-
if (pad->getcapsfunc)
n_print (" Has getcapsfunc(): %s\n",
GST_DEBUG_FUNCPTR_NAME (pad->getcapsfunc));