Events are control particles that are sent both up- and downstream in a pipeline along with buffers. Downstream events notify fellow elements of stream states. Possible events include discontinuities, flushes, end-of-stream notifications and so on. Upstream events are used both in application-element interaction as well as event-event interaction to request changes in stream state, such as seeks. For applications, only upstream events are important. Downstream events are just explained to get a more complete picture of the data concept.
Since most applications seek in time units, our example below does so too:
static void
seek_to_time (GstElement *element,
guint64 time_ns)
{
GstEvent *event;
event = gst_event_new_seek (GST_SEEK_METHOD_SET |
GST_FORMAT_TIME,
time_ns);
gst_element_send_event (element, event);
}
The function gst_element_seek () is a shortcut
for this. This is mostly just to show how it all works.