From 0d3299c63ba5a4d6aa1fc59af3a6849f47b7e39d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 11 Sep 2007 15:55:50 +0000 Subject: [PATCH] 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() --- ChangeLog | 8 +++++++ docs/gst/gstreamer-sections.txt | 1 + gst/gstpad.c | 50 +++++++++++++++++++++++++++++++++++++++++ gst/gstpad.h | 1 + 4 files changed, 60 insertions(+) diff --git a/ChangeLog b/ChangeLog index 775a3e3..ab439ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-09-11 Wim Taymans + + * 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 * tests/check/gst/gstsystemclock.c: diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index a0e9b3c..01b279e 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -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 diff --git a/gst/gstpad.c b/gst/gstpad.c index 62ec350..f06f4e9 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -3065,6 +3065,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. * @query: the #GstQuery to handle. diff --git a/gst/gstpad.h b/gst/gstpad.h index 1b919aa..3e6d942 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -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); -- 2.7.4