From 3075b3c529391ba2bdab094ef4f2e302d0a6487c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 2 Feb 2012 12:30:14 +0100 Subject: [PATCH] basetransform: simplify code We already checked passthrough a few lines above. --- libs/gst/base/gstbasetransform.c | 43 ++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 56349df..6b3ffbf 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -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 = -- 2.7.4