Chapter 6. GstPad

As we have seen in the previous chapter (GstElement), the pads are the elements connections with the outside world.

The specific type of media that the element can handle will be exposed by the pads. The description of this media type is done with capabilities (GstCaps)

Getting pads from an element

Once you have created an element, you can get one of its pads with:

 GstPad *srcpad;
    ...
 srcpad = gst_element_get_pad (element, "src");
    ...
    

This function will get the pad named "src" from the given element.

Alternatively, you can also request a GList of pads from the element. The following code example will print the names of all the pads of an element.

 GList *pads;
    ...
 pads = gst_element_get_pad_list (element);
 while (pads) {
   GstPad *pad = GST_PAD (pads-data);

   g_print ("pad name %s\n", gst_pad_get_name (pad));
   
   pads = g_list_next (pads);
 }
    ...