[Xfce4-commits] <parole:0.2.2> Stop playing in an idle function, since it is not allowed to stop using the main thread.n

Ali Abdallah noreply at xfce.org
Thu Dec 16 20:42:04 CET 2010


Updating branch refs/heads/0.2.2
         to 95b5805d911b7d0fa2a7b13aa131efbd32eec909 (commit)
       from 0c2c4009e840cb923d93553294e341dde37dab95 (commit)

commit 95b5805d911b7d0fa2a7b13aa131efbd32eec909
Author: Ali Abdallah <aliov at xfce.org>
Date:   Thu Dec 16 20:40:07 2010 +0100

    Stop playing in an idle function, since it is not allowed to stop
    using the main thread.n

 gst/parole-gst.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/gst/parole-gst.c b/gst/parole-gst.c
index a8673da..8b11b52 100644
--- a/gst/parole-gst.c
+++ b/gst/parole-gst.c
@@ -586,7 +586,13 @@ out:
 static void
 parole_gst_tick (ParoleGst *gst)
 {
-    if ( gst->priv->state >= GST_STATE_PAUSED )
+    gboolean live;
+    
+    g_object_get (gst->priv->stream,
+		  "live", &live,
+		  NULL);
+		  
+    if ( gst->priv->state >= GST_STATE_PAUSED && !live)
     {
 	if ( gst->priv->tick_id != 0 )
 	{
@@ -1970,18 +1976,30 @@ void parole_gst_resume (ParoleGst *gst)
     parole_gst_change_state (gst, GST_STATE_PLAYING);
 }
 
+static gboolean
+parole_gst_stop_idle (gpointer data)
+{
+    ParoleGst *gst;
+    
+    gst = PAROLE_GST (data);
+    
+    parole_gst_change_state (gst, GST_STATE_NULL);
+    
+    return FALSE;
+}
+
 void parole_gst_stop (ParoleGst *gst)
 {
     g_mutex_lock (gst->priv->lock);
     
     parole_stream_init_properties (gst->priv->stream);
-    gst->priv->target = GST_STATE_READY;
-    
+    gst->priv->target = GST_STATE_NULL;
+		  
     g_mutex_unlock (gst->priv->lock);
 
     parole_window_busy_cursor (GTK_WIDGET (gst)->window);
     
-    parole_gst_change_state (gst, GST_STATE_READY);
+    g_idle_add ((GSourceFunc) parole_gst_stop_idle, gst);
 }
 
 void parole_gst_terminate (ParoleGst *gst)



More information about the Xfce4-commits mailing list