From a3d5db491ca95f590f85a6b3b7f60fbd5eb88c09 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 Apr 2012 11:09:50 +0200 Subject: [PATCH] trans: add transform_ip_on_passthrough Add an option to control if transform_ip is called in passthrough mode or not. for elements that don't want to look at the data in passthrough mode, this can avoid some extra processing, mostly in subclasses. --- libs/gst/base/gstbasetransform.c | 5 +++-- libs/gst/base/gstbasetransform.h | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 1b9aad9..b5e30e1 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -394,6 +394,7 @@ gst_base_transform_class_init (GstBaseTransformClass * klass) gobject_class->finalize = gst_base_transform_finalize; klass->passthrough_on_same_caps = FALSE; + klass->transform_ip_on_passthrough = TRUE; klass->transform_caps = GST_DEBUG_FUNCPTR (gst_base_transform_default_transform_caps); @@ -1996,8 +1997,8 @@ no_qos: /* In passthrough mode, give transform_ip a look at the * buffer, without making it writable, or just push the * data through */ - if (bclass->transform_ip) { - GST_DEBUG_OBJECT (trans, "doing passthrough transform"); + if (bclass->transform_ip_on_passthrough && bclass->transform_ip) { + GST_DEBUG_OBJECT (trans, "doing passthrough transform_ip"); ret = bclass->transform_ip (trans, *outbuf); } else { GST_DEBUG_OBJECT (trans, "element is in passthrough"); diff --git a/libs/gst/base/gstbasetransform.h b/libs/gst/base/gstbasetransform.h index 6e8cb49..1ebb9d9 100644 --- a/libs/gst/base/gstbasetransform.h +++ b/libs/gst/base/gstbasetransform.h @@ -107,8 +107,14 @@ struct _GstBaseTransform { /** * GstBaseTransformClass: * @parent_class: Element parent class - * @passthrough_on_same_caps: If set to TRUE, passthrough mode will be + * @passthrough_on_same_caps: If set to %TRUE, passthrough mode will be * automatically enabled if the caps are the same. + * Set to %FALSE by default. + * @transform_ip_on_passthrough: If set to %TRUE, @transform_ip will be called in + * passthrough mode. The passed buffer might not be + * writable. When %FALSE, neither @transform nor + * @transform_ip will be called in passthrough mode. + * Set to %TRUE by default. * @transform_caps: Optional. Given the pad in this direction and the given * caps, what caps are allowed on the other pad in this * element ? @@ -201,6 +207,7 @@ struct _GstBaseTransformClass { /*< public >*/ gboolean passthrough_on_same_caps; + gboolean transform_ip_on_passthrough; /* virtual methods for subclasses */ GstCaps* (*transform_caps) (GstBaseTransform *trans, -- 2.7.4