shapewipe: Use default query handler where needed

And clean up get_caps code while I'm at it
This commit is contained in:
Edward Hervey 2012-09-12 14:42:07 +02:00
parent 1c64a91a50
commit 8498551692

View file

@ -70,8 +70,8 @@ static gboolean gst_shape_wipe_video_sink_event (GstPad * pad,
GstObject * parent, GstEvent * event); GstObject * parent, GstEvent * event);
static gboolean gst_shape_wipe_video_sink_setcaps (GstShapeWipe * self, static gboolean gst_shape_wipe_video_sink_setcaps (GstShapeWipe * self,
GstCaps * caps); GstCaps * caps);
static GstCaps *gst_shape_wipe_video_sink_getcaps (GstPad * pad, static GstCaps *gst_shape_wipe_video_sink_getcaps (GstShapeWipe * self,
GstCaps * filter); GstPad * pad, GstCaps * filter);
static gboolean gst_shape_wipe_video_sink_query (GstPad * pad, static gboolean gst_shape_wipe_video_sink_query (GstPad * pad,
GstObject * parent, GstQuery * query); GstObject * parent, GstQuery * query);
static GstFlowReturn gst_shape_wipe_mask_sink_chain (GstPad * pad, static GstFlowReturn gst_shape_wipe_mask_sink_chain (GstPad * pad,
@ -80,8 +80,8 @@ static gboolean gst_shape_wipe_mask_sink_event (GstPad * pad,
GstObject * parent, GstEvent * event); GstObject * parent, GstEvent * event);
static gboolean gst_shape_wipe_mask_sink_setcaps (GstShapeWipe * self, static gboolean gst_shape_wipe_mask_sink_setcaps (GstShapeWipe * self,
GstCaps * caps); GstCaps * caps);
static GstCaps *gst_shape_wipe_mask_sink_getcaps (GstPad * pad, static GstCaps *gst_shape_wipe_mask_sink_getcaps (GstShapeWipe * self,
GstCaps * filter); GstPad * pad, GstCaps * filter);
static gboolean gst_shape_wipe_mask_sink_query (GstPad * pad, static gboolean gst_shape_wipe_mask_sink_query (GstPad * pad,
GstObject * parent, GstQuery * query); GstObject * parent, GstQuery * query);
static gboolean gst_shape_wipe_src_event (GstPad * pad, GstObject * parent, static gboolean gst_shape_wipe_src_event (GstPad * pad, GstObject * parent,
@ -324,9 +324,9 @@ invalid_caps:
} }
static GstCaps * static GstCaps *
gst_shape_wipe_video_sink_getcaps (GstPad * pad, GstCaps * filter) gst_shape_wipe_video_sink_getcaps (GstShapeWipe * self, GstPad * pad,
GstCaps * filter)
{ {
GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad));
GstCaps *templ, *ret, *tmp; GstCaps *templ, *ret, *tmp;
if (gst_pad_has_current_caps (pad)) if (gst_pad_has_current_caps (pad))
@ -406,9 +406,6 @@ gst_shape_wipe_video_sink_getcaps (GstPad * pad, GstCaps * filter)
ret = intersection; ret = intersection;
} }
done: done:
gst_object_unref (self);
GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret); GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret);
return ret; return ret;
@ -448,9 +445,9 @@ done:
} }
static GstCaps * static GstCaps *
gst_shape_wipe_mask_sink_getcaps (GstPad * pad, GstCaps * filter) gst_shape_wipe_mask_sink_getcaps (GstShapeWipe * self, GstPad * pad,
GstCaps * filter)
{ {
GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad));
GstCaps *ret, *tmp; GstCaps *ret, *tmp;
guint i, n; guint i, n;
@ -526,8 +523,6 @@ gst_shape_wipe_mask_sink_getcaps (GstPad * pad, GstCaps * filter)
} }
done: done:
gst_object_unref (self);
GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret); GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret);
return ret; return ret;
@ -628,7 +623,7 @@ static gboolean
gst_shape_wipe_video_sink_query (GstPad * pad, GstObject * parent, gst_shape_wipe_video_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query) GstQuery * query)
{ {
GstShapeWipe *self = GST_SHAPE_WIPE (parent); GstShapeWipe *self = (GstShapeWipe *) parent;
gboolean ret; gboolean ret;
GST_LOG_OBJECT (pad, "Handling query of type '%s'", GST_LOG_OBJECT (pad, "Handling query of type '%s'",
@ -640,14 +635,14 @@ gst_shape_wipe_video_sink_query (GstPad * pad, GstObject * parent,
GstCaps *filter, *caps; GstCaps *filter, *caps;
gst_query_parse_caps (query, &filter); gst_query_parse_caps (query, &filter);
caps = gst_shape_wipe_video_sink_getcaps (pad, filter); caps = gst_shape_wipe_video_sink_getcaps (self, pad, filter);
gst_query_set_caps_result (query, caps); gst_query_set_caps_result (query, caps);
gst_caps_unref (caps); gst_caps_unref (caps);
ret = TRUE; ret = TRUE;
break; break;
} }
default: default:
ret = gst_pad_peer_query (self->srcpad, query); ret = gst_pad_query_default (pad, parent, query);
break; break;
} }
@ -1086,6 +1081,7 @@ static gboolean
gst_shape_wipe_mask_sink_query (GstPad * pad, GstObject * parent, gst_shape_wipe_mask_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query) GstQuery * query)
{ {
GstShapeWipe *self = GST_SHAPE_WIPE (parent);
gboolean ret; gboolean ret;
GST_LOG_OBJECT (pad, "Handling query of type '%s'", GST_LOG_OBJECT (pad, "Handling query of type '%s'",
@ -1097,7 +1093,7 @@ gst_shape_wipe_mask_sink_query (GstPad * pad, GstObject * parent,
GstCaps *filter, *caps; GstCaps *filter, *caps;
gst_query_parse_caps (query, &filter); gst_query_parse_caps (query, &filter);
caps = gst_shape_wipe_mask_sink_getcaps (pad, filter); caps = gst_shape_wipe_mask_sink_getcaps (self, pad, filter);
gst_query_set_caps_result (query, caps); gst_query_set_caps_result (query, caps);
gst_caps_unref (caps); gst_caps_unref (caps);
ret = TRUE; ret = TRUE;