source: trunk/third/gstreamer/gst/gstbin.h @ 21448

Revision 21448, 4.8 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21447, which included commits to RCS files with non-trunk default branches.
Line 
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
29G_BEGIN_DECLS
30
31GST_EXPORT GType _gst_bin_type;
32
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))
39
40/**
41 * GstBinFlags:
42 * @GST_BIN_FLAG_MANAGER: this bin is a manager of child elements, i.e.
43 * a pipeline or thread.
44 * @GST_BIN_SELF_SCHEDULABLE: the bin iterates itself.
45 * @GST_BIN_FLAG_PREFER_COTHREADS: we prefer to have cothreads when its
46 * an option, over chain-based.
47 * @GST_BIN_FLAG_FIXED_CLOCK: bin has one clock that cannot be changed.
48 * @GST_BIN_STATE_LOCKED: indicator that we are in a non-recursive
49 * state-change on the bin, or that kids should not change parent state.
50 * Both are internally used to prevent infinitely recursive loops of
51 * state changes. Since they are mutually exclusive and serve the same
52 * purpose, we use the same flag for them.
53 * @GST_BIN_FLAG_LAST: the last enum in the series of flags in a bin,
54 * derived classes can use this as first value in a list of flags.
55 *
56 * GstBinFlags are a set of flags specific to bins. Most are set/used
57 * internally. They can be checked using the GST_FLAG_IS_SET () macro,
58 * and (un)set using GST_FLAG_SET () and GST_FLAG_UNSET ().
59 */
60typedef enum {
61  GST_BIN_FLAG_MANAGER          = GST_ELEMENT_FLAG_LAST,
62  GST_BIN_SELF_SCHEDULABLE,
63  GST_BIN_FLAG_PREFER_COTHREADS,
64  GST_BIN_FLAG_FIXED_CLOCK,
65  GST_BIN_STATE_LOCKED,
66  GST_BIN_FLAG_LAST             = GST_ELEMENT_FLAG_LAST + 5
67} GstBinFlags;
68
69/*typedef struct _GstBin GstBin; */
70/*typedef struct _GstBinClass GstBinClass; */
71
72struct _GstBin {
73  GstElement     element;
74
75  /* our children */
76  gint           numchildren;
77  GList         *children;
78
79  GstElementState child_states[GST_NUM_STATES];
80
81  gpointer _gst_reserved[GST_PADDING];
82};
83
84struct _GstBinClass {
85  GstElementClass parent_class;
86
87  /* vtable */
88  void          (*add_element)          (GstBin *bin, GstElement *element);
89  void          (*remove_element)       (GstBin *bin, GstElement *element);
90  void          (*child_state_change)   (GstBin *bin, GstElementState oldstate,
91                                         GstElementState newstate, GstElement *element);
92
93  /* run a full iteration of operation */
94  gboolean      (*iterate)              (GstBin *bin);
95
96  /* signals */
97  void          (*element_added)        (GstBin *bin, GstElement *child);
98  void          (*element_removed)      (GstBin *bin, GstElement *child);
99
100  gpointer _gst_reserved[GST_PADDING];
101};
102
103GType           gst_bin_get_type                (void);
104GstElement*     gst_bin_new                     (const gchar *name);
105
106/* add and remove elements from the bin */
107void            gst_bin_add                     (GstBin *bin, GstElement *element);
108void            gst_bin_add_many                (GstBin *bin, GstElement *element_1, ...);
109void            gst_bin_remove                  (GstBin *bin, GstElement *element);
110void            gst_bin_remove_many             (GstBin *bin, GstElement *element_1, ...);
111
112/* retrieve a single element or the list of children */
113GstElement*     gst_bin_get_by_name             (GstBin *bin, const gchar *name);
114GstElement*     gst_bin_get_by_name_recurse_up  (GstBin *bin, const gchar *name);
115G_CONST_RETURN GList*
116                gst_bin_get_list                (GstBin *bin);
117GstElement*     gst_bin_get_by_interface        (GstBin *bin, GType interface);
118GList *         gst_bin_get_all_by_interface    (GstBin *bin, GType interface);
119
120gboolean        gst_bin_iterate                 (GstBin *bin);
121
122void            gst_bin_use_clock               (GstBin *bin, GstClock *clock);
123GstClock*       gst_bin_get_clock               (GstBin *bin);
124void            gst_bin_auto_clock              (GstBin *bin);
125
126GstElementStateReturn gst_bin_sync_children_state (GstBin *bin);
127
128/* internal */
129/* one of our childs signaled a state change */
130void            gst_bin_child_state_change              (GstBin *bin, GstElementState oldstate,
131                                                         GstElementState newstate, GstElement *child);
132
133G_END_DECLS
134
135
136#endif /* __GST_BIN_H__ */
Note: See TracBrowser for help on using the repository browser.