use GST_MESSAGE_DURATION_CHANGED in docs and code

This commit is contained in:
Wim Taymans 2013-02-26 15:32:25 +01:00
parent f37fc1d299
commit d7f15f542a
3 changed files with 11 additions and 10 deletions

View file

@ -95,11 +95,12 @@ returned durations and will then cache the result so that any further query can
use the cached version. The reason for caching the result is because the
duration of a stream typically does not change that often.
A GST_MESSAGE_DURATION posted by an element will clear the cached duration value
so that the bin will query the sinks again. This message is typically posted by
elements that calculate the duration of the stream based on some average
bitrate, which might change while playing the stream. The DURATION message is
posted to the application, which can then fetch the updated DURATION.
A GST_MESSAGE_DURATION_CHANGED posted by an element will clear the cached
duration value so that the bin will query the sinks again. This message is
typically posted by elements that calculate the duration of the stream based
on some average bitrate, which might change while playing the stream. The
DURATION_CHANGED message is posted to the application, which can then fetch
the updated DURATION.
Subclassing

View file

@ -110,7 +110,7 @@ GST_MESSAGE_SEGMENT_DONE:
An element or bin completed playback of a segment. This message is only posted
on the bus if a SEGMENT seek is performed on a pipeline.
GST_MESSAGE_DURATION:
GST_MESSAGE_DURATION_CHANGED:
An element posts this message when it has detected or updated the stream duration.

View file

@ -3262,8 +3262,8 @@ bin_do_message_forward (GstBin * bin, GstMessage * message)
* result so we can answer it quicker the next time. Any element that
* changes its duration marks our cached values invalid.
* This message is also posted upwards. This is currently disabled
* because too many elements don't post DURATION messages when the
* duration changes.
* because too many elements don't post DURATION_CHANGED messages when
* the duration changes.
*
* GST_MESSAGE_CLOCK_LOST: This message is posted by an element when it
* can no longer provide a clock. The default bin behaviour is to
@ -3426,7 +3426,7 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
* for duration, we will recalculate. */
#if 0
GST_OBJECT_LOCK (bin);
bin_remove_messages (bin, NULL, GST_MESSAGE_DURATION);
bin_remove_messages (bin, NULL, GST_MESSAGE_DURATION_CHANGED);
GST_OBJECT_UNLOCK (bin);
#endif
goto forward;
@ -3857,7 +3857,7 @@ gst_bin_query (GstElement * element, GstQuery * query)
for (cached = bin->messages; cached; cached = g_list_next (cached)) {
GstMessage *message = (GstMessage *) cached->data;
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DURATION &&
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DURATION_CHANGED &&
GST_MESSAGE_SRC (message) == GST_OBJECT_CAST (bin)) {
GstFormat format;
gint64 duration;