From: Wim Taymans Date: Tue, 18 Nov 2008 09:58:33 +0000 (+0000) Subject: Add method to recalculate and redistribute the latency on a bin. X-Git-Tag: GIT_CONVERSION~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c311f2153a7f01de9a0be058e766b70ffa3cd9f4;p=platform%2Fupstream%2Fgstreamer.git 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(). --- diff --git a/ChangeLog b/ChangeLog index 73b5dcd..c3e01e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 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: Document the free_func. diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 79a76ad..27bc89c 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 0041f8c..c6b657a 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 5f024ad..6c56758 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