[Xfce4-commits] <parole:0.2.2> Handle the new about-to-finish playbin2 signal.

Ali Abdallah noreply at xfce.org
Thu Dec 16 18:36:01 CET 2010


Updating branch refs/heads/0.2.2
         to b74b453d3b6c704972411cc59ead1b2f3f341774 (commit)
       from 7ac7b70286e663921092495ad8f7ca27457e26ee (commit)

commit b74b453d3b6c704972411cc59ead1b2f3f341774
Author: Ali Abdallah <aliov at xfce.org>
Date:   Thu Dec 16 18:23:38 2010 +0100

    Handle the new about-to-finish playbin2 signal.

 data/interfaces/parole.ui |    1 -
 gst/parole-gst.c          |   19 ++++++++++++++++++-
 parole/parole-stream.h    |    1 +
 src/parole-player.c       |   11 +++++++++--
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/data/interfaces/parole.ui b/data/interfaces/parole.ui
index c60be1e..c58766a 100644
--- a/data/interfaces/parole.ui
+++ b/data/interfaces/parole.ui
@@ -773,7 +773,6 @@
                             <child>
                               <object class="GtkAlignment" id="alignment2">
                                 <property name="visible">True</property>
-                                <property name="top_padding">2</property>
                                 <property name="bottom_padding">2</property>
                                 <property name="left_padding">5</property>
                                 <property name="right_padding">5</property>
diff --git a/gst/parole-gst.c b/gst/parole-gst.c
index c8ff6bd..a8673da 100644
--- a/gst/parole-gst.c
+++ b/gst/parole-gst.c
@@ -897,6 +897,7 @@ parole_gst_evaluate_state (ParoleGst *gst, GstState old, GstState new, GstState
 	case GST_STATE_PLAYING:
 	{
 	    gst->priv->media_state = PAROLE_STATE_PLAYING;
+	    parole_gst_query_duration (gst);
 	    g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0, 
 			   gst->priv->stream, PAROLE_STATE_PLAYING);
 	    break;
@@ -914,7 +915,6 @@ parole_gst_evaluate_state (ParoleGst *gst, GstState old, GstState new, GstState
 		if ( (media_type == PAROLE_MEDIA_TYPE_LOCAL_FILE && old == GST_STATE_READY) ||
 		      media_type != PAROLE_MEDIA_TYPE_LOCAL_FILE )
 		{
-		    parole_gst_query_duration (gst);
 		    parole_gst_query_capabilities (gst);
 		    parole_gst_query_info (gst);
 		}
@@ -1525,6 +1525,19 @@ parole_gst_terminate_internal (ParoleGst *gst, gboolean fade_sound)
 }
 
 static void
+parole_gst_about_to_finish_cb (GstElement *elm, gpointer data)
+{
+    ParoleGst *gst;
+    
+    gst = PAROLE_GST (data);
+
+
+    g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0, 
+		   gst->priv->stream, PAROLE_STATE_ABOUT_TO_FINISH);
+    
+}
+
+static void
 parole_gst_conf_notify_cb (GObject *object, GParamSpec *spec, ParoleGst *gst)
 {
     if ( !g_strcmp0 ("vis-enabled", spec->name) || !g_strcmp0 ("vis-name", spec->name) )
@@ -1687,6 +1700,10 @@ parole_gst_constructed (GObject *object)
     g_signal_connect (gst->priv->playbin, "notify::source",
 		      G_CALLBACK (parole_gst_source_notify_cb), gst);
 
+
+    g_signal_connect (gst->priv->playbin, "about-to-finish",
+		      G_CALLBACK (parole_gst_about_to_finish_cb), gst);
+
     
     parole_gst_update_vis (gst);
     parole_gst_load_logo (gst);
diff --git a/parole/parole-stream.h b/parole/parole-stream.h
index 157598d..46e7ef1 100644
--- a/parole/parole-stream.h
+++ b/parole/parole-stream.h
@@ -51,6 +51,7 @@ typedef enum
 {
     PAROLE_STATE_STOPPED = 0,
     PAROLE_STATE_PLAYBACK_FINISHED,
+    PAROLE_STATE_ABOUT_TO_FINISH,
     PAROLE_STATE_PAUSED,
     PAROLE_STATE_PLAYING
     
diff --git a/src/parole-player.c b/src/parole-player.c
index 89c92c2..55d4fee 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -581,6 +581,7 @@ out:
     g_free (uri);
 }
 
+
 static void
 parole_player_playing (ParolePlayer *player, const ParoleStream *stream)
 {
@@ -832,9 +833,15 @@ parole_player_media_state_cb (ParoleGst *gst, const ParoleStream *stream, Parole
     {
 	parole_player_stopped (player);
     }
-    else if ( state == PAROLE_STATE_PLAYBACK_FINISHED )
+    else if ( state == PAROLE_STATE_PLAYBACK_FINISHED || state == PAROLE_STATE_ABOUT_TO_FINISH)
     {
-	TRACE ("***Playback finished***");
+#ifdef DEBUG
+	if (state == PAROLE_STATE_PLAYBACK_FINISHED )
+	    TRACE ("***Playback finished***");
+	else
+	    TRACE ("***Playback about to finish***");
+#endif
+	
 	parole_player_play_next (player, TRUE);
     }
 }



More information about the Xfce4-commits mailing list