include parser.h instead of gnome-xml/parser.h untill xml-config is fixed...
[platform/upstream/gstreamer.git] / gst / gstbin.h
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wtay@chello.be>
4  *
5  * gstbin.h: Header for GstBin container object
6  *
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.
11  *
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.
16  *
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.
21  */
22
23
24 #ifndef __GST_BIN_H__
25 #define __GST_BIN_H__
26
27 #include <gst/gstelement.h>
28 #include <gst/cothreads.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34 extern GstElementDetails gst_bin_details;
35
36 #define GST_TYPE_BIN \
37   (gst_bin_get_type())
38 #define GST_BIN(obj) \
39   (GTK_CHECK_CAST((obj),GST_TYPE_BIN,GstBin))
40 #define GST_BIN_CLASS(klass) \
41   (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_BIN,GstBinClass))
42 #define GST_IS_BIN(obj) \
43   (GTK_CHECK_TYPE((obj),GST_TYPE_BIN))
44 #define GST_IS_BIN_CLASS(obj) \
45   (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_BIN))
46
47 typedef enum {
48   /* this bin is a manager of child elements, i.e. a pipeline or thread */
49   GST_BIN_FLAG_MANAGER          = GST_ELEMENT_FLAG_LAST,
50
51   /* we prefer to have cothreads when its an option, over chain-based */
52   GST_BIN_FLAG_PREFER_COTHREADS,
53
54   /* padding */
55   GST_BIN_FLAG_LAST             = GST_ELEMENT_FLAG_LAST + 4,
56 } GstBinFlags;
57
58 typedef struct _GstBin GstBin;
59 typedef struct _GstBinClass GstBinClass;
60 typedef struct __GstBinChain _GstBinChain;
61
62 struct _GstBin {
63   GstElement element;
64
65   /* our children */
66   gint numchildren;
67   GList *children;
68   gint num_eos_providers;
69   GList *eos_providers;
70
71   /* iteration state */
72   gboolean need_cothreads;
73   GList *managed_elements;
74   gint num_managed_elements;
75
76   GList *chains;
77   gint num_chains;
78   GList *entries;
79   gint num_entries;
80
81   cothread_context *threadcontext;
82   gboolean use_cothreads;
83 };
84
85 struct _GstBinClass {
86   GstElementClass parent_class;
87
88   /* signals */
89   void          (*object_added)         (GstObject *object, GstObject *child);
90   void          (*object_removed)       (GstObject *object, GstObject *child);
91
92   /* change the state of elements of the given type */
93   gboolean      (*change_state_type)    (GstBin *bin,
94                                          GstElementState state,
95                                          GtkType type);
96   /* create a plan for the execution of the bin */
97   void          (*create_plan)          (GstBin *bin);
98   void          (*schedule)             (GstBin *bin);
99   /* run a full iteration of operation */
100   void          (*iterate)              (GstBin *bin);
101 };
102
103 struct __GstBinChain {
104   GList *elements;
105   gint num_elements;
106
107   GList *entries;
108
109   gboolean need_cothreads;
110 };  
111
112
113 GtkType         gst_bin_get_type                (void);
114 GstElement*     gst_bin_new                     (const gchar *name);
115 #define         gst_bin_destroy(bin)            gst_object_destroy(GST_OBJECT(bin))
116
117 /* add and remove elements from the bin */
118 void            gst_bin_add                     (GstBin *bin,
119                                                  GstElement *element);
120 void            gst_bin_remove                  (GstBin *bin,
121                                                  GstElement *element);
122
123 void            gst_bin_add_eos_provider        (GstBin *bin,
124                                                  GstElement *element);
125 void            gst_bin_remove_eos_provider     (GstBin *bin,
126                                                  GstElement *element);
127
128 /* retrieve a single element or the list of children */
129 GstElement*     gst_bin_get_by_name             (GstBin *bin,
130                                                  const gchar *name);
131 GList*          gst_bin_get_list                (GstBin *bin);
132
133 void            gst_bin_create_plan             (GstBin *bin);
134 void            gst_bin_schedule                (GstBin *bin);
135 gboolean        gst_bin_set_state_type          (GstBin *bin,
136                                                  GstElementState state,
137                                                  GtkType type);
138
139 void            gst_bin_iterate                 (GstBin *bin);
140
141 /* hack FIXME */
142 void            gst_bin_use_cothreads           (GstBin *bin,
143                                                  gboolean enabled);
144
145 #ifdef __cplusplus
146 }
147 #endif /* __cplusplus */
148
149
150 #endif /* __GST_BIN_H__ */     
151