GStreamer Application Development Manual | ||
---|---|---|
<<< Previous | Next >>> |
A Bin is a container element. You can add elements to a bin. Since a bin is
an GstElement
itself, it can also be added to another bin.
Bins allow you to combine linked elements into one logical element. You do not deal with the individual elements anymore but with just one element, the bin. We will see that this is extremely powerful when you are going to construct complex pipelines since it allows you to break up the pipeline in smaller chunks.
The bin will also manage the elements contained in it. It will figure out how the data will flow in the bin and generate an optimal plan for that data flow. Plan generation is one of the most complicated procedures in GStreamer.
There are two standard bins available to the GStreamer programmer:
A pipeline (GstPipeline
). Which is a generic container you will
use most of the time. The toplevel bin has to be a pipeline.
A thread (GstThread
). The plan for the
GstThread
will be run in a separate thread. You will have to use
this bin if you have to carefully synchronize audio and video, for example. You will learn
more about threads in the chapter called Threads.
Bins are created in the same way that other elements are created. ie. using an element factory, or any of the associated convenience functions:
GstElement *bin, *thread, *pipeline; /* create a new bin called 'mybin'. this bin will be only for organizational purposes; a normal GstBin doesn't affect plan generation */ bin = gst_element_factory_make ("bin", "mybin"); /* create a new thread, and give it a unique name */ thread = gst_element_factory_make ("thread", NULL); /* the core bins (GstBin, GstThread, GstPipeline) also have convenience APIs, gst_<bintype>_new (). these are equivalent to the gst_element_factory_make () syntax. */ pipeline = gst_pipeline_new ("pipeline_name"); |
<<< Previous | Home | Next >>> |
Making filtered links | Up | Adding elements to a bin |