mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
fixes event function setting on unconnected pads
Original commit message from CVS: fixes event function setting on unconnected pads
This commit is contained in:
parent
ea8656f2f7
commit
4aeb784a6f
1 changed files with 20 additions and 8 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue