basetransform: simplify code

We already checked passthrough a few lines above.
This commit is contained in:
Wim Taymans 2012-02-02 12:30:14 +01:00
parent d8c12ceb2b
commit 3075b3c529

View 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;
GstCaps *incaps, *outcaps;
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;
/* 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 =