2004-01-28 15:51:14 +00:00
|
|
|
<chapter id="chapter-advanced-events">
|
2004-01-28 14:16:59 +00:00
|
|
|
<title>Events: Seeking, Navigation and More</title>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
There are many different event types but only two ways they can travel in
|
2004-01-29 12:46:19 +00:00
|
|
|
the pipeline: downstream or upstream. It is very important to understand
|
2006-08-17 18:11:11 +00:00
|
|
|
how both of these methods work because if one element in the pipeline is not
|
2004-01-29 12:46:19 +00:00
|
|
|
handling them correctly the whole event system of the pipeline is broken.
|
|
|
|
We will try to explain here how these methods work and how elements are
|
|
|
|
supposed to implement them.
|
2004-01-28 14:16:59 +00:00
|
|
|
</para>
|
2004-01-29 12:46:19 +00:00
|
|
|
<sect1 id="section-events-downstream" xreflabel="Downstream events">
|
|
|
|
<title>Downstream events</title>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
Downstream events are received through the sink pad's event handler,
|
|
|
|
as set using <function>gst_pad_set_event_function ()</function> when
|
|
|
|
the pad was created.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Downstream events can travel in two ways: they can be in-band (serialised
|
|
|
|
with the buffer flow) or out-of-band (travelling through the pipeline
|
|
|
|
instantly, possibly not in the same thread as the streaming thread that
|
|
|
|
is processing the buffers, skipping ahead of buffers being processed
|
|
|
|
or queued in the pipeline). The most common downstream events
|
2012-10-01 09:24:52 +00:00
|
|
|
(SEGMENT, CAPS, TAG, EOS) are all serialised with the buffer flow.
|
2006-08-17 18:11:11 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Here is a typical event function:
|
2004-01-29 12:46:19 +00:00
|
|
|
</para>
|
2004-02-02 21:52:46 +00:00
|
|
|
<programlisting>
|
2006-08-17 18:11:11 +00:00
|
|
|
static gboolean
|
2012-10-01 09:24:52 +00:00
|
|
|
gst_my_filter_sink_event (GstPad *pad, GstObject * parent, GstEvent * event)
|
2004-01-29 12:46:19 +00:00
|
|
|
{
|
2006-08-17 18:11:11 +00:00
|
|
|
GstMyFilter *filter;
|
|
|
|
gboolean ret;
|
2004-01-29 12:46:19 +00:00
|
|
|
|
2012-10-01 09:24:52 +00:00
|
|
|
filter = GST_MY_FILTER (parent);
|
2004-01-29 12:46:19 +00:00
|
|
|
...
|
|
|
|
|
2006-08-17 18:11:11 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2012-10-01 09:24:52 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
2006-08-17 18:11:11 +00:00
|
|
|
/* maybe save and/or update the current segment (e.g. for output
|
|
|
|
* clipping) or convert the event into one in a different format
|
2012-10-01 09:24:52 +00:00
|
|
|
* (e.g. BYTES to TIME) or drop it and set a flag to send a segment
|
2006-08-17 18:11:11 +00:00
|
|
|
* event in a different format later */
|
|
|
|
ret = gst_pad_push_event (filter->src_pad, event);
|
|
|
|
break;
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
/* end-of-stream, we should close down all stream leftovers here */
|
|
|
|
gst_my_filter_stop_processing (filter);
|
|
|
|
ret = gst_pad_push_event (filter->src_pad, event);
|
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
gst_my_filter_clear_temporary_buffers (filter);
|
|
|
|
ret = gst_pad_push_event (filter->src_pad, event);
|
|
|
|
break;
|
|
|
|
default:
|
2012-10-01 09:24:52 +00:00
|
|
|
ret = gst_pad_event_default (pad, parent, event);
|
2006-08-17 18:11:11 +00:00
|
|
|
break;
|
2004-01-29 12:46:19 +00:00
|
|
|
}
|
2006-08-17 18:11:11 +00:00
|
|
|
|
2004-01-29 12:46:19 +00:00
|
|
|
...
|
2006-08-17 18:11:11 +00:00
|
|
|
return ret;
|
2004-01-29 12:46:19 +00:00
|
|
|
}
|
2004-02-02 21:52:46 +00:00
|
|
|
</programlisting>
|
2006-08-17 18:11:11 +00:00
|
|
|
<para>
|
|
|
|
If your element is chain-based, you will almost always have to implement
|
|
|
|
a sink event function, since that is how you are notified about
|
2012-10-01 09:24:52 +00:00
|
|
|
segments, caps and the end of the stream.
|
2006-08-17 18:11:11 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If your element is exclusively loop-based, you may or may not want a
|
|
|
|
sink event function (since the element is driving the pipeline it will
|
|
|
|
know the length of the stream in advance or be notified by the flow
|
|
|
|
return value of <function>gst_pad_pull_range()</function>. In some cases
|
|
|
|
even loop-based element may receive events from upstream though (for
|
|
|
|
example audio decoders with an id3demux or apedemux element in front of
|
|
|
|
them, or demuxers that are being fed input from sources that send
|
|
|
|
additional information about the stream in custom events, as DVD sources
|
|
|
|
do).
|
|
|
|
</para>
|
2004-01-29 12:46:19 +00:00
|
|
|
</sect1>
|
|
|
|
<sect1 id="section-events-upstream" xreflabel="Upstream events">
|
|
|
|
<title>Upstream events</title>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
Upstream events are generated by an element somewhere downstream in
|
|
|
|
the pipeline (example: a video sink may generate navigation
|
|
|
|
events that informs upstream elements about the current position of
|
|
|
|
the mouse pointer). This may also happen indirectly on request of the
|
|
|
|
application, for example when the application executes a seek on a
|
|
|
|
pipeline this seek request will be passed on to a sink element which
|
|
|
|
will then in turn generate an upstream seek event.
|
|
|
|
</para>
|
|
|
|
<para>
|
2012-10-01 09:24:52 +00:00
|
|
|
The most common upstream events are seek events, Quality-of-Service
|
|
|
|
(QoS) and reconfigure events.
|
2006-08-17 18:11:11 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
An upstream event can be sent using the
|
|
|
|
<function>gst_pad_send_event</function> function. This
|
|
|
|
function simply call the default event handler of that pad. The default
|
|
|
|
event handler of pads is <function>gst_pad_event_default</function>, and
|
2012-10-01 09:24:52 +00:00
|
|
|
it basically sends the event to the peer of the internally linked pad.
|
|
|
|
So upstream events always arrive on the src pad of your element and are
|
|
|
|
handled by the default event handler except if you override that handler
|
|
|
|
to handle it yourself. There are some specific cases where you have to
|
|
|
|
do that :
|
2004-01-29 12:46:19 +00:00
|
|
|
</para>
|
|
|
|
<itemizedlist mark="opencircle">
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If you have multiple sink pads in your element. In that case you will
|
2006-08-17 18:11:11 +00:00
|
|
|
have to decide which one of the sink pads you will send the event to
|
|
|
|
(if not all of them).
|
2004-01-29 12:46:19 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If you need to handle that event locally. For example a navigation
|
2006-08-17 18:11:11 +00:00
|
|
|
event that you will want to convert before sending it upstream, or
|
|
|
|
a QoS event that you want to handle.
|
2004-01-29 12:46:19 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
<para>
|
|
|
|
The processing you will do in that event handler does not really matter
|
|
|
|
but there are important rules you have to absolutely respect because
|
|
|
|
one broken element event handler is breaking the whole pipeline event
|
|
|
|
handling. Here they are :
|
|
|
|
</para>
|
|
|
|
<itemizedlist mark="opencircle">
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-10-01 09:24:52 +00:00
|
|
|
Always handle events you won't handle using the default
|
|
|
|
<function>gst_pad_event_default</function> method. This method will
|
|
|
|
depending on the event, forward the event or drop it.
|
2004-01-29 12:46:19 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If you are generating some new event based on the one you received
|
|
|
|
don't forget to gst_event_unref the event you received.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Event handler function are supposed to return TRUE or FALSE indicating
|
|
|
|
if the event has been handled or not. Never simply return TRUE/FALSE
|
|
|
|
in that handler except if you really know that you have handled that
|
|
|
|
event.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
2006-08-17 18:11:11 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Remember that the event handler might be called from a different
|
|
|
|
thread than the streaming thread, so make sure you use
|
2012-10-01 09:24:52 +00:00
|
|
|
appropriate locking everywhere.
|
2006-08-17 18:11:11 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
2004-01-29 12:46:19 +00:00
|
|
|
</itemizedlist>
|
2004-02-02 21:52:46 +00:00
|
|
|
</sect1>
|
|
|
|
|
|
|
|
<sect1 id="section-events-definitions" xreflabel="All Events Together">
|
|
|
|
<title>All Events Together</title>
|
|
|
|
<para>
|
|
|
|
In this chapter follows a list of all defined events that are currently
|
2006-08-17 18:11:11 +00:00
|
|
|
being used, plus how they should be used/interpreted. You can check the
|
|
|
|
what type a certain event is using the GST_EVENT_TYPE macro (or if you
|
|
|
|
need a string for debugging purposes you can use GST_EVENT_TYPE_NAME).
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
In this chapter, we will discuss the following events:
|
|
|
|
</para>
|
|
|
|
<itemizedlist>
|
2012-10-01 09:24:52 +00:00
|
|
|
<listitem><para><xref linkend="section-events-stream-start"/></para></listitem>
|
|
|
|
<listitem><para><xref linkend="section-events-caps"/></para></listitem>
|
|
|
|
<listitem><para><xref linkend="section-events-segment"/></para></listitem>
|
|
|
|
<listitem><para><xref linkend="section-events-tag"/></para></listitem>
|
2004-02-02 21:52:46 +00:00
|
|
|
<listitem><para><xref linkend="section-events-eos"/></para></listitem>
|
2012-10-01 09:24:52 +00:00
|
|
|
<listitem><para><xref linkend="section-events-toc"/></para></listitem>
|
|
|
|
<listitem><para><xref linkend="section-events-gap"/></para></listitem>
|
2006-08-17 18:11:11 +00:00
|
|
|
<listitem><para><xref linkend="section-events-flush-start"/></para></listitem>
|
|
|
|
<listitem><para><xref linkend="section-events-flush-stop"/></para></listitem>
|
2012-10-01 09:24:52 +00:00
|
|
|
<listitem><para><xref linkend="section-events-qos"/></para></listitem>
|
2004-02-02 21:52:46 +00:00
|
|
|
<listitem><para><xref linkend="section-events-seek"/></para></listitem>
|
|
|
|
<listitem><para><xref linkend="section-events-nav"/></para></listitem>
|
|
|
|
</itemizedlist>
|
2006-08-17 18:11:11 +00:00
|
|
|
<para>
|
|
|
|
For more comprehensive information about events and how they should be
|
|
|
|
used correctly in various circumstances please consult the GStreamer
|
|
|
|
design documentation. This section only gives a general overview.
|
|
|
|
</para>
|
2004-02-02 21:52:46 +00:00
|
|
|
|
2012-10-01 09:24:52 +00:00
|
|
|
<sect2 id="section-events-stream-start" xreflabel="Stream Start">
|
|
|
|
<title>Stream Start</title>
|
|
|
|
<para>
|
|
|
|
WRITEME
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="section-events-caps" xreflabel="Caps">
|
|
|
|
<title>Caps</title>
|
|
|
|
<para>
|
2012-10-16 09:54:54 +00:00
|
|
|
The CAPS event contains the format description of the following
|
|
|
|
buffers. See <xref linkend="chapter-negotiation"/> for more
|
|
|
|
information about negotiation.
|
2012-10-01 09:24:52 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="section-events-segment" xreflabel="Segment">
|
|
|
|
<title>Segment</title>
|
|
|
|
<para>
|
|
|
|
A segment event is sent downstream to announce the range of valid
|
|
|
|
timestamps in the stream and how they should be transformed into
|
|
|
|
running-time and stream-time. A segment event must always be sent
|
|
|
|
before the first buffer of data and after a flush (see above).
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The first segment event is created by the element driving the
|
|
|
|
pipeline, like a source operating in push-mode or a demuxer/decoder
|
|
|
|
operating pull-based. This segment event then travels down the
|
|
|
|
pipeline and may be transformed on the way (a decoder, for example,
|
|
|
|
might receive a segment event in BYTES format and might transform
|
|
|
|
this into a segment event in TIMES format based on the average
|
|
|
|
bitrate).
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Depending on the element type, the event can simply be forwarded using
|
|
|
|
<function>gst_pad_event_default ()</function>, or it should be parsed
|
|
|
|
and a modified event should be sent on. The last is true for demuxers,
|
|
|
|
which generally have a byte-to-time conversion concept. Their input
|
|
|
|
is usually byte-based, so the incoming event will have an offset in
|
|
|
|
byte units (<symbol>GST_FORMAT_BYTES</symbol>), too. Elements
|
|
|
|
downstream, however, expect segment events in time units, so that
|
|
|
|
it can be used to synchronize against the pipeline clock. Therefore,
|
|
|
|
demuxers and similar elements should not forward the event, but parse
|
|
|
|
it, free it and send a segment event (in time units,
|
|
|
|
<symbol>GST_FORMAT_TIME</symbol>) further downstream.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The segment event is created using the function
|
|
|
|
<function>gst_event_new_segment ()</function>. See the API
|
|
|
|
reference and design document for details about its parameters.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Elements parsing this event can use gst_event_parse_segment()
|
|
|
|
to extract the event details. Elements may find the GstSegment
|
|
|
|
API useful to keep track of the current segment (if they want to use
|
|
|
|
it for output clipping, for example).
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="section-events-tag" xreflabel="Tag (metadata)">
|
|
|
|
<title>Tag (metadata)</title>
|
|
|
|
<para>
|
|
|
|
Tagging events are being sent downstream to indicate the tags as parsed
|
|
|
|
from the stream data. This is currently used to preserve tags during
|
|
|
|
stream transcoding from one format to the other. Tags are discussed
|
|
|
|
extensively in <xref linkend="chapter-advanced-tagging"/>. Most
|
|
|
|
elements will simply forward the event by calling
|
|
|
|
<function>gst_pad_event_default ()</function>.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The tag event is created using the function
|
|
|
|
<function>gst_event_new_tag ()</function>, but more often elements will
|
|
|
|
send a tag event downstream that will be converted into a message
|
|
|
|
on the bus by sink elements.
|
|
|
|
All of these functions require a filled-in taglist as
|
|
|
|
argument, which they will take ownership of.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Elements parsing this event can use the function
|
|
|
|
<function>gst_event_parse_tag ()</function> to acquire the
|
|
|
|
taglist that the event contains.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
2004-02-02 21:52:46 +00:00
|
|
|
<sect2 id="section-events-eos" xreflabel="End of Stream (EOS)">
|
|
|
|
<title>End of Stream (EOS)</title>
|
|
|
|
<para>
|
|
|
|
End-of-stream events are sent if the stream that an element sends out
|
|
|
|
is finished. An element receiving this event (from upstream, so it
|
2006-08-17 18:11:11 +00:00
|
|
|
receives it on its sinkpad) will generally just process any buffered
|
|
|
|
data (if there is any) and then forward the event further downstream.
|
|
|
|
The <function>gst_pad_event_default ()</function> takes care of all
|
|
|
|
this, so most elements do not need to support this event. Exceptions are
|
2004-07-21 11:32:09 +00:00
|
|
|
elements that explicitly need to close a resource down on EOS, and
|
2004-02-02 21:52:46 +00:00
|
|
|
N-to-1 elements. Note that the stream itself is <emphasis>not</emphasis>
|
|
|
|
a resource that should be closed down on EOS! Applications might seek
|
2006-08-17 18:11:11 +00:00
|
|
|
back to a point before EOS and continue playing again.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
The EOS event has no properties, which makes it one of the simplest
|
|
|
|
events in &GStreamer;. It is created using the
|
|
|
|
<function>gst_event_new_eos()</function> function.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
It is important to note that <emphasis>only elements driving the
|
|
|
|
pipeline should ever send an EOS event</emphasis>. If your element
|
|
|
|
is chain-based, it is not driving the pipeline. Chain-based elements
|
2012-03-28 16:12:23 +00:00
|
|
|
should just return GST_FLOW_EOS from their chain function at
|
2006-08-17 18:11:11 +00:00
|
|
|
the end of the stream (or the configured segment), the upstream
|
|
|
|
element that is driving the pipeline will then take care of
|
|
|
|
sending the EOS event (or alternatively post a SEGMENT_DONE message
|
|
|
|
on the bus depending on the mode of operation). If you are implementing
|
|
|
|
your own source element, you also do not need to ever manually send
|
2012-03-28 16:12:23 +00:00
|
|
|
an EOS event, you should also just return GST_FLOW_EOS in
|
2012-10-01 09:24:52 +00:00
|
|
|
your create or fill function (assuming your element derives from
|
|
|
|
GstBaseSrc or GstPushSrc).
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="section-events-toc" xreflabel="Table Of Contents">
|
|
|
|
<title>Table Of Contents</title>
|
|
|
|
<para>
|
|
|
|
WRITEME
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="section-events-gap" xreflabel="Gap">
|
|
|
|
<title>Gap</title>
|
|
|
|
<para>
|
|
|
|
WRITEME
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
2006-08-17 18:11:11 +00:00
|
|
|
<sect2 id="section-events-flush-start" xreflabel="Flush Start">
|
|
|
|
<title>Flush Start</title>
|
2004-02-02 21:52:46 +00:00
|
|
|
<para>
|
2012-10-01 09:24:52 +00:00
|
|
|
The flush start event is sent downstream (in push mode) or upstream
|
|
|
|
(in pull mode) if all buffers and caches in the pipeline should be
|
|
|
|
emptied. <quote>Queue</quote> elements will
|
2004-02-02 21:52:46 +00:00
|
|
|
empty their internal list of buffers when they receive this event, for
|
|
|
|
example. File sink elements (e.g. <quote>filesink</quote>) will flush
|
|
|
|
the kernel-to-disk cache (<function>fdatasync ()</function> or
|
|
|
|
<function>fflush ()</function>) when they receive this event. Normally,
|
|
|
|
elements receiving this event will simply just forward it, since most
|
|
|
|
filter or filter-like elements don't have an internal cache of data.
|
|
|
|
<function>gst_pad_event_default ()</function> does just that, so for
|
|
|
|
most elements, it is enough to forward the event using the default
|
|
|
|
event handler.
|
|
|
|
</para>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
As a side-effect of flushing all data from the pipeline, this event
|
|
|
|
unblocks the streaming thread by making all pads reject data until
|
|
|
|
they receive a <xref linkend="section-events-flush-stop"/> signal
|
2012-05-11 07:07:16 +00:00
|
|
|
(elements trying to push data will get a FLUSHING flow return
|
2006-08-17 18:11:11 +00:00
|
|
|
and stop processing data).
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The flush-start event is created with the
|
|
|
|
<function>gst_event_new_flush_start ()</function>.
|
|
|
|
Like the EOS event, it has no properties. This event is usually
|
|
|
|
only created by elements driving the pipeline, like source elements
|
|
|
|
operating in push-mode or pull-range based demuxers/decoders.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
2006-08-17 18:11:11 +00:00
|
|
|
<sect2 id="section-events-flush-stop" xreflabel="Flush Stop">
|
|
|
|
<title>Flush Stop</title>
|
|
|
|
<para>
|
|
|
|
The flush-stop event is sent by an element driving the pipeline
|
|
|
|
after a flush-start and tells pads and elements downstream that
|
|
|
|
they should accept events and buffers again (there will be at
|
2012-10-01 09:24:52 +00:00
|
|
|
least a SEGMENT event before any buffers first though).
|
2006-08-17 18:11:11 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If your element keeps temporary caches of stream data, it should
|
|
|
|
clear them when it receives a FLUSH-STOP event (and also whenever
|
|
|
|
its chain function receives a buffer with the DISCONT flag set).
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The flush-stop event is created with
|
2012-10-01 09:24:52 +00:00
|
|
|
<function>gst_event_new_flush_stop ()</function>. It has one
|
|
|
|
parameter that controls if the running-time of the pipeline should
|
|
|
|
be reset to 0 or not. Normally aftera flushing seek, the
|
|
|
|
running_time is set back to 0.
|
2006-08-17 18:11:11 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
2012-10-01 09:24:52 +00:00
|
|
|
<sect2 id="section-events-qos" xreflabel="Quality Of Service (QOS)">
|
|
|
|
<title>Quality Of Service (QOS)</title>
|
2004-02-02 21:52:46 +00:00
|
|
|
<para>
|
2012-10-16 09:54:54 +00:00
|
|
|
The QOS event contains a report about the current real-time
|
|
|
|
performance of the stream. See more info in
|
|
|
|
<xref linkend="chapter-advanced-qos"/>.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="section-events-seek" xreflabel="Seek Request">
|
|
|
|
<title>Seek Request</title>
|
|
|
|
<para>
|
|
|
|
Seek events are meant to request a new stream position to elements.
|
|
|
|
This new position can be set in several formats (time, bytes or
|
2006-08-17 18:11:11 +00:00
|
|
|
<quote>default units</quote> [a term indicating frames for video,
|
|
|
|
channel-independent samples for audio, etc.]). Seeking can be done with
|
2012-10-01 09:24:52 +00:00
|
|
|
respect to the end-of-file or start-of-file, and
|
2006-08-17 18:11:11 +00:00
|
|
|
usually happens in upstream direction (downstream seeking is done by
|
2012-10-01 09:24:52 +00:00
|
|
|
sending a SEGMENT event with the appropriate offsets for elements
|
2006-08-17 18:11:11 +00:00
|
|
|
that support that, like filesink).
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
Elements receiving seek events should, depending on the element type,
|
|
|
|
either just forward it upstream (filters, decoders), change the
|
|
|
|
format in which the event is given and then forward it (demuxers),
|
|
|
|
or handle the event by changing the file pointer in their internal
|
|
|
|
stream resource (file sources, demuxers/decoders driving the pipeline
|
|
|
|
in pull-mode) or something else.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
Seek events are built up using positions in specified formats (time,
|
|
|
|
bytes, units). They are created using the function
|
|
|
|
<function>gst_event_new_seek ()</function>. Note that many plugins do
|
2012-10-01 09:24:52 +00:00
|
|
|
not support seeking from the end of the stream.
|
|
|
|
An element not driving the pipeline and forwarding a seek
|
2006-08-17 18:11:11 +00:00
|
|
|
request should not assume that the seek succeeded or actually happened,
|
2012-10-01 09:24:52 +00:00
|
|
|
it should operate based on the SEGMENT events it receives.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
Elements parsing this event can do this using
|
|
|
|
<function>gst_event_parse_seek()</function>.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
2006-08-17 18:11:11 +00:00
|
|
|
<sect2 id="section-events-nav" xreflabel="Navigation">
|
|
|
|
<title>Navigation</title>
|
2004-02-02 21:52:46 +00:00
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
Navigation events are sent upstream by video sinks to inform upstream
|
|
|
|
elements of where the mouse pointer is, if and where mouse pointer
|
|
|
|
clicks have happened, or if keys have been pressed or released.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
All this information is contained in the event structure which can
|
|
|
|
be obtained with <function>gst_event_get_structure ()</function>.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2006-08-17 18:11:11 +00:00
|
|
|
Check out the navigationtest element in gst-plugins-good for an idea
|
|
|
|
how to extract navigation information from this event.
|
2004-02-02 21:52:46 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
2004-01-29 12:46:19 +00:00
|
|
|
</sect1>
|
2004-01-28 14:16:59 +00:00
|
|
|
</chapter>
|