API: gst_collect_pads_set_flushing
authorWim Taymans <wim.taymans@gmail.com>
Mon, 29 May 2006 16:00:13 +0000 (16:00 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 29 May 2006 16:00:13 +0000 (16:00 +0000)
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstcollectpads.c:
(gst_collect_pads_set_flushing_unlocked),
(gst_collect_pads_set_flushing), (gst_collect_pads_start),
(gst_collect_pads_stop):
* libs/gst/base/gstcollectpads.h:
API: gst_collect_pads_set_flushing
Added api to set the pads to flushing, usefull for seeking
code in elements using collectpads.
Clear segment when receiving a flush.

ChangeLog
docs/libs/gstreamer-libs-sections.txt
libs/gst/base/gstcollectpads.c
libs/gst/base/gstcollectpads.h

index 30d7f14..15b2886 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-05-29  Wim Taymans  <wim@fluendo.com>
+
+       * docs/libs/gstreamer-libs-sections.txt:
+       * libs/gst/base/gstcollectpads.c:
+       (gst_collect_pads_set_flushing_unlocked),
+       (gst_collect_pads_set_flushing), (gst_collect_pads_start),
+       (gst_collect_pads_stop):
+       * libs/gst/base/gstcollectpads.h:
+       API: gst_collect_pads_set_flushing
+       Added api to set the pads to flushing, usefull for seeking
+       code in elements using collectpads.
+       Clear segment when receiving a flush.
+
 2006-05-29  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/gst.c: (add_path_func), (init_post):
index c22be80..2e13f1c 100644 (file)
@@ -233,6 +233,7 @@ gst_collect_pads_collect
 gst_collect_pads_collect_range
 gst_collect_pads_start
 gst_collect_pads_stop
+gst_collect_pads_set_flushing
 gst_collect_pads_peek
 gst_collect_pads_pop
 gst_collect_pads_available
index d1f37d9..376f39e 100644 (file)
@@ -395,7 +395,8 @@ gst_collect_pads_collect_range (GstCollectPads * pads, guint64 offset,
  * Must be called with PAD_LOCK.
  */
 static void
-gst_collect_pads_set_flushing (GstCollectPads * pads, gboolean flushing)
+gst_collect_pads_set_flushing_unlocked (GstCollectPads * pads,
+    gboolean flushing)
 {
   GSList *walk = NULL;
 
@@ -409,12 +410,37 @@ gst_collect_pads_set_flushing (GstCollectPads * pads, gboolean flushing)
         GST_PAD_SET_FLUSHING (cdata->pad);
       else
         GST_PAD_UNSET_FLUSHING (cdata->pad);
+      cdata->abidata.ABI.flushing = flushing;
       GST_OBJECT_UNLOCK (cdata->pad);
     }
   }
 }
 
 /**
+ * gst_collect_pads_set_flushing:
+ * @pads: the collectspads to use
+ * @flushing: desired state of the pads
+ *
+ * Change the flushing state of all the pads in the collection. No pad
+ * is able to accept anymore data when @flushing is %TRUE. Calling this
+ * function with @flushing %TRUE makes @pads accept data again.
+ *
+ * MT safe.
+ *
+ * Since: 0.10.7.
+ */
+void
+gst_collect_pads_set_flushing (GstCollectPads * pads, gboolean flushing)
+{
+  g_return_if_fail (pads != NULL);
+  g_return_if_fail (GST_IS_COLLECT_PADS (pads));
+
+  GST_COLLECT_PADS_PAD_LOCK (pads);
+  gst_collect_pads_set_flushing_unlocked (pads, flushing);
+  GST_COLLECT_PADS_PAD_UNLOCK (pads);
+}
+
+/**
  * gst_collect_pads_start:
  * @pads: the collectspads to use
  *
@@ -425,6 +451,8 @@ gst_collect_pads_set_flushing (GstCollectPads * pads, gboolean flushing)
 void
 gst_collect_pads_start (GstCollectPads * pads)
 {
+  GSList *collected;
+
   g_return_if_fail (pads != NULL);
   g_return_if_fail (GST_IS_COLLECT_PADS (pads));
 
@@ -435,7 +463,17 @@ gst_collect_pads_start (GstCollectPads * pads)
 
   /* make pads streamable */
   GST_COLLECT_PADS_PAD_LOCK (pads);
-  gst_collect_pads_set_flushing (pads, FALSE);
+
+  /* loop over the master pad list and reset the segment */
+  collected = pads->abidata.ABI.pad_list;
+  for (; collected; collected = g_slist_next (collected)) {
+    GstCollectData *data;
+
+    data = collected->data;
+    gst_segment_init (&data->segment, GST_FORMAT_UNDEFINED);
+  }
+
+  gst_collect_pads_set_flushing_unlocked (pads, FALSE);
 
   /* Start collect pads */
   pads->started = TRUE;
@@ -467,7 +505,7 @@ gst_collect_pads_stop (GstCollectPads * pads)
 
   /* make pads not accept data anymore */
   GST_COLLECT_PADS_PAD_LOCK (pads);
-  gst_collect_pads_set_flushing (pads, TRUE);
+  gst_collect_pads_set_flushing_unlocked (pads, TRUE);
 
   /* Stop collect pads */
   pads->started = FALSE;
index 7efd6fd..813a9ef 100644 (file)
@@ -157,6 +157,7 @@ GstFlowReturn       gst_collect_pads_collect_range  (GstCollectPads *pads, guint64 off
 
 void           gst_collect_pads_start          (GstCollectPads *pads);
 void           gst_collect_pads_stop           (GstCollectPads *pads);
+void           gst_collect_pads_set_flushing   (GstCollectPads *pads, gboolean flushing);
 
 /* get collected buffers */
 GstBuffer*     gst_collect_pads_peek           (GstCollectPads *pads, GstCollectData *data);