libs/gst/base/gstbasetransform.c: Add debug info.

Original commit message from CVS:
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_transform_caps),
(gst_base_transform_prepare_output_buffer):
Add debug info.
When a buffer is writable, its metadata is also writable so we don't
need to subbuffer (which then makes the buffer not-writable anymore).
This commit is contained in:
Wim Taymans 2008-06-20 08:14:23 +00:00
parent 778767a6b9
commit 1380508f53
2 changed files with 27 additions and 21 deletions

View file

@ -1,3 +1,13 @@
2008-06-20 Wim Taymans <wim.taymans@collabora.co.uk>
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_transform_caps),
(gst_base_transform_prepare_output_buffer):
Add debug info.
When a buffer is writable, its metadata is also writable so we don't
need to subbuffer (which then makes the buffer not-writable anymore).
=== release 0.10.20 ===
2008-06-18 Jan Schmidt <jan.schmidt@sun.com>

View file

@ -324,6 +324,8 @@ gst_base_transform_class_init (GstBaseTransformClass * klass)
GST_DEBUG_CATEGORY_INIT (gst_base_transform_debug, "basetransform", 0,
"basetransform element");
GST_DEBUG ("gst_base_transform_class_init");
g_type_class_add_private (klass, sizeof (GstBaseTransformPrivate));
parent_class = g_type_class_peek_parent (klass);
@ -405,8 +407,10 @@ gst_base_transform_init (GstBaseTransform * trans,
GST_DEBUG_OBJECT (trans, "setting in_place TRUE");
trans->always_in_place = TRUE;
if (bclass->transform_ip == NULL)
if (bclass->transform_ip == NULL) {
GST_DEBUG_OBJECT (trans, "setting passthrough TRUE");
trans->passthrough = TRUE;
}
}
}
@ -459,6 +463,8 @@ gst_base_transform_transform_caps (GstBaseTransform * trans,
* gst_caps_append (ret, temp);
*/
gst_caps_merge (ret, temp);
GST_DEBUG_OBJECT (trans, " merged[%d]: %" GST_PTR_FORMAT, i, ret);
}
GST_DEBUG_OBJECT (trans, "merged: (%d)", gst_caps_get_size (ret));
/* now simplify caps
@ -930,29 +936,19 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
if (*out_buf == NULL && GST_BUFFER_SIZE (in_buf) == out_size
&& bclass->transform_ip) {
if (gst_buffer_is_writable (in_buf)) {
if (trans->have_same_caps &&
(trans->priv->gap_aware
|| !GST_BUFFER_FLAG_IS_SET (in_buf, GST_BUFFER_FLAG_GAP))) {
/* Input buffer is already writable, caps are the same and it's not necessary
* to change the GAP flag, return input as output buffer.
* We don't take an additional ref since that would make the output buffer
* not writable anymore. Caller should be prepared to deal with proper
* refcounting of input/output buffers. */
*out_buf = in_buf;
GST_LOG_OBJECT (trans, "reuse input buffer");
} else {
/* Writable buffer, but need to change caps or flags => subbuffer */
*out_buf = gst_buffer_create_sub (in_buf, 0, GST_BUFFER_SIZE (in_buf));
*out_buf = in_buf;
GST_LOG_OBJECT (trans, "reuse input buffer");
/* the buffer is writable, this also means the metadata is writable and we
* can update the caps and flags when we need to. */
if (!trans->have_same_caps)
/* we need to change the caps */
gst_caps_replace (&GST_BUFFER_CAPS (*out_buf), out_caps);
/* Unset the GAP flag if the element is _not_ GAP aware. Otherwise
* it might create an output buffer that does not contain neutral data
* but still has the GAP flag on it! */
if (!trans->priv->gap_aware)
GST_BUFFER_FLAG_UNSET (*out_buf, GST_BUFFER_FLAG_GAP);
/* clear the GAP flag when the subclass does not understand it */
if (!trans->priv->gap_aware)
GST_BUFFER_FLAG_UNSET (*out_buf, GST_BUFFER_FLAG_GAP);
GST_LOG_OBJECT (trans, "created sub-buffer of input buffer");
}
/* we are done now */
goto done;
} else {