From: Wim T. <wt...@us...> - 2002-09-17 21:23:46
|
CVS Root: /cvsroot/gstreamer Module: gstreamer Changes by: wtay Date: Tue Sep 17 2002 14:23:46 PDT Log message: Added vmethod for when an element changes scheduling behaviour (like switching from chain based to loop based etc) Modified files: gst : gstscheduler.c gstscheduler.h Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstscheduler.c.diff?r1=1.75&r2=1.76 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstscheduler.h.diff?r1=1.29&r2=1.30 ====Begin Diffs==== Index: gstscheduler.c =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/gst/gstscheduler.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -d -r1.75 -r1.76 --- gstscheduler.c 13 Sep 2002 23:02:54 -0000 1.75 +++ gstscheduler.c 17 Sep 2002 21:23:33 -0000 1.76 @@ -203,8 +203,11 @@ 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); @@ -310,6 +313,27 @@ return CLASS (sched)->state_transition (sched, element, transition); 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); } /** Index: gstscheduler.h =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/gst/gstscheduler.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- gstscheduler.h 9 Jul 2002 10:27:21 -0000 1.29 +++ gstscheduler.h 17 Sep 2002 21:23:33 -0000 1.30 @@ -89,6 +89,7 @@ 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_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); |