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 (GTK_CHECK_CAST((obj),GST_TYPE_SCHEDULE,GstSchedule))
40 #define GST_SCHEDULE_CLASS(klass) \
41 (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_SCHEDULE,GstScheduleClass))
42 #define GST_IS_SCHEDULE(obj) \
43 (GTK_CHECK_TYPE((obj),GST_TYPE_SCHEDULE))
44 #define GST_IS_SCHEDULE_CLASS(klass) \
45 (GTK_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 gboolean (*iterate) (GstSchedule *sched);
76 struct _GstScheduleClass {
77 GstObjectClass parent_class;
80 #define GST_SCHEDULE_SAFETY(sched) if (sched)
81 //#define GST_SCHEDULE_SAFETY(sched)
83 #define GST_SCHEDULE_ADD_ELEMENT(sched,element) G_STMT_START{ \
84 GST_SCHEDULE_SAFETY(sched) { ((sched)->add_element((sched),(element))); } \
86 #define GST_SCHEDULE_REMOVE_ELEMENT(sched,element) G_STMT_START{ \
87 GST_SCHEDULE_SAFETY(sched) { ((sched)->remove_element((sched),(element))); } \
89 #define GST_SCHEDULE_ENABLE_ELEMENT(sched,element) G_STMT_START{ \
90 GST_SCHEDULE_SAFETY(sched) { ((sched)->enable_element((sched),(element))); } \
92 #define GST_SCHEDULE_DISABLE_ELEMENT(sched,element) G_STMT_START{ \
93 GST_SCHEDULE_SAFETY(sched) { ((sched)->disable_element((sched),(element))); } \
95 #define GST_SCHEDULE_LOCK_ELEMENT(sched,element) G_STMT_START{ \
96 GST_SCHEDULE_SAFETY(sched) { if ((sched)->lock_element != NULL) \
97 ((sched)->lock_element((sched),(element))); } \
99 #define GST_SCHEDULE_UNLOCK_ELEMENT(sched,element) G_STMT_START{ \
100 GST_SCHEDULE_SAFETY(sched) { if ((sched)->unlock_element != NULL) \
101 ((sched)->unlock_element((sched),(element))); } \
103 #define GST_SCHEDULE_PAD_CONNECT(sched,srcpad,sinkpad) G_STMT_START{ \
104 GST_SCHEDULE_SAFETY(sched) { ((sched)->pad_connect((sched),(srcpad),(sinkpad))); } \
106 #define GST_SCHEDULE_PAD_DISCONNECT(sched,srcpad,sinkpad) G_STMT_START{ \
107 GST_SCHEDULE_SAFETY(sched) { ((sched)->pad_disconnect((sched),(srcpad),(sinkpad))); } \
109 #define GST_SCHEDULE_ITERATE(sched) \
110 ((sched)->iterate((sched)))
114 struct _GstScheduleChain {
124 gint cothreaded_elements;
129 GtkType gst_schedule_get_type (void);
130 GstSchedule* gst_schedule_new (GstElement *parent);
132 void gst_schedule_add_element (GstSchedule *sched, GstElement *element);
133 void gst_schedule_remove_element (GstSchedule *sched, GstElement *element);
134 void gst_schedule_enable_element (GstSchedule *sched, GstElement *element);
135 void gst_schedule_disable_element (GstSchedule *sched, GstElement *element);
136 void gst_schedule_pad_connect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad);
137 void gst_schedule_pad_disconnect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad);
138 gboolean gst_schedule_iterate (GstSchedule *sched);
140 void gst_schedule_show (GstSchedule *sched);
145 #endif /* __cplusplus */
147 #endif /* __GST_SCHEDULER_H__ */