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"); GST_DEBUG_OBJECT (trans, "using pool alloc");
ret = gst_buffer_pool_acquire_buffer (priv->pool, outbuf, NULL); ret = gst_buffer_pool_acquire_buffer (priv->pool, outbuf, NULL);
} else { } else {
gboolean want_in_place;
gsize insize, outsize; gsize insize, outsize;
gboolean res; gboolean res;
/* no pool, we need to figure out the size of the output buffer first */ /* no pool, we need to figure out the size of the output buffer first */
insize = gst_buffer_get_size (inbuf); insize = gst_buffer_get_size (inbuf);
if (trans->passthrough) { want_in_place = (bclass->transform_ip != NULL)
GST_DEBUG_OBJECT (trans, "doing passthrough alloc"); && trans->always_in_place;
/* passthrough, the output size is the same as the input size. */
if (want_in_place) {
GST_DEBUG_OBJECT (trans, "doing inplace alloc");
/* we alloc a buffer of the same size as the input */
outsize = insize; outsize = insize;
} else { } else {
gboolean want_in_place = (bclass->transform_ip != NULL) GstCaps *incaps, *outcaps;
&& trans->always_in_place;
if (want_in_place) { /* else use the transform function to get the size */
GST_DEBUG_OBJECT (trans, "doing inplace alloc"); incaps = gst_pad_get_current_caps (trans->sinkpad);
/* we alloc a buffer of the same size as the input */ outcaps = gst_pad_get_current_caps (trans->srcpad);
outsize = insize;
} else {
GstCaps *incaps, *outcaps;
/* else use the transform function to get the size */ GST_DEBUG_OBJECT (trans, "getting output size for alloc");
incaps = gst_pad_get_current_caps (trans->sinkpad); /* copy transform, figure out the output size */
outcaps = gst_pad_get_current_caps (trans->srcpad); res = gst_base_transform_transform_size (trans,
GST_PAD_SINK, incaps, insize, outcaps, &outsize);
GST_DEBUG_OBJECT (trans, "getting output size for alloc"); gst_caps_unref (incaps);
/* copy transform, figure out the output size */ gst_caps_unref (outcaps);
res = gst_base_transform_transform_size (trans,
GST_PAD_SINK, incaps, insize, outcaps, &outsize);
gst_caps_unref (incaps); if (!res)
gst_caps_unref (outcaps); goto unknown_size;
if (!res)
goto unknown_size;
}
} }
GST_DEBUG_OBJECT (trans, "doing alloc of size %" G_GSIZE_FORMAT, outsize); GST_DEBUG_OBJECT (trans, "doing alloc of size %" G_GSIZE_FORMAT, outsize);
*outbuf = *outbuf =