pad: add flag to proxy allocation query
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 2 Feb 2012 11:05:37 +0000 (12:05 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 2 Feb 2012 11:05:37 +0000 (12:05 +0100)
Add a flag to force the default query handler to forward the allocation query
instead of discarding it.
Reorder the pad flags a bit.

gst/gstpad.c
gst/gstpad.h

index 9bd9d56..f900acf 100644 (file)
@@ -2769,13 +2769,15 @@ done:
 gboolean
 gst_pad_query_default (GstPad * pad, GstObject * parent, GstQuery * query)
 {
-  gboolean forward = TRUE, ret = FALSE;
+  gboolean forward, ret = FALSE;
 
   switch (GST_QUERY_TYPE (query)) {
     case GST_QUERY_SCHEDULING:
-    case GST_QUERY_ALLOCATION:
       forward = FALSE;
       break;
+    case GST_QUERY_ALLOCATION:
+      forward = GST_PAD_IS_PROXY_ALLOCATION (pad);
+      break;
     case GST_QUERY_ACCEPT_CAPS:
       ret = gst_pad_query_accept_caps_default (pad, query);
       forward = FALSE;
@@ -2792,6 +2794,7 @@ gst_pad_query_default (GstPad * pad, GstObject * parent, GstQuery * query)
     case GST_QUERY_RATE:
     case GST_QUERY_CONVERT:
     default:
+      forward = TRUE;
       break;
   }
 
index 26b2d3f..c71281e 100644 (file)
@@ -587,10 +587,11 @@ typedef gboolean  (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **
  * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked
  * @GST_PAD_FLAG_FLUSHING: is pad refusing buffers
  * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event
+ * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling
+ *                       into the pad callbacks.
  * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
  *                            The flag has to be unset manually after
  *                            reconfiguration happened.
- *                            Since: 0.10.34.
  * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events
  * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps this means that once the
  *                      caps are set on the pad, the caps query function only
@@ -598,8 +599,9 @@ typedef gboolean  (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **
  * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward
  *                      all events and queries to the internally linked pads
  *                      instead of discarding them.
- * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling
- *                       into the pad callbacks.
+ * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward
+ *                      allocation queries to the internally linked pads
+ *                      instead of discarding them.
  * @GST_PAD_FLAG_LAST: offset to define more flags
  *
  * Pad state flags
@@ -608,11 +610,12 @@ typedef enum {
   GST_PAD_FLAG_BLOCKED          = (GST_OBJECT_FLAG_LAST << 0),
   GST_PAD_FLAG_FLUSHING         = (GST_OBJECT_FLAG_LAST << 1),
   GST_PAD_FLAG_BLOCKING         = (GST_OBJECT_FLAG_LAST << 2),
-  GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 3),
-  GST_PAD_FLAG_PENDING_EVENTS   = (GST_OBJECT_FLAG_LAST << 4),
-  GST_PAD_FLAG_FIXED_CAPS       = (GST_OBJECT_FLAG_LAST << 5),
-  GST_PAD_FLAG_PROXY_CAPS       = (GST_OBJECT_FLAG_LAST << 6),
-  GST_PAD_FLAG_NEED_PARENT      = (GST_OBJECT_FLAG_LAST << 7),
+  GST_PAD_FLAG_NEED_PARENT      = (GST_OBJECT_FLAG_LAST << 3),
+  GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 4),
+  GST_PAD_FLAG_PENDING_EVENTS   = (GST_OBJECT_FLAG_LAST << 5),
+  GST_PAD_FLAG_FIXED_CAPS       = (GST_OBJECT_FLAG_LAST << 6),
+  GST_PAD_FLAG_PROXY_CAPS       = (GST_OBJECT_FLAG_LAST << 7),
+  GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 8),
   /* padding */
   GST_PAD_FLAG_LAST        = (GST_OBJECT_FLAG_LAST << 16)
 } GstPadFlags;
@@ -756,6 +759,10 @@ struct _GstPadClass {
 #define GST_PAD_SET_PROXY_CAPS(pad)     (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
 #define GST_PAD_UNSET_PROXY_CAPS(pad)   (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS))
 
+#define GST_PAD_IS_PROXY_ALLOCATION(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
+#define GST_PAD_SET_PROXY_ALLOCATION(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
+#define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
+
 /**
  * GST_PAD_GET_STREAM_LOCK:
  * @pad: a #GstPad