From 888e6a91a406f9de28abbad62fc3a22e0fa9b0b6 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 26 Aug 2011 12:37:43 +0100 Subject: [PATCH] basetransform: Use GstPadDirection in the query vfunc Wim suggested that using GstPadDirection instead of a GstPad in the arguments to the new query vfunc would be more consistent with the other functions. --- libs/gst/base/gstbasetransform.c | 10 +++++----- libs/gst/base/gstbasetransform.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index debeccb..3325c6d 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -351,7 +351,7 @@ static GstFlowReturn gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query); static gboolean gst_base_transform_default_query (GstBaseTransform * trans, - GstPad * pad, GstQuery * query); + GstPadDirection direction, GstQuery * query); static const GstQueryType *gst_base_transform_query_type (GstPad * pad); /* static guint gst_base_transform_signals[LAST_SIGNAL] = { 0 }; */ @@ -1238,12 +1238,12 @@ failed_configure: static gboolean gst_base_transform_default_query (GstBaseTransform * trans, - GstPad * pad, GstQuery * query) + GstPadDirection direction, GstQuery * query) { gboolean ret = FALSE; GstPad *otherpad; - otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; + otherpad = (direction == GST_PAD_SRC) ? trans->sinkpad : trans->srcpad; switch (GST_QUERY_TYPE (query)) { case GST_QUERY_POSITION:{ @@ -1254,7 +1254,7 @@ gst_base_transform_default_query (GstBaseTransform * trans, gint64 pos; ret = TRUE; - if ((pad == trans->sinkpad) + if ((direction == GST_PAD_SINK) || (trans->priv->last_stop_out == GST_CLOCK_TIME_NONE)) { pos = gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, @@ -1291,7 +1291,7 @@ gst_base_transform_query (GstPad * pad, GstQuery * query) bclass = GST_BASE_TRANSFORM_GET_CLASS (trans); if (bclass->query) - ret = bclass->query (trans, pad, query); + ret = bclass->query (trans, GST_PAD_DIRECTION (pad), query); else ret = gst_pad_query_default (pad, query); diff --git a/libs/gst/base/gstbasetransform.h b/libs/gst/base/gstbasetransform.h index 8914260..84dd0af 100644 --- a/libs/gst/base/gstbasetransform.h +++ b/libs/gst/base/gstbasetransform.h @@ -246,8 +246,8 @@ struct _GstBaseTransformClass { void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer); gboolean (*accept_caps) (GstBaseTransform *trans, GstPadDirection direction, - GstCaps *caps); - gboolean (*query) (GstBaseTransform *trans, GstPad *pad, GstQuery *query); + gboolean (*query) (GstBaseTransform * trans, GstPadDirection direction, + GstQuery * query); /*< private >*/ gpointer _gst_reserved[GST_PADDING_LARGE - 4]; -- 2.7.4