diff --git a/ChangeLog b/ChangeLog index 30d7f146e9..15b2886be1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-05-29 Wim Taymans + + * 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 * gst/gst.c: (add_path_func), (init_post): diff --git a/docs/libs/gstreamer-libs-sections.txt b/docs/libs/gstreamer-libs-sections.txt index c22be80fa2..2e13f1cab9 100644 --- a/docs/libs/gstreamer-libs-sections.txt +++ b/docs/libs/gstreamer-libs-sections.txt @@ -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 diff --git a/libs/gst/base/gstcollectpads.c b/libs/gst/base/gstcollectpads.c index d1f37d9b07..376f39ee2b 100644 --- a/libs/gst/base/gstcollectpads.c +++ b/libs/gst/base/gstcollectpads.c @@ -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,11 +410,36 @@ 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; diff --git a/libs/gst/base/gstcollectpads.h b/libs/gst/base/gstcollectpads.h index 7efd6fd6d6..813a9ef70e 100644 --- a/libs/gst/base/gstcollectpads.h +++ b/libs/gst/base/gstcollectpads.h @@ -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);