GStreamer Application Development Manual | ||
---|---|---|
<<< Previous | GstElement | Next >>> |
GstElements are created from factories. To create an element, one has to get access the a GstElementFactory using a unique factoryname.
The following code example is used to get a factory that can be used to create the mpg123 element, an mp3 decoder.
GstElementFactory *factory; factory = gst_elementfactory_find ("mpg123"); |
Once you have the handle to the elementfactory, you can create a real element with the following code fragment:
GstElement *element; element = gst_elementfactory_create (factory, "decoder"); |
gst_elementfactory_create () will use the elementfactory to create an element with the given name. The name of the element is something you can use later on to lookup the element in a bin, for example.
A simple shortcut exists for creating an element from a factory. The following example creates an element, named "decoder" from the elementfactory named "mpg123". This convenient function is most widly used to create an element.
GstElement *element; element = gst_elementfactory_make ("mpg123", "decoder"); |
An element can be destroyed with:
GstElement *element; ... gst_element_destroy (element); |
<<< Previous | Home | Next >>> |
GstElement | Up | What are Plugins |