2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gstscheduler.h: Header for default scheduler code
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 #ifndef __GST_SCHEDULER_H__
25 #define __GST_SCHEDULER_H__
27 #include <gst/gstelement.h>
28 #include <gst/gstbin.h>
33 #endif /* __cplusplus */
36 #define GST_TYPE_SCHEDULE \
37 (gst_schedule_get_type())
38 #define GST_SCHEDULE(obj) \
39 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCHEDULE,GstSchedule))
40 #define GST_SCHEDULE_CLASS(klass) \
41 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCHEDULE,GstScheduleClass))
42 #define GST_IS_SCHEDULE(obj) \
43 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCHEDULE))
44 #define GST_IS_SCHEDULE_CLASS(klass) \
45 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCHEDULE))
48 #define GST_SCHED_PARENT(sched) ((sched)->parent)
50 //typedef struct _GstSchedule GstSchedule;
51 //typedef struct _GstScheduleClass GstScheduleClass;
52 typedef struct _GstScheduleChain GstScheduleChain;
65 void (*add_element) (GstSchedule *sched, GstElement *element);
66 void (*remove_element) (GstSchedule *sched, GstElement *element);
67 void (*enable_element) (GstSchedule *sched, GstElement *element);
68 void (*disable_element) (GstSchedule *sched, GstElement *element);
69 void (*lock_element) (GstSchedule *sched, GstElement *element);
70 void (*unlock_element) (GstSchedule *sched, GstElement *element);
71 void (*pad_connect) (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad);
72 void (*pad_disconnect) (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad);
73 void (*pad_select) (GstSchedule *sched, GList *padlist);
74 gboolean (*iterate) (GstSchedule *sched);
77 struct _GstScheduleClass {
78 GstObjectClass parent_class;
81 #define GST_SCHEDULE_SAFETY(sched) if (sched)
82 //#define GST_SCHEDULE_SAFETY(sched)
84 #define GST_SCHEDULE_ADD_ELEMENT(sched,element) G_STMT_START{ \
85 GST_SCHEDULE_SAFETY(sched) { ((sched)->add_element((sched),(element))); } \
87 #define GST_SCHEDULE_REMOVE_ELEMENT(sched,element) G_STMT_START{ \
88 GST_SCHEDULE_SAFETY(sched) { ((sched)->remove_element((sched),(element))); } \
90 #define GST_SCHEDULE_ENABLE_ELEMENT(sched,element) G_STMT_START{ \
91 GST_SCHEDULE_SAFETY(sched) { ((sched)->enable_element((sched),(element))); } \
93 #define GST_SCHEDULE_DISABLE_ELEMENT(sched,element) G_STMT_START{ \
94 GST_SCHEDULE_SAFETY(sched) { ((sched)->disable_element((sched),(element))); } \
96 #define GST_SCHEDULE_LOCK_ELEMENT(sched,element) G_STMT_START{ \
97 GST_SCHEDULE_SAFETY(sched) { if ((sched)->lock_element != NULL) \
98 ((sched)->lock_element((sched),(element))); } \
100 #define GST_SCHEDULE_UNLOCK_ELEMENT(sched,element) G_STMT_START{ \
101 GST_SCHEDULE_SAFETY(sched) { if ((sched)->unlock_element != NULL) \
102 ((sched)->unlock_element((sched),(element))); } \
104 #define GST_SCHEDULE_PAD_CONNECT(sched,srcpad,sinkpad) G_STMT_START{ \
105 GST_SCHEDULE_SAFETY(sched) { ((sched)->pad_connect((sched),(srcpad),(sinkpad))); } \
107 #define GST_SCHEDULE_PAD_DISCONNECT(sched,srcpad,sinkpad) G_STMT_START{ \
108 GST_SCHEDULE_SAFETY(sched) { ((sched)->pad_disconnect((sched),(srcpad),(sinkpad))); } \
110 #define GST_SCHEDULE_ITERATE(sched) \
111 ((sched)->iterate((sched)))
115 struct _GstScheduleChain {
125 gint cothreaded_elements;
130 GType gst_schedule_get_type (void);
131 GstSchedule* gst_schedule_new (GstElement *parent);
133 void gst_schedule_add_element (GstSchedule *sched, GstElement *element);
134 void gst_schedule_remove_element (GstSchedule *sched, GstElement *element);
135 void gst_schedule_enable_element (GstSchedule *sched, GstElement *element);
136 void gst_schedule_disable_element (GstSchedule *sched, GstElement *element);
137 void gst_schedule_pad_connect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad);
138 void gst_schedule_pad_disconnect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad);
139 gboolean gst_schedule_iterate (GstSchedule *sched);
141 void gst_schedule_show (GstSchedule *sched);
146 #endif /* __cplusplus */
148 #endif /* __GST_SCHEDULER_H__ */