[0.11] gstreamer: basetransform: Always call ::propose_allocation vfunc

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Jan 18 03:09:37 PST 2012


Module: gstreamer
Branch: 0.11
Commit: b56bef1418e3b660314b276bd829346c8479b073
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=b56bef1418e3b660314b276bd829346c8479b073

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Wed Jan 18 12:07:46 2012 +0100

basetransform: Always call ::propose_allocation vfunc

And only forward the allocation query if we're working in
passthrough mode if no ::propose_allocation is implemented.
In place buffer transformations will change the buffer
content and require explicit handling of all metas.

---

 libs/gst/base/gstbasetransform.c |   15 +++++++--------
 libs/gst/base/gstbasetransform.h |    4 ++--
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c
index 2cb1d85..0883555 100644
--- a/libs/gst/base/gstbasetransform.c
+++ b/libs/gst/base/gstbasetransform.c
@@ -1317,19 +1317,18 @@ gst_base_transform_default_query (GstBaseTransform * trans,
         goto done;
 
       GST_BASE_TRANSFORM_LOCK (trans);
-      passthrough = trans->passthrough || trans->always_in_place;
+      passthrough = trans->passthrough;
       GST_BASE_TRANSFORM_UNLOCK (trans);
 
-      if (passthrough) {
+      GST_DEBUG_OBJECT (trans, "propose allocation values");
+      /* pass the query to the propose_allocation vmethod if any */
+      if (G_LIKELY (klass->propose_allocation)) {
+        ret = klass->propose_allocation (trans, query);
+      } else if (passthrough) {
         GST_DEBUG_OBJECT (trans, "doing passthrough query");
         ret = gst_pad_peer_query (otherpad, query);
       } else {
-        GST_DEBUG_OBJECT (trans, "propose allocation values");
-        /* pass the query to the propose_allocation vmethod if any */
-        if (G_LIKELY (klass->propose_allocation))
-          ret = klass->propose_allocation (trans, query);
-        else
-          ret = FALSE;
+        ret = FALSE;
       }
       GST_DEBUG_OBJECT (trans, "ALLOCATION ret %d, %" GST_PTR_FORMAT, ret,
           query);
diff --git a/libs/gst/base/gstbasetransform.h b/libs/gst/base/gstbasetransform.h
index 16eed7a..cdcbe81 100644
--- a/libs/gst/base/gstbasetransform.h
+++ b/libs/gst/base/gstbasetransform.h
@@ -159,8 +159,8 @@ struct _GstBaseTransform {
  *                  should must chain up to the parent if they didn't handle the
  *                  query
  * @propose_allocation: Propose buffer allocation parameters for upstream elements.
- *                      This function is only called when not operating in
- *                      passthrough mode. The default implementation is NULL.
+ *                      This function must be implemented if the element reads or
+ *                      writes the buffer content. The default implementation is NULL.
  * @decide_allocation: Setup the allocation parameters for allocating output
  *                    buffers. The passed in query contains the result of the
  *                    downstream allocation query. This function is only called



More information about the gstreamer-commits mailing list