diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2008-09-01 13:23:03 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2008-09-01 13:23:03 +0000 |
commit | 7d9e7b68b97e8ff68f5c596676173cfb020686e5 (patch) | |
tree | d4f952d0f2ea376d4c54afa9287dd5efdd1975bb | |
parent | 16e70c80aeb3d12f534651c59a35db615ee8cc0a (diff) | |
download | gst-plugins-bad-7d9e7b68b97e8ff68f5c596676173cfb020686e5.tar.gz gst-plugins-bad-7d9e7b68b97e8ff68f5c596676173cfb020686e5.tar.bz2 gst-plugins-bad-7d9e7b68b97e8ff68f5c596676173cfb020686e5.zip |
gst/selector/gstinputselector.c: Reuse the get_linked_pads for both source and sinkpads because they are the same.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_input_selector_init),
(gst_input_selector_event), (gst_input_selector_query):
Reuse the get_linked_pads for both source and sinkpads because they are
the same.
Implement a custum event handler and get the internally linked pad
directly instead of relying on the default (slower) implementation.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gst/selector/gstinputselector.c | 40 |
2 files changed, 33 insertions, 16 deletions
@@ -1,3 +1,12 @@ +2008-09-01 Wim Taymans <wim.taymans@collabora.co.uk> + + * gst/selector/gstinputselector.c: (gst_input_selector_init), + (gst_input_selector_event), (gst_input_selector_query): + Reuse the get_linked_pads for both source and sinkpads because they are + the same. + Implement a custum event handler and get the internally linked pad + directly instead of relying on the default (slower) implementation. + 2008-08-31 Sebastian Dröge <sebastian.droege@collabora.co.uk> * ext/celt/gstceltdec.c: (celt_dec_chain_parse_data): diff --git a/gst/selector/gstinputselector.c b/gst/selector/gstinputselector.c index 2b557e0c..f66bf191 100644 --- a/gst/selector/gstinputselector.c +++ b/gst/selector/gstinputselector.c @@ -656,8 +656,8 @@ static void gst_input_selector_release_pad (GstElement * element, GstPad * pad); static GstStateChangeReturn gst_input_selector_change_state (GstElement * element, GstStateChange transition); -static GList *gst_input_selector_get_linked_pads (GstPad * pad); static GstCaps *gst_input_selector_getcaps (GstPad * pad); +static gboolean gst_input_selector_event (GstPad * pad, GstEvent * event); static gboolean gst_input_selector_query (GstPad * pad, GstQuery * query); static gint64 gst_input_selector_block (GstInputSelector * self); static void gst_input_selector_switch (GstInputSelector * self, @@ -807,11 +807,13 @@ gst_input_selector_init (GstInputSelector * sel) { sel->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_pad_set_internal_link_function (sel->srcpad, - GST_DEBUG_FUNCPTR (gst_input_selector_get_linked_pads)); + GST_DEBUG_FUNCPTR (gst_selector_pad_get_linked_pads)); gst_pad_set_getcaps_function (sel->srcpad, GST_DEBUG_FUNCPTR (gst_input_selector_getcaps)); gst_pad_set_query_function (sel->srcpad, GST_DEBUG_FUNCPTR (gst_input_selector_query)); + gst_pad_set_event_function (sel->srcpad, + GST_DEBUG_FUNCPTR (gst_input_selector_event)); gst_element_add_pad (GST_ELEMENT (sel), sel->srcpad); /* sinkpad management */ sel->active_sinkpad = NULL; @@ -1011,6 +1013,21 @@ gst_input_selector_get_linked_pad (GstPad * pad, gboolean strict) return otherpad; } +static gboolean +gst_input_selector_event (GstPad * pad, GstEvent * event) +{ + gboolean res; + GstPad *otherpad; + + otherpad = gst_input_selector_get_linked_pad (pad, TRUE); + + res = gst_pad_push_event (otherpad, event); + + gst_object_unref (otherpad); + + return res; +} + /* query on the srcpad. We override this function because by default it will * only forward the query to one random sinkpad */ static gboolean @@ -1018,9 +1035,12 @@ gst_input_selector_query (GstPad * pad, GstQuery * query) { gboolean res; GstInputSelector *sel; + GstPad *otherpad; sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad)); + otherpad = gst_input_selector_get_linked_pad (pad, TRUE); + switch (GST_QUERY_TYPE (query)) { case GST_QUERY_LATENCY: { @@ -1080,9 +1100,10 @@ gst_input_selector_query (GstPad * pad, GstQuery * query) break; } default: - res = gst_pad_query_default (pad, query); + res = gst_pad_peer_query (otherpad, query); break; } + gst_object_unref (otherpad); gst_object_unref (sel); return res; @@ -1162,19 +1183,6 @@ gst_input_selector_activate_sinkpad (GstInputSelector * sel, GstPad * pad) return active_sinkpad; } -static GList * -gst_input_selector_get_linked_pads (GstPad * pad) -{ - GstPad *otherpad; - - otherpad = gst_input_selector_get_linked_pad (pad, TRUE); - if (!otherpad) - return NULL; - /* need to drop the ref, internal linked pads is not MT safe */ - gst_object_unref (otherpad); - return g_list_append (NULL, otherpad); -} - static GstPad * gst_input_selector_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * unused) |