pad: add parent to the query function

This commit is contained in:
Wim Taymans 2011-11-16 17:22:56 +01:00
parent 54e1174060
commit 09a8294d36
19 changed files with 133 additions and 128 deletions

View file

@ -176,6 +176,7 @@ done:
/**
* gst_proxy_pad_query_default:
* @pad: a #GstPad to invoke the default query on.
* @parent: the parent of @pad or NULL
* @query: (transfer none): the #GstQuery to perform.
*
* Invoke the default query function of the proxy pad.
@ -185,7 +186,7 @@ done:
* Since: 0.10.36
*/
gboolean
gst_proxy_pad_query_default (GstPad * pad, GstQuery * query)
gst_proxy_pad_query_default (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
GstPad *target;

View file

@ -63,7 +63,8 @@ GstProxyPad* gst_proxy_pad_get_internal (GstProxyPad *pad);
gboolean gst_proxy_pad_event_default (GstPad *pad, GstEvent *event);
gboolean gst_proxy_pad_query_default (GstPad *pad, GstQuery *query);
gboolean gst_proxy_pad_query_default (GstPad *pad, GstObject *parent,
GstQuery *query);
GstIterator* gst_proxy_pad_iterate_internal_links_default (GstPad *pad);
GstFlowReturn gst_proxy_pad_chain_default (GstPad *pad, GstBuffer *buffer);
GstFlowReturn gst_proxy_pad_chain_list_default (GstPad *pad, GstBufferList *list);

View file

@ -2776,6 +2776,7 @@ done:
/**
* gst_pad_query_default:
* @pad: a #GstPad to call the default query handler on.
* @parent: the parent of @pad or NULL
* @query: (transfer none): the #GstQuery to handle.
*
* Invokes the default query handler for the given pad.
@ -2787,7 +2788,7 @@ done:
* Returns: TRUE if the query was performed successfully.
*/
gboolean
gst_pad_query_default (GstPad * pad, GstQuery * query)
gst_pad_query_default (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean forward = TRUE, ret = FALSE;
@ -3182,7 +3183,7 @@ gst_pad_query (GstPad * pad, GstQuery * query)
if ((func = GST_PAD_QUERYFUNC (pad)) == NULL)
goto no_func;
res = func (pad, query);
res = func (pad, parent, query);
RELEASE_PARENT (parent);

View file

@ -369,13 +369,17 @@ typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad);
/**
* GstPadQueryFunction:
* @pad: the #GstPad to query.
* @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
* @parent is guaranteed to be not-NULL and remain valid during the
* execution of this function.
* @query: the #GstQuery object to execute
*
* The signature of the query function.
*
* Returns: TRUE if the query could be performed.
*/
typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstQuery *query);
typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstObject *parent,
GstQuery *query);
/* linking */
@ -879,7 +883,8 @@ GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad);
gboolean gst_pad_query (GstPad *pad, GstQuery *query);
gboolean gst_pad_peer_query (GstPad *pad, GstQuery *query);
void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query);
gboolean gst_pad_query_default (GstPad *pad, GstQuery *query);
gboolean gst_pad_query_default (GstPad *pad, GstObject *parent,
GstQuery *query);
/* misc helper functions */
gboolean gst_pad_forward (GstPad *pad, GstPadForwardFunction forward,

View file

@ -384,10 +384,12 @@ static gboolean gst_base_parse_handle_seek (GstBaseParse * parse,
static void gst_base_parse_handle_tag (GstBaseParse * parse, GstEvent * event);
static gboolean gst_base_parse_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_base_parse_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_base_parse_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_base_parse_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_base_parse_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_base_parse_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static GstFlowReturn gst_base_parse_chain (GstPad * pad, GstBuffer * buffer);
static void gst_base_parse_loop (GstPad * pad);
@ -1119,13 +1121,13 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event)
}
static gboolean
gst_base_parse_sink_query (GstPad * pad, GstQuery * query)
gst_base_parse_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstBaseParse *parse;
GstBaseParseClass *bclass;
gboolean res;
parse = GST_BASE_PARSE (gst_pad_get_parent (pad));
parse = GST_BASE_PARSE (parent);
bclass = GST_BASE_PARSE_GET_CLASS (parse);
switch (GST_QUERY_TYPE (query)) {
@ -1148,11 +1150,10 @@ gst_base_parse_sink_query (GstPad * pad, GstQuery * query)
}
default:
{
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
}
gst_object_unref (parse);
return res;
}
@ -3310,12 +3311,12 @@ gst_base_parse_get_duration (GstBaseParse * parse, GstFormat format,
}
static gboolean
gst_base_parse_src_query (GstPad * pad, GstQuery * query)
gst_base_parse_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstBaseParse *parse;
gboolean res = FALSE;
parse = GST_BASE_PARSE (GST_PAD_PARENT (pad));
parse = GST_BASE_PARSE (parent);
GST_LOG_OBJECT (parse, "handling query: %" GST_PTR_FORMAT, query);
@ -3329,7 +3330,7 @@ gst_base_parse_src_query (GstPad * pad, GstQuery * query)
gst_query_parse_position (query, &format, NULL);
/* try upstream first */
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
if (!res) {
/* Fall back on interpreting segment */
GST_OBJECT_LOCK (parse);
@ -3363,7 +3364,7 @@ gst_base_parse_src_query (GstPad * pad, GstQuery * query)
gst_query_parse_duration (query, &format, NULL);
/* consult upstream */
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
/* otherwise best estimate from us */
if (!res) {
@ -3383,7 +3384,7 @@ gst_base_parse_src_query (GstPad * pad, GstQuery * query)
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
/* consult upstream */
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
/* we may be able to help if in TIME */
if (fmt == GST_FORMAT_TIME && gst_base_parse_is_seekable (parse)) {
@ -3452,7 +3453,7 @@ gst_base_parse_src_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;

View file

@ -385,7 +385,8 @@ static gboolean gst_base_sink_default_prepare_seek_segment (GstBaseSink * sink,
static GstStateChangeReturn gst_base_sink_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_base_sink_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_base_sink_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
static GstFlowReturn gst_base_sink_chain_list (GstPad * pad,
GstBufferList * list);
@ -2056,8 +2057,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);
@ -4860,25 +4861,22 @@ default_sink_query (GstBaseSink * basesink, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (basesink->sinkpad, query);
res =
gst_pad_query_default (basesink->sinkpad, GST_OBJECT_CAST (basesink),
query);
break;
}
return res;
}
static gboolean
gst_base_sink_sink_query (GstPad * pad, GstQuery * query)
gst_base_sink_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstBaseSink *basesink;
GstBaseSinkClass *bclass;
gboolean res;
basesink = GST_BASE_SINK_CAST (gst_pad_get_parent (pad));
if (G_UNLIKELY (basesink == NULL)) {
gst_query_unref (query);
return FALSE;
}
basesink = GST_BASE_SINK_CAST (parent);
bclass = GST_BASE_SINK_GET_CLASS (basesink);
if (bclass->query)
@ -4886,8 +4884,6 @@ gst_base_sink_sink_query (GstPad * pad, GstQuery * query)
else
res = FALSE;
gst_object_unref (basesink);
return res;
}

View file

@ -294,7 +294,8 @@ static gboolean gst_base_src_event_handler (GstPad * pad, GstEvent * event);
static gboolean gst_base_src_send_event (GstElement * elem, GstEvent * event);
static gboolean gst_base_src_default_event (GstBaseSrc * src, GstEvent * event);
static gboolean gst_base_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_base_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_base_src_activate_pool (GstBaseSrc * basesrc,
gboolean active);
@ -1145,23 +1146,18 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query)
}
static gboolean
gst_base_src_query (GstPad * pad, GstQuery * query)
gst_base_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstBaseSrc *src;
GstBaseSrcClass *bclass;
gboolean result = FALSE;
src = GST_BASE_SRC (gst_pad_get_parent (pad));
if (G_UNLIKELY (src == NULL))
return FALSE;
src = GST_BASE_SRC (parent);
bclass = GST_BASE_SRC_GET_CLASS (src);
if (bclass->query)
result = bclass->query (src, query);
gst_object_unref (src);
return result;
}

View file

@ -327,7 +327,8 @@ static gboolean gst_base_transform_acceptcaps_default (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps);
static gboolean gst_base_transform_setcaps (GstBaseTransform * trans,
GstPad * pad, GstCaps * caps);
static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query);
static gboolean gst_base_transform_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_base_transform_default_query (GstBaseTransform * trans,
GstPadDirection direction, GstQuery * query);
static gboolean gst_base_transform_default_transform_size (GstBaseTransform *
@ -1380,23 +1381,18 @@ done:
}
static gboolean
gst_base_transform_query (GstPad * pad, GstQuery * query)
gst_base_transform_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstBaseTransform *trans;
GstBaseTransformClass *bclass;
gboolean ret = FALSE;
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
if (G_UNLIKELY (trans == NULL))
return FALSE;
trans = GST_BASE_TRANSFORM (parent);
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (bclass->query)
ret = bclass->query (trans, GST_PAD_DIRECTION (pad), query);
gst_object_unref (trans);
return ret;
}

View file

@ -106,7 +106,7 @@ static void gst_fd_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_fd_sink_dispose (GObject * obj);
static gboolean gst_fd_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_fd_sink_query (GstBaseSink * bsink, GstQuery * query);
static GstFlowReturn gst_fd_sink_render (GstBaseSink * sink,
GstBuffer * buffer);
static gboolean gst_fd_sink_start (GstBaseSink * basesink);
@ -145,6 +145,7 @@ gst_fd_sink_class_init (GstFdSinkClass * klass)
gstbasesink_class->unlock = GST_DEBUG_FUNCPTR (gst_fd_sink_unlock);
gstbasesink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_fd_sink_unlock_stop);
gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_fd_sink_event);
gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_fd_sink_query);
g_object_class_install_property (gobject_class, ARG_FD,
g_param_spec_int ("fd", "fd", "An open file descriptor to write to",
@ -154,11 +155,6 @@ gst_fd_sink_class_init (GstFdSinkClass * klass)
static void
gst_fd_sink_init (GstFdSink * fdsink)
{
GstPad *pad;
pad = GST_BASE_SINK_PAD (fdsink);
gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR (gst_fd_sink_query));
fdsink->fd = 1;
fdsink->uri = g_strdup_printf ("fd://%d", fdsink->fd);
fdsink->bytes_written = 0;
@ -179,36 +175,45 @@ gst_fd_sink_dispose (GObject * obj)
}
static gboolean
gst_fd_sink_query (GstPad * pad, GstQuery * query)
gst_fd_sink_query (GstBaseSink * bsink, GstQuery * query)
{
gboolean res = FALSE;
GstFdSink *fdsink;
GstFormat format;
fdsink = GST_FD_SINK (GST_PAD_PARENT (pad));
fdsink = GST_FD_SINK (bsink);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
{
GstFormat format;
gst_query_parse_position (query, &format, NULL);
switch (format) {
case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES:
gst_query_set_position (query, GST_FORMAT_BYTES, fdsink->current_pos);
return TRUE;
res = TRUE;
break;
default:
return FALSE;
break;
}
break;
}
case GST_QUERY_FORMATS:
gst_query_set_formats (query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES);
return TRUE;
res = TRUE;
break;
case GST_QUERY_URI:
gst_query_set_uri (query, fdsink->uri);
return TRUE;
res = TRUE;
break;
default:
return gst_pad_query_default (pad, query);
res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
break;
}
return res;
}
static GstFlowReturn

View file

@ -118,7 +118,8 @@ static void gst_funnel_release_pad (GstElement * element, GstPad * pad);
static GstFlowReturn gst_funnel_sink_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_funnel_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_funnel_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_funnel_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_funnel_src_event (GstPad * pad, GstEvent * event);
@ -318,9 +319,9 @@ gst_funnel_sink_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_funnel_sink_query (GstPad * pad, GstQuery * query)
gst_funnel_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstFunnel *funnel = GST_FUNNEL (GST_PAD_PARENT (pad));
GstFunnel *funnel = GST_FUNNEL (parent);
gboolean forward = TRUE;
gboolean res = TRUE;

View file

@ -179,7 +179,8 @@ 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 gboolean gst_selector_pad_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static GstIterator *gst_selector_pad_iterate_linked_pads (GstPad * pad);
static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
@ -482,13 +483,13 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_selector_pad_query (GstPad * pad, GstQuery * query)
gst_selector_pad_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = FALSE;
switch (GST_QUERY_TYPE (query)) {
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
@ -753,7 +754,8 @@ static GstStateChangeReturn gst_input_selector_change_state (GstElement *
element, GstStateChange transition);
static gboolean gst_input_selector_event (GstPad * pad, GstEvent * event);
static gboolean gst_input_selector_query (GstPad * pad, GstQuery * query);
static gboolean gst_input_selector_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gint64 gst_input_selector_block (GstInputSelector * self);
/* FIXME: create these marshallers using glib-genmarshal */
@ -1083,12 +1085,12 @@ gst_input_selector_event (GstPad * pad, GstEvent * event)
/* query on the srcpad. We override this function because by default it will
* only forward the query to one random sinkpad */
static gboolean
gst_input_selector_query (GstPad * pad, GstQuery * query)
gst_input_selector_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = FALSE;
GstInputSelector *sel;
sel = GST_INPUT_SELECTOR (GST_PAD_PARENT (pad));
sel = GST_INPUT_SELECTOR (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_LATENCY:
@ -1146,7 +1148,7 @@ gst_input_selector_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}

View file

@ -1503,7 +1503,7 @@ was_eos:
}
static gboolean
gst_multi_queue_sink_query (GstPad * pad, GstQuery * query)
gst_multi_queue_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
@ -1512,7 +1512,7 @@ gst_multi_queue_sink_query (GstPad * pad, GstQuery * query)
case GST_QUERY_CAPS:
default:
/* default handling */
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
@ -1549,17 +1549,15 @@ gst_multi_queue_src_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_multi_queue_src_query (GstPad * pad, GstQuery * query)
gst_multi_queue_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
/* FIXME, Handle position offset depending on queue size */
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_ACCEPT_CAPS:
case GST_QUERY_CAPS:
default:
/* default handling */
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;

View file

@ -106,7 +106,8 @@ static GstFlowReturn gst_output_selector_chain (GstPad * pad, GstBuffer * buf);
static GstStateChangeReturn gst_output_selector_change_state (GstElement *
element, GstStateChange transition);
static gboolean gst_output_selector_event (GstPad * pad, GstEvent * event);
static gboolean gst_output_selector_query (GstPad * pad, GstQuery * query);
static gboolean gst_output_selector_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static void gst_output_selector_switch_pad_negotiation_mode (GstOutputSelector *
sel, gint mode);
@ -563,13 +564,13 @@ gst_output_selector_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_output_selector_query (GstPad * pad, GstQuery * query)
gst_output_selector_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = TRUE;
GstOutputSelector *sel;
GstPad *active = NULL;
sel = GST_OUTPUT_SELECTOR (GST_PAD_PARENT (pad));
sel = GST_OUTPUT_SELECTOR (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS:
@ -595,8 +596,8 @@ gst_output_selector_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
}

View file

@ -197,10 +197,12 @@ static GstFlowReturn gst_queue_push_one (GstQueue * queue);
static void gst_queue_loop (GstPad * pad);
static gboolean gst_queue_handle_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_queue_handle_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_queue_handle_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_queue_handle_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_queue_handle_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_queue_handle_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static GstPadLinkReturn gst_queue_link_sink (GstPad * pad, GstPad * peer);
static GstPadLinkReturn gst_queue_link_src (GstPad * pad, GstPad * peer);
@ -810,20 +812,15 @@ out_eos:
}
static gboolean
gst_queue_handle_sink_query (GstPad * pad, GstQuery * query)
gst_queue_handle_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstQueue *queue = GST_QUEUE (GST_PAD_PARENT (pad));
gboolean res;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_ACCEPT_CAPS:
case GST_QUERY_CAPS:
default:
if (!(res = gst_pad_peer_query (queue->srcpad, query)))
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
}
@ -1214,15 +1211,14 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_queue_handle_src_query (GstPad * pad, GstQuery * query)
gst_queue_handle_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstQueue *queue = GST_QUEUE (GST_PAD_PARENT (pad));
GstQueue *queue = GST_QUEUE (parent);
gboolean res;
res = gst_pad_peer_query (queue->sinkpad, query);
if (!res) {
if (!res)
return FALSE;
}
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:

View file

@ -228,10 +228,12 @@ static GstFlowReturn gst_queue2_push_one (GstQueue2 * queue);
static void gst_queue2_loop (GstPad * pad);
static gboolean gst_queue2_handle_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_queue2_handle_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_queue2_handle_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_queue2_handle_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_queue2_handle_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_queue2_handle_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_queue2_handle_query (GstElement * element,
GstQuery * query);
@ -2014,13 +2016,14 @@ out_eos:
}
static gboolean
gst_queue2_handle_sink_query (GstPad * pad, GstQuery * query)
gst_queue2_handle_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean res;
switch (GST_QUERY_TYPE (query)) {
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
@ -2377,11 +2380,11 @@ gst_queue2_handle_src_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_queue2_handle_src_query (GstPad * pad, GstQuery * query)
gst_queue2_handle_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstQueue2 *queue;
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
queue = GST_QUEUE2 (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
@ -2555,7 +2558,7 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query)
}
default:
/* peer handled other queries */
if (!gst_pad_query_default (pad, query))
if (!gst_pad_query_default (pad, parent, query))
goto peer_failed;
break;
}
@ -2573,8 +2576,11 @@ peer_failed:
static gboolean
gst_queue2_handle_query (GstElement * element, GstQuery * query)
{
GstQueue2 *queue = GST_QUEUE2 (element);
/* simply forward to the srcpad query function */
return gst_queue2_handle_src_query (GST_QUEUE2_CAST (element)->srcpad, query);
return gst_queue2_handle_src_query (queue->srcpad, GST_OBJECT_CAST (element),
query);
}
static void

View file

@ -139,9 +139,11 @@ static void gst_tee_dispose (GObject * object);
static GstFlowReturn gst_tee_chain (GstPad * pad, GstBuffer * buffer);
static GstFlowReturn gst_tee_chain_list (GstPad * pad, GstBufferList * list);
static gboolean gst_tee_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_tee_sink_query (GstPad * pad, GstQuery * query);
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_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_tee_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_tee_src_activate_pull (GstPad * pad, gboolean active);
static GstFlowReturn gst_tee_src_get_range (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buf);
@ -492,13 +494,13 @@ gst_tee_sink_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_tee_sink_query (GstPad * pad, GstQuery * query)
gst_tee_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
switch (GST_QUERY_TYPE (query)) {
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
@ -809,13 +811,13 @@ sink_activate_failed:
}
static gboolean
gst_tee_src_query (GstPad * pad, GstQuery * query)
gst_tee_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstTee *tee;
gboolean res;
GstPad *sinkpad;
tee = GST_TEE (GST_PAD_PARENT (pad));
tee = GST_TEE (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_SCHEDULING:
@ -847,7 +849,7 @@ gst_tee_src_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}

View file

@ -142,7 +142,8 @@ static const GstEventMask *gst_type_find_element_src_event_mask (GstPad * pad);
static gboolean gst_type_find_element_src_event (GstPad * pad,
GstEvent * event);
static gboolean gst_type_find_handle_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_type_find_handle_src_query (GstPad * pad,
GstObject * parent, GstQuery * query);
static gboolean gst_type_find_element_sink_event (GstPad * pad,
GstEvent * event);
@ -366,19 +367,15 @@ gst_type_find_element_get_property (GObject * object, guint prop_id,
}
static gboolean
gst_type_find_handle_src_query (GstPad * pad, GstQuery * query)
gst_type_find_handle_src_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
GstTypeFindElement *typefind;
gboolean res = FALSE;
GstPad *peer;
typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
typefind = GST_TYPE_FIND_ELEMENT (parent);
peer = gst_pad_get_peer (typefind->sink);
if (peer == NULL)
return FALSE;
res = gst_pad_query (peer, query);
res = gst_pad_peer_query (typefind->sink, query);
if (!res)
goto out;
@ -409,7 +406,6 @@ gst_type_find_handle_src_query (GstPad * pad, GstQuery * query)
}
out:
gst_object_unref (peer);
return res;
}

View file

@ -74,7 +74,8 @@ static void gst_valve_get_property (GObject * object,
static GstFlowReturn gst_valve_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_valve_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_valve_query (GstPad * pad, GstQuery * query);
static gboolean gst_valve_query (GstPad * pad, GstObject * parent,
GstQuery * query);
#define _do_init \
GST_DEBUG_CATEGORY_INIT (valve_debug, "valve", 0, "Valve");
@ -215,20 +216,20 @@ gst_valve_sink_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_valve_query (GstPad * pad, GstQuery * query)
gst_valve_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstValve *valve;
gboolean res;
GstPad *otherpad;
valve = GST_VALVE (GST_PAD_PARENT (pad));
valve = GST_VALVE (parent);
otherpad = (pad == valve->sinkpad ? valve->srcpad : valve->sinkpad);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS:
if (!(res = gst_pad_peer_query (otherpad, query)))
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
default:
res = gst_pad_peer_query (otherpad, query);

View file

@ -290,7 +290,7 @@ GST_START_TEST (test_request_pads_named)
GST_END_TEST;
static gboolean
mq_dummypad_query (GstPad * sinkpad, GstQuery * query)
mq_dummypad_query (GstPad * sinkpad, GstObject * parent, GstQuery * query)
{
gboolean res = TRUE;
@ -306,7 +306,7 @@ mq_dummypad_query (GstPad * sinkpad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (sinkpad, query);
res = gst_pad_query_default (sinkpad, parent, query);
break;
}
return res;