More on MIME Types

GStreamer uses MIME types to identify the different types of data that can be handled by the elements. They are the high level mechanisms to make sure that everyone is talking about the right kind of data.

A MIME (Multipurpose Internet Mail Extension) type is a pair of strings that denote a certain type of data. Examples include:

An element must associate a MIME type to its source and sink pads when it is loaded into the system. GStreamer knows about the different elements and what type of data they expect and emit. This allows for very dynamic and extensible element creation as we will see.

As we have seen in the previous chapter, MIME types are added to the Capability structure of a pad.

In our helloworld example the elements we constructed would have the following MIME types associated with their source and sink pads:

Figure 13.1. The Hello world pipeline with MIME types

The Hello world pipeline with MIME types

We will see how you can create an element based on the MIME types of its source and sink pads. This way the end-user will have the ability to choose his/her favorite audio/mpeg decoder without you even having to care about it.

The typing of the source and sink pads also makes it possible to 'autoplug' a pipeline. We will have the ability to say: "construct me a pipeline that does an audio/mpeg to audio/raw conversion".

Note

The basic GStreamer library does not try to solve all of your autoplug problems. It leaves the hard decisions to the application programmer, where they belong.