Add method to recalculate and redistribute the latency on a bin.
authorWim Taymans <wim.taymans@gmail.com>
Tue, 18 Nov 2008 09:58:33 +0000 (09:58 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 18 Nov 2008 09:58:33 +0000 (09:58 +0000)
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().

ChangeLog
docs/gst/gstreamer-sections.txt
gst/gstbin.c
gst/gstbin.h

index 73b5dcd..c3e01e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 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:
        Document the free_func.
 
index 79a76ad..27bc89c 100644 (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
index 0041f8c..c6b657a 100644 (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:
index 5f024ad..6c56758 100644 (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