Add function to perform a query on the peer of a pad.

Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstpad.c: (gst_pad_peer_query):
* gst/gstpad.h:
Add function to perform a query on the peer of a pad.
API: gst_pad_peer_query()
This commit is contained in:
Wim Taymans 2007-09-11 15:55:50 +00:00
parent 33f966fede
commit 0d3299c63b
4 changed files with 60 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2007-09-11 Wim Taymans <wim.taymans@gmail.com>
* docs/gst/gstreamer-sections.txt:
* gst/gstpad.c: (gst_pad_peer_query):
* gst/gstpad.h:
Add function to perform a query on the peer of a pad.
API: gst_pad_peer_query()
2007-09-11 Stefan Kost <ensonic@users.sf.net>
* tests/check/gst/gstsystemclock.c:

View file

@ -1284,6 +1284,7 @@ gst_pad_send_event
gst_pad_event_default
gst_pad_query
gst_pad_peer_query
gst_pad_query_default
gst_pad_query_position
gst_pad_query_duration

View file

@ -3064,6 +3064,56 @@ no_func:
}
}
/**
* gst_pad_peer_query:
* @pad: a #GstPad to invoke the peer query on.
* @query: the #GstQuery to perform.
*
* Performs gst_pad_query() on the peer of @pad.
*
* The caller is responsible for both the allocation and deallocation of
* the query structure.
*
* Returns: TRUE if the query could be performed. This function returns %FALSE
* if @pad has no peer.
*
* Since: 0.10.15
*/
gboolean
gst_pad_peer_query (GstPad * pad, GstQuery * query)
{
GstPad *peerpad;
gboolean result;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (GST_IS_QUERY (query), FALSE);
GST_OBJECT_LOCK (pad);
GST_DEBUG_OBJECT (pad, "peer query");
peerpad = GST_PAD_PEER (pad);
if (G_UNLIKELY (peerpad == NULL))
goto no_peer;
gst_object_ref (peerpad);
GST_OBJECT_UNLOCK (pad);
result = gst_pad_query (peerpad, query);
gst_object_unref (peerpad);
return result;
/* ERRORS */
no_peer:
{
GST_WARNING_OBJECT (pad, "pad has no peer");
GST_OBJECT_UNLOCK (pad);
return FALSE;
}
}
/**
* gst_pad_query_default:
* @pad: a #GstPad to call the default query handler on.

View file

@ -864,6 +864,7 @@ G_CONST_RETURN GstQueryType*
gst_pad_get_query_types_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);