From e4ee356449f2dfc8918f93725ce615f091da090a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 21 Jul 2011 13:56:11 +0200 Subject: [PATCH] basetrans: remove useless variables from prepare_output_buffer Remove the caps and size from the prepare_output_buffer function. with bufferpools and capsnego done differently, we don't need this in most cases and if we do, we can simply use the transform_size function and get the caps from the srcpad. --- libs/gst/base/gstbasetransform.c | 17 ++--------------- libs/gst/base/gstbasetransform.h | 2 +- plugins/elements/gstcapsfilter.c | 4 ++-- plugins/elements/gstidentity.c | 5 ++--- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 9575603eb8..aa5663b52a 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1409,21 +1409,8 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans, } if (bclass->prepare_output_buffer) { - if (outcaps == NULL) - outcaps = gst_pad_get_current_caps (trans->srcpad); - - GST_DEBUG_OBJECT (trans, - "calling prepare buffer with caps %p %" GST_PTR_FORMAT, outcaps, - outcaps); - ret = - bclass->prepare_output_buffer (trans, in_buf, outsize, outcaps, - out_buf); - - /* get a new ref to the srcpad caps, the prepare_output_buffer function can - * update the pad caps if it wants */ - if (outcaps) - gst_caps_unref (outcaps); - outcaps = gst_pad_get_current_caps (trans->srcpad); + GST_DEBUG_OBJECT (trans, "calling prepare buffer"); + ret = bclass->prepare_output_buffer (trans, in_buf, out_buf); /* FIXME 0.11: * decrease refcount again if vmethod returned refcounted in_buf. This diff --git a/libs/gst/base/gstbasetransform.h b/libs/gst/base/gstbasetransform.h index d81b0055c5..1dd13ce526 100644 --- a/libs/gst/base/gstbasetransform.h +++ b/libs/gst/base/gstbasetransform.h @@ -235,7 +235,7 @@ struct _GstBaseTransformClass { gboolean (*src_event) (GstBaseTransform *trans, GstEvent *event); GstFlowReturn (*prepare_output_buffer) (GstBaseTransform * trans, - GstBuffer *input, gint size, GstCaps *caps, GstBuffer **buf); + GstBuffer *input, GstBuffer **buf); void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer); diff --git a/plugins/elements/gstcapsfilter.c b/plugins/elements/gstcapsfilter.c index 67eca31c10..69f03f0886 100644 --- a/plugins/elements/gstcapsfilter.c +++ b/plugins/elements/gstcapsfilter.c @@ -82,7 +82,7 @@ static gboolean gst_capsfilter_accept_caps (GstBaseTransform * base, static GstFlowReturn gst_capsfilter_transform_ip (GstBaseTransform * base, GstBuffer * buf); static GstFlowReturn gst_capsfilter_prepare_buf (GstBaseTransform * trans, - GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf); + GstBuffer * input, GstBuffer ** buf); static void gst_capsfilter_class_init (GstCapsFilterClass * klass) @@ -326,7 +326,7 @@ gst_capsfilter_transform_ip (GstBaseTransform * base, GstBuffer * buf) */ static GstFlowReturn gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input, - gint size, GstCaps * caps, GstBuffer ** buf) + GstBuffer ** buf) { GstFlowReturn ret = GST_FLOW_OK; diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index c06f384292..78c823630a 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -107,8 +107,7 @@ static gboolean gst_identity_event (GstBaseTransform * trans, GstEvent * event); static GstFlowReturn gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf); static GstFlowReturn gst_identity_prepare_output_buffer (GstBaseTransform - * trans, GstBuffer * in_buf, gint out_size, GstCaps * out_caps, - GstBuffer ** out_buf); + * trans, GstBuffer * in_buf, GstBuffer ** out_buf); static gboolean gst_identity_start (GstBaseTransform * trans); static gboolean gst_identity_stop (GstBaseTransform * trans); @@ -382,7 +381,7 @@ gst_identity_event (GstBaseTransform * trans, GstEvent * event) static GstFlowReturn gst_identity_prepare_output_buffer (GstBaseTransform * trans, - GstBuffer * in_buf, gint out_size, GstCaps * out_caps, GstBuffer ** out_buf) + GstBuffer * in_buf, GstBuffer ** out_buf) { GstIdentity *identity = GST_IDENTITY (trans);