Added vmethod for when an element changes scheduling behaviour (like switching from chain based to loop based etc)

Original commit message from CVS:
Added vmethod for when an element changes scheduling behaviour (like
switching from chain based to loop based etc)
This commit is contained in:
Wim Taymans 2002-09-17 21:23:33 +00:00
parent 8b3c7040d4
commit 1debaf2b59
2 changed files with 27 additions and 1 deletions

View file

@ -203,8 +203,11 @@ gst_scheduler_add_element (GstScheduler *sched, GstElement *element)
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)
if (GST_ELEMENT_SCHED (element) == sched) {
GST_DEBUG (GST_CAT_SCHEDULING, "element %s already in scheduler %p",
GST_ELEMENT_NAME (element), sched);
return;
}
/* if it's not inside this scheduler, it has to be NULL */
g_assert (GST_ELEMENT_SCHED (element) == NULL);
@ -312,6 +315,27 @@ gst_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint t
return GST_STATE_SUCCESS;
}
/**
* gst_scheduler_state_transition:
* @sched: the scheduler
* @element: the element with the state transition
* @transition: the state transition
*
* Tell the scheduler that an element changed its state.
*
* Returns: a GstElementStateReturn indicating success or failure
* of the state transition.
*/
void
gst_scheduler_scheduling_change (GstScheduler *sched, GstElement *element)
{
g_return_if_fail (GST_IS_SCHEDULER (sched));
g_return_if_fail (GST_IS_ELEMENT (element));
if (CLASS (sched)->scheduling_change)
CLASS (sched)->scheduling_change (sched, element);
}
/**
* gst_scheduler_add_scheduler:
* @sched: a #GstScheduler to add to

View file

@ -89,6 +89,7 @@ struct _GstSchedulerClass {
void (*add_scheduler) (GstScheduler *sched, GstScheduler *sched2);
void (*remove_scheduler) (GstScheduler *sched, GstScheduler *sched2);
GstElementStateReturn (*state_transition) (GstScheduler *sched, GstElement *element, gint transition);
void (*scheduling_change) (GstScheduler *sched, GstElement *element);
void (*lock_element) (GstScheduler *sched, GstElement *element);
void (*unlock_element) (GstScheduler *sched, GstElement *element);
void (*yield) (GstScheduler *sched, GstElement *element);
@ -119,6 +120,7 @@ void gst_scheduler_remove_element (GstScheduler *sched, GstElement *element);
void gst_scheduler_add_scheduler (GstScheduler *sched, GstScheduler *sched2);
void gst_scheduler_remove_scheduler (GstScheduler *sched, GstScheduler *sched2);
GstElementStateReturn gst_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint transition);
void gst_scheduler_scheduling_change (GstScheduler *sched, GstElement *element);
void gst_scheduler_lock_element (GstScheduler *sched, GstElement *element);
void gst_scheduler_unlock_element (GstScheduler *sched, GstElement *element);
void gst_scheduler_yield (GstScheduler *sched, GstElement *element);