summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2003-08-26 10:50:35 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2003-08-26 10:50:35 +0000
commit4aeb784a6f0cd7b8cdd66dd1d300c0d84bfa02cf (patch)
tree3c72c81475bca11778aabbb06bcfcc4fa6304f5e
parentea8656f2f7b2d9f56d6195d94c311fd2b35da8a9 (diff)
downloadgstreamer-4aeb784a6f0cd7b8cdd66dd1d300c0d84bfa02cf.tar.gz
fixes event function setting on unconnected pads
Original commit message from CVS: fixes event function setting on unconnected pads
-rw-r--r--gst/schedulers/gstoptimalscheduler.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/gst/schedulers/gstoptimalscheduler.c b/gst/schedulers/gstoptimalscheduler.c
index c622f4305e..6057477d49 100644
--- a/gst/schedulers/gstoptimalscheduler.c
+++ b/gst/schedulers/gstoptimalscheduler.c
@@ -1305,6 +1305,7 @@ static void
get_group (GstElement *element, GstOptSchedulerGroup **group)
{
GstOptSchedulerCtx *ctx;
+ GList *pads;
ctx = GST_ELEMENT_SCHED_CONTEXT (element);
if (ctx)
@@ -1509,6 +1510,19 @@ gst_opt_scheduler_add_element (GstScheduler *sched, GstElement *element)
GST_ELEMENT_SCHED_CONTEXT (element) = ctx;
ctx->flags = GST_OPT_SCHEDULER_CTX_DISABLED;
+ /* set event handler on all pads here so events work unconnected too;
+ * in _link, it can be overruled if need be */
+ /* FIXME: we should also do this when new pads on the element are created;
+ but there are no hooks, so we do it again in _link */
+ pads = gst_element_get_pad_list (element);
+ while (pads) {
+ GstPad *pad = GST_PAD (pads->data);
+ pads = g_list_next (pads);
+
+ if (!GST_IS_REAL_PAD (pad)) continue;
+ GST_RPAD_EVENTHANDLER (pad) = GST_RPAD_EVENTFUNC (pad);
+ }
+
/* loop based elements *always* end up in their own group. It can eventually
* be merged with another group when a link is made */
if (element->loopfunc) {
@@ -1679,6 +1693,11 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad
type = GST_OPT_CHAIN_TO_CHAIN;
}
}
+
+ /* since we can't set event handlers on pad creation after addition, it is
+ * best we set all of them again to the default before linking */
+ GST_RPAD_EVENTHANDLER (srcpad) = GST_RPAD_EVENTFUNC (srcpad);
+ GST_RPAD_EVENTHANDLER (sinkpad) = GST_RPAD_EVENTFUNC (sinkpad);
/* for each link type, perform specific actions */
switch (type) {
@@ -1694,8 +1713,6 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad
GST_RPAD_CHAINHANDLER (sinkpad) = GST_RPAD_CHAINFUNC (sinkpad);
else
GST_RPAD_CHAINHANDLER (sinkpad) = gst_opt_scheduler_chain_wrapper;
- GST_RPAD_EVENTHANDLER (srcpad) = GST_RPAD_EVENTFUNC (srcpad);
- GST_RPAD_EVENTHANDLER (sinkpad) = GST_RPAD_EVENTFUNC (sinkpad);
/* the two elements should be put into the same group,
* this also means that they are in the same chain automatically */
@@ -1720,8 +1737,6 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad
GST_RPAD_CHAINHANDLER (sinkpad) = GST_RPAD_CHAINFUNC (sinkpad);
else
GST_RPAD_CHAINHANDLER (sinkpad) = gst_opt_scheduler_chain_wrapper;
- GST_RPAD_EVENTHANDLER (srcpad) = GST_RPAD_EVENTFUNC (srcpad);
- GST_RPAD_EVENTHANDLER (sinkpad) = GST_RPAD_EVENTFUNC (sinkpad);
/* the two elements should be put into the same group,
* this also means that they are in the same chain automatically,
@@ -1733,8 +1748,6 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad
GST_INFO ( "get to loop based link");
GST_RPAD_GETHANDLER (srcpad) = GST_RPAD_GETFUNC (srcpad);
- GST_RPAD_EVENTHANDLER (srcpad) = GST_RPAD_EVENTFUNC (srcpad);
- GST_RPAD_EVENTHANDLER (sinkpad) = GST_RPAD_EVENTFUNC (sinkpad);
/* the two elements should be put into the same group,
* this also means that they are in the same chain automatically,
@@ -1751,9 +1764,8 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad
GST_RPAD_CHAINHANDLER (sinkpad) = gst_opt_scheduler_loop_wrapper;
GST_RPAD_GETHANDLER (srcpad) = gst_opt_scheduler_get_wrapper;
- GST_RPAD_EVENTHANDLER (sinkpad) = GST_RPAD_EVENTFUNC (sinkpad);
/* events on the srcpad have to be intercepted as we might need to
- * flush the buffer lists */
+ * flush the buffer lists, so override the given eventfunc */
GST_RPAD_EVENTHANDLER (srcpad) = gst_opt_scheduler_event_wrapper;
group1 = GST_ELEMENT_SCHED_GROUP (element1);