mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
deinterlace: Directly proxy events/queries to the peer pads
This removes some overhead introduced by the default handlers that need to iterate over the other pads.
This commit is contained in:
parent
5e0a2296e0
commit
049722b680
1 changed files with 43 additions and 6 deletions
|
@ -384,6 +384,7 @@ static void gst_deinterlace_get_property (GObject * self, guint prop_id,
|
||||||
static GstCaps *gst_deinterlace_getcaps (GstPad * pad);
|
static GstCaps *gst_deinterlace_getcaps (GstPad * pad);
|
||||||
static gboolean gst_deinterlace_setcaps (GstPad * pad, GstCaps * caps);
|
static gboolean gst_deinterlace_setcaps (GstPad * pad, GstCaps * caps);
|
||||||
static gboolean gst_deinterlace_sink_event (GstPad * pad, GstEvent * event);
|
static gboolean gst_deinterlace_sink_event (GstPad * pad, GstEvent * event);
|
||||||
|
static gboolean gst_deinterlace_sink_query (GstPad * pad, GstQuery * query);
|
||||||
static GstFlowReturn gst_deinterlace_chain (GstPad * pad, GstBuffer * buffer);
|
static GstFlowReturn gst_deinterlace_chain (GstPad * pad, GstBuffer * buffer);
|
||||||
static GstStateChangeReturn gst_deinterlace_change_state (GstElement * element,
|
static GstStateChangeReturn gst_deinterlace_change_state (GstElement * element,
|
||||||
GstStateChange transition);
|
GstStateChange transition);
|
||||||
|
@ -665,6 +666,8 @@ gst_deinterlace_init (GstDeinterlace * self, GstDeinterlaceClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_deinterlace_setcaps));
|
GST_DEBUG_FUNCPTR (gst_deinterlace_setcaps));
|
||||||
gst_pad_set_getcaps_function (self->sinkpad,
|
gst_pad_set_getcaps_function (self->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_deinterlace_getcaps));
|
GST_DEBUG_FUNCPTR (gst_deinterlace_getcaps));
|
||||||
|
gst_pad_set_query_function (self->sinkpad,
|
||||||
|
GST_DEBUG_FUNCPTR (gst_deinterlace_sink_query));
|
||||||
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
|
||||||
|
|
||||||
self->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
|
self->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
|
||||||
|
@ -1395,7 +1398,7 @@ gst_deinterlace_sink_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
/* fall through */
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
res = gst_pad_event_default (pad, event);
|
res = gst_pad_push_event (self->srcpad, event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
|
@ -1403,7 +1406,7 @@ gst_deinterlace_sink_event (GstPad * pad, GstEvent * event)
|
||||||
GST_DEBUG_OBJECT (self, "Ending still frames");
|
GST_DEBUG_OBJECT (self, "Ending still frames");
|
||||||
self->still_frame_mode = FALSE;
|
self->still_frame_mode = FALSE;
|
||||||
}
|
}
|
||||||
res = gst_pad_event_default (pad, event);
|
res = gst_pad_push_event (self->srcpad, event);
|
||||||
gst_deinterlace_reset_history (self);
|
gst_deinterlace_reset_history (self);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1412,6 +1415,32 @@ gst_deinterlace_sink_event (GstPad * pad, GstEvent * event)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_deinterlace_sink_query (GstPad * pad, GstQuery * query)
|
||||||
|
{
|
||||||
|
GstDeinterlace *self = GST_DEINTERLACE (gst_pad_get_parent (pad));
|
||||||
|
gboolean res = FALSE;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (self, "%s query", GST_QUERY_TYPE_NAME (query));
|
||||||
|
|
||||||
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
|
default:{
|
||||||
|
GstPad *peer = gst_pad_get_peer (self->srcpad);
|
||||||
|
|
||||||
|
if (peer) {
|
||||||
|
res = gst_pad_query (peer, query);
|
||||||
|
gst_object_unref (peer);
|
||||||
|
} else {
|
||||||
|
res = FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_object_unref (self);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
gst_deinterlace_change_state (GstElement * element, GstStateChange transition)
|
gst_deinterlace_change_state (GstElement * element, GstStateChange transition)
|
||||||
{
|
{
|
||||||
|
@ -1457,7 +1486,7 @@ gst_deinterlace_src_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
default:
|
default:
|
||||||
res = gst_pad_event_default (pad, event);
|
res = gst_pad_push_event (self->sinkpad, event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1520,14 +1549,22 @@ gst_deinterlace_src_query (GstPad * pad, GstQuery * query)
|
||||||
}
|
}
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
} else {
|
} else {
|
||||||
res = gst_pad_query_default (pad, query);
|
res = FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:{
|
||||||
res = gst_pad_query_default (pad, query);
|
GstPad *peer = gst_pad_get_peer (self->sinkpad);
|
||||||
|
|
||||||
|
if (peer) {
|
||||||
|
res = gst_pad_query (peer, query);
|
||||||
|
gst_object_unref (peer);
|
||||||
|
} else {
|
||||||
|
res = FALSE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gst_object_unref (self);
|
gst_object_unref (self);
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Reference in a new issue