Elements Creating a GstElement The simplest way to create an element is to use gst_element_factory_make . This function takes a factory name and an element name for the newly created element. The name of the element is something you can use later on to look up the element in a bin, for example. You can pass NULL as the name argument to get a unique, default name. When you don't need the element anymore, you need to unref it using gst_object_unref. This decreases the reference count for the element by 1. An element has a refcount of 1 when it gets created. An element gets destroyed completely when the refcount is decreased to 0. The following example &EXAFOOT; shows how to create an element named source from the element factory named fakesrc. It checks if the creation succeeded. After checking, it unrefs the element. int main (int argc, char *argv[]) { GstElement *element; gst_init (&argc, &argv); element = gst_element_factory_make ("fakesrc", "source"); if (!element) { g_error ("Could not create an element from 'fakesrc' factory.\n"); } gst_object_unref (GST_OBJECT (element)); return 0; } /* example-end elementmake.c */ ]]> gst_element_factory_make is actually a shorthand for a combination of two functions. A GstElement object is created from a factory. To create the element, you have to get access to a GstElementFactory object using a unique factory name. This is done with gst_element_factory_find. The following code fragment is used to get a factory that can be used to create the fakesrc element, a fake data source. GstElementFactory *factory; factory = gst_element_factory_find ("fakesrc"); Once you have the handle to the element factory, you can create a real element with the following code fragment: GstElement *element; element = gst_element_factory_create (factory, "source"); gst_element_factory_create will use the element factory to create an element with the given name. GstElement properties A GstElement can have several properties which are implemented using standard GObject properties. The usual GObject methods to query, set and get property values and GParamSpecs are therefore supported. Every GstElement inherits at least one property of its parent GstObject: the "name" property. This is the name you provide to the functions gst_element_factory_make or gst_element_factory_create. You can get and set this property using the functions gst_object_set_name and gst_object_get_name or use the GObject property mechanism as shown below. int main (int argc, char *argv[]) { GstElement *element; GValue value = { 0, }; /* initialize the GValue for g_object_get() */ gst_init (&argc, &argv); element = gst_element_factory_make ("fakesrc", "source"); g_object_set (G_OBJECT (element), "name", "mysource", NULL); g_value_init (&value, G_TYPE_STRING); g_object_get_property (G_OBJECT (element), "name", &value); g_print ("The name of the source is '%s'.\n", g_value_get_string (&value)); return 0; } /* example-end elementget.c */ ]]> Most plugins provide additional properties to provide more information about their configuration or to configure the element. gst-inspect is a useful tool to query the properties of a particular element, it will also use property introspection to give a short explanation about the function of the property and about the parameter types and ranges it supports. For more information about GObject properties we recommend you read the GObject manual and an introduction to The Glib Object system. GstElement signals A GstElement also provides various GObject signals that can be used as a flexible callback mechanism. More about GstElementFactory We talk some more about the GstElementFactory object. Getting information about an element using the factory details Finding out what pads an element can contain Different ways of querying the factories