GStreamer Application Development Manual (0.10.12) | ||
---|---|---|
<<< Previous | Next >>> |
GStreamer makes a clear distinction between two types of metadata, and
has support for both types. The first is stream tags, which describe the
content of a stream in a non-technical way. Examples include the author
of a song, the title of that very same song or the album it is a part of.
The other type of metadata is stream-info, which is a somewhat technical
description of the properties of a stream. This can include video size,
audio samplerate, codecs used and so on. Tags are handled using the
GStreamer tagging system. Stream-info can be retrieved from a
GstPad
.
Stream information can most easily be read by reading them from a
GstPad
. This has already been discussed before
in the Section called Using capabilities for metadata in the chapter called Pads and capabilities. Therefore, we will skip
it here. Note that this requires access to all pads of which you
want stream information.
Tag reading is done through a bus in GStreamer, which has been
discussed previously in the chapter called Bus. You can
listen for GST_MESSAGE_TAG
messages and handle
them as you wish.
Note, however, that the GST_MESSAGE_TAG
message may be fired multiple times in the pipeline. It is the
application's responsibility to put all those tags together and
display them to the user in a nice, coherent way. Usually, using
gst_tag_list_merge () is a good enough way
of doing this; make sure to empty the cache when loading a new song,
or after every few minutes when listening to internet radio. Also,
make sure you use GST_TAG_MERGE_PREPEND
as
merging mode, so that a new title (which came in later) has a
preference over the old one for display.
<<< Previous | Home | Next >>> |
Events: seeking (and more) | Up | Tag writing |