mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 19:20:35 +00:00
pad: add more queries
Add more query functions to prepare for doing more with queries
This commit is contained in:
parent
642a4697fe
commit
ac9e5533b5
3 changed files with 67 additions and 26 deletions
|
@ -142,16 +142,23 @@ 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)) {
|
||||
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;
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ static void gst_selector_pad_reset (GstSelectorPad * pad);
|
|||
static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
|
||||
static GstCaps *gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter);
|
||||
static gboolean gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps);
|
||||
static gboolean gst_selector_pad_query (GstPad * pad, GstQuery * query);
|
||||
static GstIterator *gst_selector_pad_iterate_linked_pads (GstPad * pad);
|
||||
static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
|
||||
|
||||
|
@ -491,6 +492,33 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
|
|||
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)) {
|
||||
default:
|
||||
if (otherpad)
|
||||
res = gst_pad_peer_query (otherpad, query);
|
||||
break;
|
||||
}
|
||||
if (otherpad)
|
||||
gst_object_unref (otherpad);
|
||||
|
||||
gst_object_unref (sel);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter)
|
||||
{
|
||||
|
@ -1126,7 +1154,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 +1175,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);
|
||||
|
@ -1201,6 +1226,7 @@ gst_input_selector_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
if (otherpad)
|
||||
gst_object_unref (otherpad);
|
||||
|
||||
gst_object_unref (sel);
|
||||
|
||||
return res;
|
||||
|
@ -1299,6 +1325,8 @@ gst_input_selector_request_new_pad (GstElement * element,
|
|||
GST_DEBUG_FUNCPTR (gst_selector_pad_getcaps));
|
||||
gst_pad_set_acceptcaps_function (sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_selector_pad_acceptcaps));
|
||||
gst_pad_set_query_function (sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_selector_pad_query));
|
||||
gst_pad_set_chain_function (sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
|
||||
gst_pad_set_iterate_internal_links_function (sinkpad,
|
||||
|
|
|
@ -1518,6 +1518,21 @@ 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)) {
|
||||
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 +1601,16 @@ 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)) {
|
||||
default:
|
||||
/* default handling */
|
||||
res = gst_pad_peer_query (sq->sinkpad, query);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1951,6 +1955,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_query_function (sq->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_multi_queue_sink_query));
|
||||
gst_pad_set_iterate_internal_links_function (sq->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_multi_queue_iterate_internal_links));
|
||||
|
||||
|
|
Loading…
Reference in a new issue