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>
31 GST_EXPORT GType _gst_bin_type;
33 #define GST_TYPE_BIN (_gst_bin_type)
34 #define GST_IS_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BIN))
35 #define GST_IS_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BIN))
36 #define GST_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BIN, GstBinClass))
37 #define GST_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_BIN, GstBin))
38 #define GST_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BIN, GstBinClass))
41 /* this bin is a manager of child elements, i.e. a pipeline or thread */
42 GST_BIN_FLAG_MANAGER = GST_ELEMENT_FLAG_LAST,
44 /* this bin iterates itself */
45 GST_BIN_SELF_SCHEDULABLE,
47 /* we prefer to have cothreads when its an option, over chain-based */
48 GST_BIN_FLAG_PREFER_COTHREADS,
50 GST_BIN_FLAG_FIXED_CLOCK,
53 GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 5
56 /*typedef struct _GstBin GstBin; */
57 /*typedef struct _GstBinClass GstBinClass; */
66 /* FIXME 0.9: important!! make this guint instead of GstElementState */
67 GstElementState child_states[GST_NUM_STATES];
69 gpointer _gst_reserved[GST_PADDING];
73 GstElementClass parent_class;
76 void (*add_element) (GstBin *bin, GstElement *element);
77 void (*remove_element) (GstBin *bin, GstElement *element);
78 void (*child_state_change) (GstBin *bin, GstElementState oldstate,
79 GstElementState newstate, GstElement *element);
81 /* run a full iteration of operation */
82 gboolean (*iterate) (GstBin *bin);
85 void (*element_added) (GstBin *bin, GstElement *child);
86 void (*element_removed) (GstBin *bin, GstElement *child);
88 gpointer _gst_reserved[GST_PADDING];
91 GType gst_bin_get_type (void);
92 GstElement* gst_bin_new (const gchar *name);
94 /* add and remove elements from the bin */
95 void gst_bin_add (GstBin *bin, GstElement *element);
96 void gst_bin_add_many (GstBin *bin, GstElement *element_1, ...);
97 void gst_bin_remove (GstBin *bin, GstElement *element);
98 void gst_bin_remove_many (GstBin *bin, GstElement *element_1, ...);
100 /* retrieve a single element or the list of children */
101 GstElement* gst_bin_get_by_name (GstBin *bin, const gchar *name);
102 GstElement* gst_bin_get_by_name_recurse_up (GstBin *bin, const gchar *name);
103 G_CONST_RETURN GList*
104 gst_bin_get_list (GstBin *bin);
105 GstElement* gst_bin_get_by_interface (GstBin *bin, GType interface);
106 GList * gst_bin_get_all_by_interface (GstBin *bin, GType interface);
108 gboolean gst_bin_iterate (GstBin *bin);
110 void gst_bin_use_clock (GstBin *bin, GstClock *clock);
111 GstClock* gst_bin_get_clock (GstBin *bin);
112 void gst_bin_auto_clock (GstBin *bin);
114 #ifndef GST_DISABLE_DEPRECATED
115 GstElementStateReturn gst_bin_sync_children_state (GstBin *bin);
119 /* one of our childs signaled a state change */
120 void gst_bin_child_state_change (GstBin *bin, GstElementState oldstate,
121 GstElementState newstate, GstElement *child);
126 #endif /* __GST_BIN_H__ */