diff --git a/ChangeLog b/ChangeLog index 73b5dcdea5..c3e01e64c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-11-18 Wim Taymans + + * 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 * gst/gstbuffer.h: diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 79a76ad3e2..27bc89c0dd 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -56,6 +56,8 @@ gst_bin_iterate_sorted gst_bin_iterate_sources gst_bin_iterate_all_by_interface +gst_bin_recalculate_latency + gst_bin_add_many gst_bin_remove_many diff --git a/gst/gstbin.c b/gst/gstbin.c index 0041f8c462..c6b657a486 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -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: diff --git a/gst/gstbin.h b/gst/gstbin.h index 5f024ad38a..6c56758b88 100644 --- a/gst/gstbin.h +++ b/gst/gstbin.h @@ -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