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;
72 gboolean need_cothreads;
73 GList *managed_elements;
74 gint num_managed_elements;
81 cothread_context *threadcontext;
82 gboolean use_cothreads;
86 GstElementClass parent_class;
89 void (*object_added) (GstObject *object, GstObject *child);
90 void (*object_removed) (GstObject *object, GstObject *child);
92 /* change the state of elements of the given type */
93 gboolean (*change_state_type) (GstBin *bin,
94 GstElementState state,
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);
103 struct __GstBinChain {
109 gboolean need_cothreads;
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))
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);
123 void gst_bin_add_eos_provider (GstBin *bin,
124 GstElement *element);
125 void gst_bin_remove_eos_provider (GstBin *bin,
126 GstElement *element);
128 /* retrieve a single element or the list of children */
129 GstElement* gst_bin_get_by_name (GstBin *bin,
131 GList* gst_bin_get_list (GstBin *bin);
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,
139 void gst_bin_iterate (GstBin *bin);
142 void gst_bin_use_cothreads (GstBin *bin,
147 #endif /* __cplusplus */
150 #endif /* __GST_BIN_H__ */