2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gstbin.h: Header for GstBin container object
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.
27 #include <gst/gstelement.h>
28 #include <gst/cothreads.h>
32 #endif /* __cplusplus */
34 extern GstElementDetails gst_bin_details;
36 #define GST_TYPE_BIN \
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))
48 /* this bin is a manager of child elements, i.e. a pipeline or thread */
49 GST_BIN_FLAG_MANAGER = GST_ELEMENT_FLAG_LAST,
51 /* we prefer to have cothreads when its an option, over chain-based */
52 GST_BIN_FLAG_PREFER_COTHREADS,
55 GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 4,
58 typedef struct _GstBin GstBin;
59 typedef struct _GstBinClass GstBinClass;
60 typedef struct __GstBinChain _GstBinChain;
68 gint num_eos_providers;
73 gboolean need_cothreads;
74 GList *managed_elements;
75 gint num_managed_elements;
82 cothread_context *threadcontext;
83 gboolean use_cothreads;
87 GstElementClass parent_class;
90 void (*object_added) (GstObject *object, GstObject *child);
91 void (*object_removed) (GstObject *object, GstObject *child);
93 /* change the state of elements of the given type */
94 gboolean (*change_state_type) (GstBin *bin,
95 GstElementState state,
97 /* create a plan for the execution of the bin */
98 void (*create_plan) (GstBin *bin);
99 void (*schedule) (GstBin *bin);
100 /* run a full iteration of operation */
101 gboolean (*iterate) (GstBin *bin);
104 struct __GstBinChain {
110 gboolean need_cothreads;
111 gboolean need_scheduling;
115 GtkType gst_bin_get_type (void);
116 GstElement* gst_bin_new (const gchar *name);
117 #define gst_bin_destroy(bin) gst_object_destroy(GST_OBJECT(bin))
119 /* add and remove elements from the bin */
120 void gst_bin_add (GstBin *bin,
121 GstElement *element);
122 void gst_bin_remove (GstBin *bin,
123 GstElement *element);
125 /* retrieve a single element or the list of children */
126 GstElement* gst_bin_get_by_name (GstBin *bin,
128 GList* gst_bin_get_list (GstBin *bin);
130 void gst_bin_create_plan (GstBin *bin);
131 void gst_bin_schedule (GstBin *bin);
132 gboolean gst_bin_set_state_type (GstBin *bin,
133 GstElementState state,
136 gboolean gst_bin_iterate (GstBin *bin);
139 void gst_bin_use_cothreads (GstBin *bin,
144 #endif /* __cplusplus */
147 #endif /* __GST_BIN_H__ */