mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
basetransform: simplify code
We already checked passthrough a few lines above.
This commit is contained in:
parent
d8c12ceb2b
commit
3075b3c529
1 changed files with 19 additions and 24 deletions
|
@ -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 =
|
||||||
|
|
Loading…
Reference in a new issue