libs/gst/base/gstbasetransform.*: Add vmethod that is called before we start the transform and which can be used to c...

Original commit message from CVS:
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_prepare_output_buffer),
(gst_base_transform_getrange), (gst_base_transform_chain):
* libs/gst/base/gstbasetransform.h:
Add vmethod that is called before we start the transform and which can
be used to configure the transform, such as dynamic properties.
This commit is contained in:
Wim Taymans 2008-12-08 18:35:44 +00:00
parent e716f92dd7
commit b90bef8ee5
3 changed files with 27 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2008-12-08 Wim Taymans <wim.taymans@collabora.co.uk>
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_prepare_output_buffer),
(gst_base_transform_getrange), (gst_base_transform_chain):
* libs/gst/base/gstbasetransform.h:
Add vmethod that is called before we start the transform and which can
be used to configure the transform, such as dynamic properties.
2008-12-05 David Schleef <ds@schleef.org>
* gst/gst.c:

View file

@ -1185,6 +1185,7 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
/* only discard it when the input was not writable, otherwise, we reuse
* the input buffer. */
discard = gst_buffer_is_writable (in_buf);
GST_DEBUG_OBJECT (trans, "discard: %d", discard);
} else {
GST_DEBUG_OBJECT (trans, "getting output size for copy transform");
/* copy transform, figure out the output size */
@ -1948,6 +1949,7 @@ gst_base_transform_getrange (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buffer)
{
GstBaseTransform *trans;
GstBaseTransformClass *klass;
GstFlowReturn ret;
GstBuffer *inbuf;
@ -1957,6 +1959,10 @@ gst_base_transform_getrange (GstPad * pad, guint64 offset,
if (G_UNLIKELY (ret != GST_FLOW_OK))
goto pull_error;
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (klass->before_transform)
klass->before_transform (trans, inbuf);
GST_BASE_TRANSFORM_LOCK (trans);
ret = gst_base_transform_handle_buffer (trans, inbuf, buffer);
GST_BASE_TRANSFORM_UNLOCK (trans);
@ -1979,6 +1985,7 @@ static GstFlowReturn
gst_base_transform_chain (GstPad * pad, GstBuffer * buffer)
{
GstBaseTransform *trans;
GstBaseTransformClass *klass;
GstFlowReturn ret;
GstClockTime last_stop = GST_CLOCK_TIME_NONE;
GstBuffer *outbuf = NULL;
@ -1993,6 +2000,10 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer)
last_stop = GST_BUFFER_TIMESTAMP (buffer);
}
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (klass->before_transform)
klass->before_transform (trans, buffer);
/* protect transform method and concurrent buffer alloc */
GST_BASE_TRANSFORM_LOCK (trans);
ret = gst_base_transform_handle_buffer (trans, buffer, &outbuf);

View file

@ -182,6 +182,10 @@ struct _GstBaseTransform {
* analysis can return a subbuffer or even just
* increment the reference to the input buffer (if in
* passthrough mode)
* @before_transform: Optional. Since 0.10.22
* This method is called right before the base class will
* start processing. Dynamic properties or other delayed
* configuration could be performed in this method.
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum either @transform or @transform_ip need to be overridden.
@ -231,8 +235,10 @@ struct _GstBaseTransformClass {
/* src event */
gboolean (*src_event) (GstBaseTransform *trans, GstEvent *event);
void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE - 1];
gpointer _gst_reserved[GST_PADDING_LARGE - 2];
};
GType gst_base_transform_get_type (void);