+2005-09-12 Jan Schmidt <thaytan@mad.scientist.com>
+
+ * gst/base/gstbasetransform.c: (gst_base_transform_class_init),
+ (gst_base_transform_prepare_output_buf),
+ (gst_base_transform_handle_buffer):
+ * gst/elements/gstcapsfilter.c: (gst_capsfilter_transform_ip),
+ (gst_capsfilter_prepare_buf):
+ Remove the requirement for sub-classes to call the parent
+ implementation of prepare_output_buffer with a wrapper function.
+
+ * gst/gsttaglist.h:
+ * gst/gsttagsetter.h:
+ Fix #define wrapper
+
2005-09-11 Stefan Kost <ensonic@users.sf.net>
* docs/gst/gstreamer-sections.txt:
* </para></listitem>
* </itemizedlist>
*
- * <itemizedlist><title>Retrictions on sub-class behaviour</title>
- * <listitem><para>
- * Sub-classes which override the prepare_output_buffer function need to call
- * the parent implementation if they allocate a new buffer, which will copy
- * buffer flags onto the new buffer.
- * </para></listitem>
- * </itemizedlist>
- *
*/
#ifdef HAVE_CONFIG_H
static void gst_base_transform_class_init (GstBaseTransformClass * klass);
static void gst_base_transform_init (GstBaseTransform * trans,
GstBaseTransformClass * klass);
-static GstFlowReturn gst_base_transform_default_prepare_buf (GstBaseTransform *
+static GstFlowReturn gst_base_transform_prepare_output_buf (GstBaseTransform *
trans, GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf);
GType
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_base_transform_change_state);
- klass->prepare_output_buffer =
- GST_DEBUG_FUNCPTR (gst_base_transform_default_prepare_buf);
klass->passthrough_on_same_caps = FALSE;
}
/* Allocate a buffer using gst_pad_alloc_buffer */
static GstFlowReturn
-gst_base_transform_default_prepare_buf (GstBaseTransform * trans,
+gst_base_transform_prepare_output_buf (GstBaseTransform * trans,
GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf)
{
GstBaseTransformClass *bclass;
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
+ if (bclass->prepare_output_buffer) {
+ ret = bclass->prepare_output_buffer (trans, input, size, caps, buf);
+ if (ret != GST_FLOW_OK)
+ return ret;
+ }
+
/* See if we want to prepare the buffer for in place output */
if (*buf == NULL && GST_BUFFER_SIZE (input) == size && bclass->transform_ip) {
if (gst_buffer_is_writable (input)) {
- /* Input buffer is already writable, just ref and return it */
- *buf = input;
- gst_buffer_ref (input);
- gst_caps_replace (&GST_BUFFER_CAPS (*buf), caps);
+ if (trans->have_same_caps) {
+ /* Input buffer is already writable and caps are the same, just ref and return it */
+ *buf = input;
+ gst_buffer_ref (input);
+ } else {
+ /* Writable buffer, but need to change caps => subbuffer */
+ *buf = gst_buffer_create_sub (input, 0, GST_BUFFER_SIZE (input));
+ gst_caps_replace (&GST_BUFFER_CAPS (*buf), caps);
+ }
return GST_FLOW_OK;
} else {
* the old buffer. We will therefore delay the reconfiguration of the
* element until we have processed this last buffer. */
trans->delay_configure = TRUE;
- ret = bclass->prepare_output_buffer (trans, inbuf,
+ ret = gst_base_transform_prepare_output_buf (trans, inbuf,
GST_BUFFER_SIZE (inbuf), GST_PAD_CAPS (trans->srcpad), outbuf);
trans->delay_configure = FALSE;
if (G_UNLIKELY (ret != GST_FLOW_OK))
* element until we have processed this last buffer. */
trans->delay_configure = TRUE;
/* no in place transform, get buffer, this might renegotiate. */
- ret = bclass->prepare_output_buffer (trans, inbuf, out_size,
+ ret = gst_base_transform_prepare_output_buf (trans, inbuf, out_size,
GST_PAD_CAPS (trans->srcpad), outbuf);
trans->delay_configure = FALSE;
}
}
- return GST_BASE_TRANSFORM_CLASS (parent_class)->
- prepare_output_buffer (trans, input, size, caps, buf);
+ return GST_FLOW_OK;
}
*/
-#ifndef __GST_TAG_H__
-#define __GST_TAG_H__
+#ifndef __GST_TAGLIST_H__
+#define __GST_TAGLIST_H__
#include <gst/gststructure.h>
G_END_DECLS
-#endif /* __GST_EVENT_H__ */
+#endif /* __GST_TAGLIST_H__ */
* Boston, MA 02111-1307, USA.
*/
-#ifndef __GST_TAG_INTERFACE_H__
-#define __GST_TAG_INTERFACE_H__
+#ifndef __GST_TAG_SETTER_H__
+#define __GST_TAG_SETTER_H__
#include <gst/gst.h>
G_END_DECLS
-#endif /* __GST_TAG_INTERFACE_H__ */
+#endif /* __GST_TAG_SETTER_H__ */
* </para></listitem>
* </itemizedlist>
*
- * <itemizedlist><title>Retrictions on sub-class behaviour</title>
- * <listitem><para>
- * Sub-classes which override the prepare_output_buffer function need to call
- * the parent implementation if they allocate a new buffer, which will copy
- * buffer flags onto the new buffer.
- * </para></listitem>
- * </itemizedlist>
- *
*/
#ifdef HAVE_CONFIG_H
static void gst_base_transform_class_init (GstBaseTransformClass * klass);
static void gst_base_transform_init (GstBaseTransform * trans,
GstBaseTransformClass * klass);
-static GstFlowReturn gst_base_transform_default_prepare_buf (GstBaseTransform *
+static GstFlowReturn gst_base_transform_prepare_output_buf (GstBaseTransform *
trans, GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf);
GType
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_base_transform_change_state);
- klass->prepare_output_buffer =
- GST_DEBUG_FUNCPTR (gst_base_transform_default_prepare_buf);
klass->passthrough_on_same_caps = FALSE;
}
/* Allocate a buffer using gst_pad_alloc_buffer */
static GstFlowReturn
-gst_base_transform_default_prepare_buf (GstBaseTransform * trans,
+gst_base_transform_prepare_output_buf (GstBaseTransform * trans,
GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf)
{
GstBaseTransformClass *bclass;
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
+ if (bclass->prepare_output_buffer) {
+ ret = bclass->prepare_output_buffer (trans, input, size, caps, buf);
+ if (ret != GST_FLOW_OK)
+ return ret;
+ }
+
/* See if we want to prepare the buffer for in place output */
if (*buf == NULL && GST_BUFFER_SIZE (input) == size && bclass->transform_ip) {
if (gst_buffer_is_writable (input)) {
- /* Input buffer is already writable, just ref and return it */
- *buf = input;
- gst_buffer_ref (input);
- gst_caps_replace (&GST_BUFFER_CAPS (*buf), caps);
+ if (trans->have_same_caps) {
+ /* Input buffer is already writable and caps are the same, just ref and return it */
+ *buf = input;
+ gst_buffer_ref (input);
+ } else {
+ /* Writable buffer, but need to change caps => subbuffer */
+ *buf = gst_buffer_create_sub (input, 0, GST_BUFFER_SIZE (input));
+ gst_caps_replace (&GST_BUFFER_CAPS (*buf), caps);
+ }
return GST_FLOW_OK;
} else {
* the old buffer. We will therefore delay the reconfiguration of the
* element until we have processed this last buffer. */
trans->delay_configure = TRUE;
- ret = bclass->prepare_output_buffer (trans, inbuf,
+ ret = gst_base_transform_prepare_output_buf (trans, inbuf,
GST_BUFFER_SIZE (inbuf), GST_PAD_CAPS (trans->srcpad), outbuf);
trans->delay_configure = FALSE;
if (G_UNLIKELY (ret != GST_FLOW_OK))
* element until we have processed this last buffer. */
trans->delay_configure = TRUE;
/* no in place transform, get buffer, this might renegotiate. */
- ret = bclass->prepare_output_buffer (trans, inbuf, out_size,
+ ret = gst_base_transform_prepare_output_buf (trans, inbuf, out_size,
GST_PAD_CAPS (trans->srcpad), outbuf);
trans->delay_configure = FALSE;
}
}
- return GST_BASE_TRANSFORM_CLASS (parent_class)->
- prepare_output_buffer (trans, input, size, caps, buf);
+ return GST_FLOW_OK;
}