basetransform: simplify code
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 2 Feb 2012 11:30:14 +0000 (12:30 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 2 Feb 2012 11:30:14 +0000 (12:30 +0100)
We already checked passthrough a few lines above.

libs/gst/base/gstbasetransform.c

index 56349df..6b3ffbf 100644 (file)
@@ -1433,42 +1433,37 @@ default_prepare_output_buffer (GstBaseTransform * trans,
       GST_DEBUG_OBJECT (trans, "using pool alloc");
       ret = gst_buffer_pool_acquire_buffer (priv->pool, outbuf, NULL);
     } else {
+      gboolean want_in_place;
       gsize insize, outsize;
       gboolean res;
 
       /* no pool, we need to figure out the size of the output buffer first */
       insize = gst_buffer_get_size (inbuf);
 
-      if (trans->passthrough) {
-        GST_DEBUG_OBJECT (trans, "doing passthrough alloc");
-        /* passthrough, the output size is the same as the input size. */
+      want_in_place = (bclass->transform_ip != NULL)
+          && trans->always_in_place;
+
+      if (want_in_place) {
+        GST_DEBUG_OBJECT (trans, "doing inplace alloc");
+        /* we alloc a buffer of the same size as the input */
         outsize = insize;
       } else {
-        gboolean want_in_place = (bclass->transform_ip != NULL)
-            && trans->always_in_place;
-
-        if (want_in_place) {
-          GST_DEBUG_OBJECT (trans, "doing inplace alloc");
-          /* we alloc a buffer of the same size as the input */
-          outsize = insize;
-        } else {
-          GstCaps *incaps, *outcaps;
+        GstCaps *incaps, *outcaps;
 
-          /* else use the transform function to get the size */
-          incaps = gst_pad_get_current_caps (trans->sinkpad);
-          outcaps = gst_pad_get_current_caps (trans->srcpad);
+        /* else use the transform function to get the size */
+        incaps = gst_pad_get_current_caps (trans->sinkpad);
+        outcaps = gst_pad_get_current_caps (trans->srcpad);
 
-          GST_DEBUG_OBJECT (trans, "getting output size for alloc");
-          /* copy transform, figure out the output size */
-          res = gst_base_transform_transform_size (trans,
-              GST_PAD_SINK, incaps, insize, outcaps, &outsize);
+        GST_DEBUG_OBJECT (trans, "getting output size for alloc");
+        /* copy transform, figure out the output size */
+        res = gst_base_transform_transform_size (trans,
+            GST_PAD_SINK, incaps, insize, outcaps, &outsize);
 
-          gst_caps_unref (incaps);
-          gst_caps_unref (outcaps);
+        gst_caps_unref (incaps);
+        gst_caps_unref (outcaps);
 
-          if (!res)
-            goto unknown_size;
-        }
+        if (!res)
+          goto unknown_size;
       }
       GST_DEBUG_OBJECT (trans, "doing alloc of size %" G_GSIZE_FORMAT, outsize);
       *outbuf =