Add method to recalculate and redistribute the latency on a bin.

Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (gst_bin_recalculate_latency),
(gst_bin_change_state_func):
* gst/gstbin.h:
Add method to recalculate and redistribute the latency on a bin.
API: gst_bin_recalculate_latency().
This commit is contained in:
Wim Taymans 2008-11-18 09:58:33 +00:00
parent cc5c8784cb
commit c311f2153a
4 changed files with 37 additions and 5 deletions

View file

@ -1,3 +1,12 @@
2008-11-18 Wim Taymans <wim.taymans@collabora.co.uk>
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (gst_bin_recalculate_latency),
(gst_bin_change_state_func):
* gst/gstbin.h:
Add method to recalculate and redistribute the latency on a bin.
API: gst_bin_recalculate_latency().
2008-11-18 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/gstbuffer.h:

View file

@ -56,6 +56,8 @@ gst_bin_iterate_sorted
gst_bin_iterate_sources
gst_bin_iterate_all_by_interface
gst_bin_recalculate_latency
<SUBSECTION>
gst_bin_add_many
gst_bin_remove_many

View file

@ -2076,15 +2076,32 @@ failed:
}
}
/* do latency correction. We do a latency query on the bin, and then send a
* LATENCY event on the elements fo configure them */
static gboolean
do_bin_latency (GstElement * element)
/**
* gst_bin_recalculate_latency:
* @bin: a #GstBin
*
* Query @bin for the current latency using and reconfigures this latency to all the
* elements with a LATENCY event.
*
* This method is typically called on the pipeline when a #GST_MESSAGE_LATENCY
* is posted on the bus.
*
* Returns: %TRUE if the latency could be queried and reconfigured.
*
* Since: 0.10.22.
*/
gboolean
gst_bin_recalculate_latency (GstBin * bin)
{
GstQuery *query;
GstElement *element;
GstClockTime min_latency, max_latency;
gboolean res;
g_return_val_if_fail (GST_IS_BIN (bin), FALSE);
element = GST_ELEMENT_CAST (bin);
GST_DEBUG_OBJECT (element, "querying latency");
query = gst_query_new_latency ();
@ -2161,7 +2178,7 @@ gst_bin_change_state_func (GstElement * element, GstStateChange transition)
GST_OBJECT_UNLOCK (bin);
if (toplevel)
do_bin_latency (element);
gst_bin_recalculate_latency (bin);
break;
}
case GST_STATE_PAUSED:

View file

@ -175,6 +175,10 @@ GstIterator* gst_bin_iterate_sinks (GstBin *bin);
GstIterator* gst_bin_iterate_sources (GstBin *bin);
GstIterator* gst_bin_iterate_all_by_interface (GstBin *bin, GType iface);
/* latency */
gboolean gst_bin_recalculate_latency (GstBin * bin);
G_END_DECLS