Add function to perform a query on the peer of a pad.
authorWim Taymans <wim.taymans@gmail.com>
Tue, 11 Sep 2007 15:55:50 +0000 (15:55 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 11 Sep 2007 15:55:50 +0000 (15:55 +0000)
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
docs/gst/gstreamer-sections.txt
gst/gstpad.c
gst/gstpad.h

index 775a3e3..ab439ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
index a0e9b3c..01b279e 100644 (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
index 62ec350..f06f4e9 100644 (file)
@@ -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.
index 1b919aa..3e6d942 100644 (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);