GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting scheduler to %p", sched);
- element->sched = sched;
+ GST_ELEMENT_SCHED (element) = sched;
}
/**
{
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
- return element->sched;
+ return GST_ELEMENT_SCHED (element);
}
/**
GST_RPAD_FILTER (realsrc) = NULL;
}
- /* now tell the scheduler, the schedulers on both paths are guaranteed to be the same,
- * so we can just take one */
- if (src_sched && src_sched == sink_sched)
+ /* now tell the scheduler */
+ if (src_sched)
gst_scheduler_pad_disconnect (src_sched,
GST_PAD_CAST (realsrc), GST_PAD_CAST (realsink));
+ else if (sink_sched)
+ gst_scheduler_pad_disconnect (sink_sched,
+ GST_PAD_CAST (realsrc), GST_PAD_CAST (realsink));
/* hold a reference, as they can go away in the signal handlers */
gst_object_ref (GST_OBJECT (realsrc));
src_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsrc));
sink_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsink));
- /* now tell the scheduler, the schedulers on both paths have to be the same,
- * so we can just take one */
+ /* now tell the scheduler */
if (src_sched)
gst_scheduler_pad_connect (src_sched,
GST_PAD_CAST (realsrc), GST_PAD_CAST (realsink));
g_return_if_fail (GST_IS_SCHEDULER (sched));
g_return_if_fail (GST_IS_ELEMENT (element));
+ /* if it's already in this scheduler, don't bother doing anything */
+ if (GST_ELEMENT_SCHED (element) == sched)
+ return;
+
+ /* if it's not inside this scheduler, it has to be NULL */
+ g_assert (GST_ELEMENT_SCHED (element) == NULL);
+
if (element->getclockfunc) {
sched->clock_providers = g_list_prepend (sched->clock_providers, element);
GST_DEBUG (GST_CAT_CLOCK, "added clock provider %s", GST_ELEMENT_NAME (element));
GST_DEBUG (GST_CAT_CLOCK, "added clock receiver %s", GST_ELEMENT_NAME (element));
}
- /* gst_element_set_scheduler (element, sched); */
+ gst_element_set_scheduler (element, sched);
if (CLASS (sched)->add_element)
CLASS (sched)->add_element (sched, element);
sched->clock_providers = g_list_remove (sched->clock_providers, element);
sched->clock_receivers = g_list_remove (sched->clock_receivers, element);
- /* gst_element_set_scheduler (element, NULL); */
-
if (CLASS (sched)->remove_element)
CLASS (sched)->remove_element (sched, element);
+
+ gst_element_set_scheduler (element, NULL);
}
/**
GstSchedulerChain *chain;
GstBasicScheduler *bsched = GST_BASIC_SCHEDULER (sched);
- /* if it's already in this scheduler, don't bother doing anything */
- if (GST_ELEMENT_SCHED (element) == sched)
- return;
-
GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to scheduler", GST_ELEMENT_NAME (element));
- /* if the element already has a scheduler something went wrong */
- if (GST_ELEMENT_SCHED (element)) {
- GST_ERROR (element, "grave error");
- return;
- }
-
- /* set the sched pointer in the element itself */
- GST_ELEMENT_SCHED (element) = sched;
-
/* only deal with elements after this point, not bins */
/* exception is made for Bin's that are schedulable, like the autoplugger */
if (GST_IS_BIN (element) && !GST_FLAG_IS_SET (element, GST_BIN_SELF_SCHEDULABLE))
return;
-
/* first add it to the list of elements that are to be scheduled */
bsched->elements = g_list_prepend (bsched->elements, element);
bsched->num_elements++;
/* unset the scheduler pointer in the element */
}
- GST_ELEMENT_SCHED (element) = NULL;
}
static GstElementStateReturn
GstSchedulerChain *chain;
GstFastScheduler *bsched = GST_FAST_SCHEDULER (sched);
- /* if it's already in this scheduler, don't bother doing anything */
- if (GST_ELEMENT_SCHED (element) == sched)
- return;
-
GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to scheduler", GST_ELEMENT_NAME (element));
- /* if the element already has a different scheduler, remove the element from it */
- if (GST_ELEMENT_SCHED (element)) {
- gst_fast_scheduler_remove_element (GST_ELEMENT_SCHED (element), element);
- }
-
- /* set the sched pointer in the element itself */
- GST_ELEMENT_SCHED (element) = sched;
-
/* only deal with elements after this point, not bins */
/* exception is made for Bin's that are schedulable, like the autoplugger */
if (GST_IS_BIN (element) && !GST_FLAG_IS_SET (element, GST_BIN_SELF_SCHEDULABLE))
/* remove it from the list of elements */
bsched->elements = g_list_remove (bsched->elements, element);
bsched->num_elements--;
-
- /* unset the scheduler pointer in the element */
- GST_ELEMENT_SCHED (element) = NULL;
}
}
#define GST_OPT_SCHEDULER_GROUP_DISABLE(group) ((group)->flags |= GST_OPT_SCHEDULER_GROUP_DISABLED)
#define GST_OPT_SCHEDULER_GROUP_ENABLE(group) ((group)->flags &= ~GST_OPT_SCHEDULER_GROUP_DISABLED)
+#define GST_OPT_SCHEDULER_GROUP_IS_ENABLED(group) (!((group)->flags & GST_OPT_SCHEDULER_GROUP_DISABLED))
#define GST_OPT_SCHEDULER_GROUP_IS_DISABLED(group) ((group)->flags & GST_OPT_SCHEDULER_GROUP_DISABLED)
typedef struct _GstOptSchedulerGroup GstOptSchedulerGroup;