GstScheduler

## GstScheduler GstScheduler — Abstract class for objects that manage the scheduling of groups of elements |

## Synopsis

    #include <gst/gst.h>

                GstScheduler;
    enum        GstSchedulerFlags;
    #define     GST_SCHEDULER_PARENT            (sched)
    #define     GST_SCHEDULER_STATE             (sched)
    enum        GstSchedulerState;
    void        gst_scheduler_setup             (GstScheduler *sched);
    void        gst_scheduler_reset             (GstScheduler *sched);
    void        gst_scheduler_add_element       (GstScheduler *sched,
                                                 GstElement *element);
    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);
    gboolean    gst_scheduler_yield             (GstScheduler *sched,
                                                 GstElement *element);
    gboolean    gst_scheduler_interrupt         (GstScheduler *sched,
                                                 GstElement *element);
    void        gst_scheduler_error             (GstScheduler *sched,
                                                 GstElement *element);
    void        gst_scheduler_pad_link          (GstScheduler *sched,
                                                 GstPad *srcpad,
                                                 GstPad *sinkpad);
    void        gst_scheduler_pad_unlink        (GstScheduler *sched,
                                                 GstPad *srcpad,
                                                 GstPad *sinkpad);
    GstPad*     gst_scheduler_pad_select        (GstScheduler *sched,
                                                 GList *padlist);
    GstClockReturn gst_scheduler_clock_wait     (GstScheduler *sched,
                                                 GstElement *element,
                                                 GstClockID id,
                                                 GstClockTimeDiff *jitter);
    gboolean    gst_scheduler_iterate           (GstScheduler *sched);
    void        gst_scheduler_use_clock         (GstScheduler *sched,
                                                 GstClock *clock);
    void        gst_scheduler_set_clock         (GstScheduler *sched,
                                                 GstClock *clock);
    GstClock*   gst_scheduler_get_clock         (GstScheduler *sched);
    void        gst_scheduler_auto_clock        (GstScheduler *sched);
    void        gst_scheduler_show              (GstScheduler *sched);
    #define     GST_SCHEDULER_DEFAULT_NAME

## Object Hierarchy

      GObject
       +----GstObject
             +----GstScheduler

## Description

This is a base class for custom schedulers.

## Details

### GstScheduler

    typedef struct _GstScheduler GstScheduler;

### enum GstSchedulerFlags

    typedef enum {
      /* this scheduler works with a fixed clock */
      GST_SCHEDULER_FLAG_FIXED_CLOCK	= GST_OBJECT_FLAG_LAST,
      /* this scheduler supports select and lock calls */
      GST_SCHEDULER_FLAG_NEW_API,

      /* padding */
      GST_SCHEDULER_FLAG_LAST 		= GST_OBJECT_FLAG_LAST + 4
    } GstSchedulerFlags;

Flags for the scheduler

`GST_SCHEDULER_FLAG_FIXED_CLOCK` | the scheduler works with a fixed clock
`GST_SCHEDULER_FLAG_NEW_API` | the scheduler supports select and lock calls
`GST_SCHEDULER_FLAG_LAST` | subclasses can start numbering their flags starting from here.

### GST_SCHEDULER_PARENT()

    #define GST_SCHEDULER_PARENT(sched)		((sched)->parent)

Get the parent object of this scheduler.

`sched` : | the scheduler to get the parent of.

### GST_SCHEDULER_STATE()

    #define GST_SCHEDULER_STATE(sched)		((sched)->state)

Get the state of the scheduler.

`sched` : | the scheduler to get the state of.

### enum GstSchedulerState

    typedef enum {
      GST_SCHEDULER_STATE_NONE,
      GST_SCHEDULER_STATE_RUNNING,
      GST_SCHEDULER_STATE_STOPPED,
      GST_SCHEDULER_STATE_ERROR
    } GstSchedulerState;

The state of the scheduler

`GST_SCHEDULER_STATE_NONE` | no state
`GST_SCHEDULER_STATE_RUNNING` | the scheduler is running
`GST_SCHEDULER_STATE_STOPPED` | the scheduler is stopped
`GST_SCHEDULER_STATE_ERROR` | the scheduler is in error

### gst_scheduler_setup ()

    void        gst_scheduler_setup             (GstScheduler *sched);

Prepare the scheduler.

`sched` : | the scheduler

### gst_scheduler_reset ()

    void        gst_scheduler_reset             (GstScheduler *sched);

Reset the schedulers.

`sched` : | a GstScheduler to reset.

### gst_scheduler_add_element ()

    void        gst_scheduler_add_element       (GstScheduler *sched,
                                                 GstElement *element);

Add an element to the scheduler.

`sched` : | the scheduler
`element` : | the element to add to the scheduler

### gst_scheduler_remove_element ()

    void        gst_scheduler_remove_element    (GstScheduler *sched,
                                                 GstElement *element);

Remove an element from the scheduler.

`sched` : | the scheduler
`element` : | the element to remove

### gst_scheduler_add_scheduler ()

    void        gst_scheduler_add_scheduler     (GstScheduler *sched,
                                                 GstScheduler *sched2);

Notifies the scheduler that it has to monitor this scheduler.

`sched` : | a GstScheduler to add to
`sched2` : | the GstScheduler to add

### gst_scheduler_remove_scheduler ()

    void        gst_scheduler_remove_scheduler  (GstScheduler *sched,
                                                 GstScheduler *sched2);

a Notifies the scheduler that it can stop monitoring this scheduler.

`sched` : | the scheduler
`sched2` : | the scheduler to remove

### gst_scheduler_state_transition ()

    GstElementStateReturn gst_scheduler_state_transition
                                                (GstScheduler *sched,
                                                 GstElement *element,
                                                 gint transition);

Tell the scheduler that an element changed its state.

`sched` : | the scheduler
`element` : | the element with the state transition
`transition` : | the state transition
Returns : | a GstElementStateReturn indicating success or failure of the state transition.

### gst_scheduler_scheduling_change ()

    void        gst_scheduler_scheduling_change (GstScheduler *sched,
                                                 GstElement *element);

Tell the scheduler that an element changed its scheduling strategy. An element could, for example, change its loop function or changes from a loop based element to a chain based element.

`sched` : | the scheduler
`element` : | the element that changed its scheduling strategy

### gst_scheduler_lock_element ()

    void        gst_scheduler_lock_element      (GstScheduler *sched,
                                                 GstElement *element);

### Warning

`gst_scheduler_lock_element` is deprecated and should not be used in newly-written code.

Acquire a lock on the given element in the given scheduler.

`sched` : | the scheduler
`element` : | the element to lock

### gst_scheduler_unlock_element ()

    void        gst_scheduler_unlock_element    (GstScheduler *sched,
                                                 GstElement *element);

### Warning

`gst_scheduler_unlock_element` is deprecated and should not be used in newly-written code.

Release the lock on the given element in the given scheduler.

`sched` : | the scheduler
`element` : | the element to unlock

### gst_scheduler_yield ()

    gboolean    gst_scheduler_yield             (GstScheduler *sched,
                                                 GstElement *element);

Tell the scheduler to schedule another element.

`sched` : | the scheduler
`element` : | the element requesting a yield
Returns : | TRUE if the element should save its state, FALSE if the scheduler can perform this action itself.

### gst_scheduler_interrupt ()

    gboolean    gst_scheduler_interrupt         (GstScheduler *sched,
                                                 GstElement *element);

Tell the scheduler to interrupt execution of this element.

`sched` : | the scheduler
`element` : | the element requesting an interrupt
Returns : | TRUE if the element should return NULL from the chain/get function.

### gst_scheduler_error ()

    void        gst_scheduler_error             (GstScheduler *sched,
                                                 GstElement *element);

Tell the scheduler an element was in error

`sched` : | the scheduler
`element` : | the element with the error

### gst_scheduler_pad_link ()

    void        gst_scheduler_pad_link          (GstScheduler *sched,
                                                 GstPad *srcpad,
                                                 GstPad *sinkpad);

Links the srcpad to the given sinkpad.

`sched` : | the scheduler
`srcpad` : | the srcpad to link
`sinkpad` : | the sinkpad to link to

### gst_scheduler_pad_unlink ()

    void        gst_scheduler_pad_unlink        (GstScheduler *sched,
                                                 GstPad *srcpad,
                                                 GstPad *sinkpad);

Unlinks the srcpad from the given sinkpad.

`sched` : | the scheduler
`srcpad` : | the srcpad to unlink
`sinkpad` : | the sinkpad to unlink from

### gst_scheduler_pad_select ()

    GstPad*     gst_scheduler_pad_select        (GstScheduler *sched,
                                                 GList *padlist);

### Warning

`gst_scheduler_pad_select` is deprecated and should not be used in newly-written code.

register the given padlist for a select operation.

`sched` : | the scheduler
`padlist` : | the padlist to select on
Returns : | the pad which received a buffer.

### gst_scheduler_clock_wait ()

    GstClockReturn gst_scheduler_clock_wait     (GstScheduler *sched,
                                                 GstElement *element,
                                                 GstClockID id,
                                                 GstClockTimeDiff *jitter);

Wait till the clock reaches a specific time. The ClockID can be obtained from gst_clock_new_single_shot_id.

`sched` : | the scheduler
`element` : | the element that wants to wait
`id` : | the clockid to use
`jitter` : | the time difference between requested time and actual time
Returns : | the status of the operation

### gst_scheduler_iterate ()

    gboolean    gst_scheduler_iterate           (GstScheduler *sched);

Perform one iteration on the scheduler.

`sched` : | the scheduler
Returns : | a boolean indicating something usefull has happened.

### gst_scheduler_use_clock ()

    void        gst_scheduler_use_clock         (GstScheduler *sched,
                                                 GstClock *clock);

Force the scheduler to use the given clock. The scheduler will always use the given clock even if new clock providers are added to this scheduler.

`sched` : | the scheduler
`clock` : | the clock to use

### gst_scheduler_set_clock ()

    void        gst_scheduler_set_clock         (GstScheduler *sched,
                                                 GstClock *clock);

Set the clock for the scheduler. The clock will be distributed to all the elements managed by the scheduler.

`sched` : | the scheduler
`clock` : | the clock to set

### gst_scheduler_get_clock ()

    GstClock*   gst_scheduler_get_clock         (GstScheduler *sched);

Gets the current clock used by the scheduler.

`sched` : | the scheduler
Returns : | a GstClock

### gst_scheduler_auto_clock ()

    void        gst_scheduler_auto_clock        (GstScheduler *sched);

Let the scheduler select a clock automatically.

`sched` : | the scheduler

### gst_scheduler_show ()

    void        gst_scheduler_show              (GstScheduler *sched);

Dump the state of the scheduler

`sched` : | the scheduler

### GST_SCHEDULER_DEFAULT_NAME

    #define GST_SCHEDULER_DEFAULT_NAME	"opt"