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.
This commit is contained in:
Sjoerd Simons 2011-08-26 12:37:43 +01:00
parent 63a21ca8b1
commit 888e6a91a4
2 changed files with 7 additions and 7 deletions

View file

@ -351,7 +351,7 @@ static GstFlowReturn gst_base_transform_buffer_alloc (GstPad * pad,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query); static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query);
static gboolean gst_base_transform_default_query (GstBaseTransform * trans, 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 const GstQueryType *gst_base_transform_query_type (GstPad * pad);
/* static guint gst_base_transform_signals[LAST_SIGNAL] = { 0 }; */ /* static guint gst_base_transform_signals[LAST_SIGNAL] = { 0 }; */
@ -1238,12 +1238,12 @@ failed_configure:
static gboolean static gboolean
gst_base_transform_default_query (GstBaseTransform * trans, gst_base_transform_default_query (GstBaseTransform * trans,
GstPad * pad, GstQuery * query) GstPadDirection direction, GstQuery * query)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
GstPad *otherpad; GstPad *otherpad;
otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; otherpad = (direction == GST_PAD_SRC) ? trans->sinkpad : trans->srcpad;
switch (GST_QUERY_TYPE (query)) { switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:{ case GST_QUERY_POSITION:{
@ -1254,7 +1254,7 @@ gst_base_transform_default_query (GstBaseTransform * trans,
gint64 pos; gint64 pos;
ret = TRUE; ret = TRUE;
if ((pad == trans->sinkpad) if ((direction == GST_PAD_SINK)
|| (trans->priv->last_stop_out == GST_CLOCK_TIME_NONE)) { || (trans->priv->last_stop_out == GST_CLOCK_TIME_NONE)) {
pos = pos =
gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, 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); bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (bclass->query) if (bclass->query)
ret = bclass->query (trans, pad, query); ret = bclass->query (trans, GST_PAD_DIRECTION (pad), query);
else else
ret = gst_pad_query_default (pad, query); ret = gst_pad_query_default (pad, query);

View file

@ -246,8 +246,8 @@ struct _GstBaseTransformClass {
void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer); void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer);
gboolean (*accept_caps) (GstBaseTransform *trans, GstPadDirection direction, gboolean (*accept_caps) (GstBaseTransform *trans, GstPadDirection direction,
GstCaps *caps); gboolean (*query) (GstBaseTransform * trans, GstPadDirection direction,
gboolean (*query) (GstBaseTransform *trans, GstPad *pad, GstQuery *query); GstQuery * query);
/*< private >*/ /*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE - 4]; gpointer _gst_reserved[GST_PADDING_LARGE - 4];