![]() | ![]() | ![]() | GStreamer Core Reference Manual | ![]() |
---|
GstBin — Base container element
#include <gst/gst.h> enum GstBinFlags; struct GstBin; void (*GstBinPrePostIterateFunction) (GstBin *bin, gpointer user_data); GstElement* gst_bin_new (const gchar *name); void gst_bin_add (GstBin *bin, GstElement *element); void gst_bin_add_many (GstBin *bin, GstElement *element_1, ...); void gst_bin_remove (GstBin *bin, GstElement *element); void gst_bin_remove_many (GstBin *bin, GstElement *element_1, ...); GstElement* gst_bin_get_by_name (GstBin *bin, const gchar *name); GstElement* gst_bin_get_by_name_recurse_up (GstBin *bin, const gchar *name); G_CONST_RETURN GList* gst_bin_get_list (GstBin *bin); gboolean gst_bin_iterate (GstBin *bin); void gst_bin_set_post_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer user_data); void gst_bin_set_pre_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer user_data); void gst_bin_child_state_change (GstBin *bin, GstElementState oldstate, GstElementState newstate, GstElement *child); void gst_bin_auto_clock (GstBin *bin); GstClock* gst_bin_get_clock (GstBin *bin); void gst_bin_use_clock (GstBin *bin, GstClock *clock);
GObject +----GstObject +----GstElement +----GstBin
"element-added" void user_function (GstBin *gstbin, GstElement *arg1, gpointer user_data); "element-removed" void user_function (GstBin *gstbin, GstElement *arg1, gpointer user_data); "iterate" gboolean user_function (GstBin *gstbin, gpointer user_data);
GstBin is the simplest of the container elements, allowing elements to become children of itself. Pads from the child elements can be ghosted to the bin, making the bin itself look transparently like any other element, allowing for deep nesting of predefined sub-pipelines.
A new GstBin is created with gst_bin_new(). Use a GstPipeline instead if you want to create a toplevel bin because a normal bin doesn't have a scheduler of its own.
After the bin has been created you will typically add elements to it with gst_bin_add(). You can remove elements with gst_bin_remove().
An element can be retrieved from a bin with gst_bin_get_by_name(), using the elements name. gst_bin_get_by_name_recurse_up() is mainly used for internal purposes and will query the parent bins when the element is not found in the current bin.
The list of elements in a bin can be retrieved with gst_bin_get_list().
After the bin has been set to the PLAYING state (with gst_element_set_state()), gst_bin_iterate() is used to process the elements in the bin.
The "element_added" signal is fired whenever a new element is added to the bin.
The "element_removed" signal is fired whenever an element is removed from the bin.
gst_bin_destroy() is used to destroy the bin.
To control the selection of the clock in a bin, you can use the following methods: gst_bin_auto_clock() to let the bin select a clock automatically, gst_bin_get_clock() to get the current clock of the bin and gst_bin_use_clock() to specify a clock explicitly. Note that the default behaviour is to automatically select a clock from one of the clock providers in the bin.
typedef enum { /* this bin is a manager of child elements, i.e. a pipeline or thread */ GST_BIN_FLAG_MANAGER = GST_ELEMENT_FLAG_LAST, /* this bin iterates itself */ GST_BIN_SELF_SCHEDULABLE, /* we prefer to have cothreads when its an option, over chain-based */ GST_BIN_FLAG_PREFER_COTHREADS, GST_BIN_FLAG_FIXED_CLOCK, /* padding */ GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 5 } GstBinFlags;
Flags for a bin.
GST_BIN_FLAG_MANAGER | This bin has a scheduler and can be used as a toplevel bin. |
GST_BIN_SELF_SCHEDULABLE | This bin iterates itself, so no calls to gst_bin_iterate() should be made. |
GST_BIN_FLAG_PREFER_COTHREADS | This bin preferes to have its elements scheduled with cothreads |
GST_BIN_FLAG_FIXED_CLOCK | This bin uses a fixed clock, possibly the one set with gst_bin_use_clock(). |
GST_BIN_FLAG_LAST |
void (*GstBinPrePostIterateFunction) (GstBin *bin, gpointer user_data);
The signature of the callback for the post and pre iterate function as set with gst_bin_set_pre_iterate_function() and gst_bin_set_post_iterate_function().
bin : | The bin that performed the callback |
user_data : | user data |
GstElement* gst_bin_new (const gchar *name);
Create a new bin with given name.
name : | name of new bin |
Returns : | new bin |
void gst_bin_add (GstBin *bin, GstElement *element);
Add the given element to the bin. Set the elements parent, and thus add a reference.
bin : | GstBin to add element to |
element : | GstElement to add to bin |
void gst_bin_add_many (GstBin *bin, GstElement *element_1, ...);
Add a list of elements to a bin. Uses gst_bin_add.
bin : | the bin to add the elements to |
element_1 : | the first element to add to the bin |
... : | NULL-terminated list of elements to add to the bin |
void gst_bin_remove (GstBin *bin, GstElement *element);
Remove the element from its associated bin, unparenting as well. The element will also be unreferenced so there's no need to call gst_object_unref on it. If you want the element to still exist after removing, you need to call gst_object_ref before removing it from the bin.
bin : | GstBin to remove element from |
element : | GstElement to remove |
void gst_bin_remove_many (GstBin *bin, GstElement *element_1, ...);
Remove a list of elements from a bin. Uses gst_bin_remove.
bin : | the bin to remove the elements from |
element_1 : | the first element to remove from the bin |
... : | NULL-terminated list of elements to remove from the bin |
GstElement* gst_bin_get_by_name (GstBin *bin, const gchar *name);
Get the element with the given name from this bin.
bin : | Gstbin to search |
name : | the element name to search for |
Returns : | the element with the given name |
GstElement* gst_bin_get_by_name_recurse_up (GstBin *bin, const gchar *name);
Get the element with the given name from this bin. If the element is not found, a recursion is performed on the parent bin.
bin : | Gstbin to search |
name : | the element name to search for |
Returns : | the element with the given name |
G_CONST_RETURN GList* gst_bin_get_list (GstBin *bin);
Get the list of elements in this bin.
bin : | Gstbin to get the list from |
Returns : | a GList of elements |
gboolean gst_bin_iterate (GstBin *bin);
Iterates over the elements in this bin.
bin : | aGstBin to iterate. |
Returns : | TRUE if the bin did something useful. This value can be used to determine it the bin is in EOS. |
void gst_bin_set_post_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer user_data);
bin : | |
func : | |
user_data : |
void gst_bin_set_pre_iterate_function (GstBin *bin, GstBinPrePostIterateFunction func, gpointer user_data);
bin : | |
func : | |
user_data : |
void gst_bin_child_state_change (GstBin *bin, GstElementState oldstate, GstElementState newstate, GstElement *child);
An internal function to inform the parent bin about a state change of a child.
bin : | GstBin with the child |
oldstate : | The old child state |
newstate : | The new child state |
child : | GstElement that signaled an changed state |
void gst_bin_auto_clock (GstBin *bin);
Let the bin select a clock automatically.
bin : | the bin to autoclock |
GstClock* gst_bin_get_clock (GstBin *bin);
Gets the current clock of the (scheduler of the) bin.
void user_function (GstBin *gstbin, GstElement *arg1, gpointer user_data);
gstbin : | the object which received the signal. |
arg1 : | the element that was added to the bin |
user_data : | user data set when the signal handler was connected. |
void user_function (GstBin *gstbin, GstElement *arg1, gpointer user_data);
gstbin : | the object which received the signal. |
arg1 : | the element that was removed from the bin |
user_data : | user data set when the signal handler was connected. |
gboolean user_function (GstBin *gstbin, gpointer user_data);
This signal is emitted when a bin iterates, either automatically or due to a #gst_bin_iterate() call. The return value is used to determine if the object method handler processed any data. In most normal cases, a user-provided signal handler should return FALSE.
gstbin : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
Returns : | TRUE if the state of the bin was advanced. |
<< GStreamer | GstBuffer >> |