[Xfce4-commits] <parole:master> Add seeked signal

Sean Davis noreply at xfce.org
Thu Dec 12 00:18:35 CET 2013


Updating branch refs/heads/master
         to d42144f794328c30c1662a40f950a10bd5e9446e (commit)
       from 3d390a079a60891db42c3c9c154a69c448430326 (commit)

commit d42144f794328c30c1662a40f950a10bd5e9446e
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sun Dec 8 16:55:46 2013 -0500

    Add seeked signal

 src/gst/gstmarshal.list              |    2 +-
 src/gst/parole-gst.c                 |   13 +++++++++++++
 src/gst/parole-gst.h                 |    4 ++++
 src/misc/parole-provider-player.c    |   17 +++++++++++++++++
 src/misc/parole-provider-player.h    |    3 +++
 src/parole-plugin-player.c           |   13 +++++++++++++
 src/plugins/mpris2/mpris2-provider.c |   14 ++++++++++++++
 7 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/src/gst/gstmarshal.list b/src/gst/gstmarshal.list
index 4447534..8c09ebc 100644
--- a/src/gst/gstmarshal.list
+++ b/src/gst/gstmarshal.list
@@ -1,4 +1,4 @@
 VOID:OBJECT,ENUM
 VOID:OBJECT,INT64
 VOID:OBJECT,INT
-
+VOID:OBJECT,DOUBLE
diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index ea61a0e..e59112e 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -147,6 +147,7 @@ enum
     MEDIA_STATE,
     MEDIA_PROGRESSED,
     MEDIA_TAG,
+    MEDIA_SEEKED,
     BUFFERING,
     ERROR,
     DVD_CHAPTER_CHANGE,
@@ -2312,6 +2313,16 @@ parole_gst_class_init (ParoleGstClass *klass)
                         _gmarshal_VOID__OBJECT_INT64,
                         G_TYPE_NONE, 2, 
                         G_TYPE_OBJECT, G_TYPE_INT64);
+                        
+    signals[MEDIA_SEEKED] = 
+        g_signal_new   ("media-seeked",
+                        PAROLE_TYPE_GST,
+                        G_SIGNAL_RUN_LAST,
+                        G_STRUCT_OFFSET (ParoleGstClass, media_seeked),
+                        NULL, NULL,
+                        _gmarshal_VOID__OBJECT_DOUBLE,
+                        G_TYPE_NONE, 1, 
+                        G_TYPE_DOUBLE);
     
     signals [MEDIA_TAG] = 
         g_signal_new   ("media-tag",
@@ -2628,6 +2639,8 @@ void parole_gst_seek (ParoleGst *gst, gdouble seek)
                         GST_SEEK_FLAG_KEY_UNIT | GST_SEEK_FLAG_FLUSH,
                         GST_SEEK_TYPE_SET, (int) seek * GST_SECOND,
                         GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE));
+                        
+    g_signal_emit (G_OBJECT (gst), signals [MEDIA_SEEKED], 0, seek);
 }
 
 void parole_gst_set_volume (ParoleGst *gst, gdouble volume)
diff --git a/src/gst/parole-gst.h b/src/gst/parole-gst.h
index 1584339..efb596c 100644
--- a/src/gst/parole-gst.h
+++ b/src/gst/parole-gst.h
@@ -76,6 +76,10 @@ typedef struct
     void        (*media_progressed)         (ParoleGst *gst,
                                              const ParoleStream *stream,
                                              gint64 value);
+                                             
+    void        (*media_seeked)             (ParoleGst *gst,
+                                             const ParoleStream *stream,
+                                             gdouble value);
     
     void        (*buffering)                (ParoleGst *gst,
                                              const ParoleStream *stream,
diff --git a/src/misc/parole-provider-player.c b/src/misc/parole-provider-player.c
index 7ee95eb..4496170 100644
--- a/src/misc/parole-provider-player.c
+++ b/src/misc/parole-provider-player.c
@@ -101,6 +101,23 @@ static void parole_provider_player_base_init (gpointer klass)
                         NULL, NULL,
                         g_cclosure_marshal_VOID__OBJECT,
                         G_TYPE_NONE, 1, PAROLE_TYPE_STREAM);
+                        
+        /**
+         * ParoleProviderPlayerIface::seeked:
+         * @player: the object which received the signal.
+         * @value: the seeked position.
+         * 
+         * Notifies when the stream has been manually advanced.
+         * 
+         * Since: 0.6
+         **/
+        g_signal_new   ("seeked",
+                        G_TYPE_FROM_INTERFACE (klass),
+                        G_SIGNAL_RUN_LAST,
+                        G_STRUCT_OFFSET (ParoleProviderPlayerIface, seeked),
+                        NULL, NULL,
+                        g_cclosure_marshal_VOID__DOUBLE,
+                        G_TYPE_NONE, 1, G_TYPE_DOUBLE);
                   
         initialized = TRUE;
     }
diff --git a/src/misc/parole-provider-player.h b/src/misc/parole-provider-player.h
index 73ddc5f..0c93d8e 100644
--- a/src/misc/parole-provider-player.h
+++ b/src/misc/parole-provider-player.h
@@ -93,6 +93,9 @@ struct _ParoleProviderPlayerIface
     /*< signals >*/
     void     (*tag_message)                     (ParoleProviderPlayer *player,
                                                  const ParoleStream *stream);
+                                                 
+    void     (*seeked)                          (ParoleProviderPlayer *player,
+                                                 gdouble value);
                              
     void     (*state_changed)                   (ParoleProviderPlayer *player,
                                                  const ParoleStream *stream,
diff --git a/src/parole-plugin-player.c b/src/parole-plugin-player.c
index 5966ed1..ba5634f 100644
--- a/src/parole-plugin-player.c
+++ b/src/parole-plugin-player.c
@@ -51,6 +51,7 @@ struct ParolePluginPlayerPrivate
     
     gulong state_changed;
     gulong tag_message;
+    gulong seeked;
     gboolean packed;
     
     gboolean fullscreen;
@@ -276,6 +277,12 @@ parole_plugin_player_media_tag_cb (ParoleGst *gst, const ParoleStream *stream, P
     g_signal_emit_by_name (G_OBJECT (player), "tag-message", stream);
 }
 
+static void
+parole_plugin_player_media_seeked_cb (ParoleGst *gst, gdouble value, ParolePluginPlayer *player)
+{
+    g_signal_emit_by_name (G_OBJECT (player), "seeked", value);
+}
+
 static gboolean
 parole_plugin_player_window_state_event  (GtkWidget *widget, 
                                           GdkEventWindowState *event,
@@ -311,6 +318,9 @@ parole_plugin_player_init (ParolePluginPlayer *player)
               
     player->priv->tag_message = g_signal_connect (G_OBJECT (player->priv->gst), "media-tag",
                         G_CALLBACK (parole_plugin_player_media_tag_cb), player);
+                        
+    player->priv->seeked = g_signal_connect (G_OBJECT (player->priv->gst), "media-seeked",
+                        G_CALLBACK (parole_plugin_player_media_seeked_cb), player);
 
     player->priv->fullscreen = FALSE;                        
     window = GTK_WIDGET(gtk_widget_get_toplevel (player->priv->gst));
@@ -337,6 +347,9 @@ parole_plugin_player_finalize (GObject *object)
 
         if (g_signal_handler_is_connected (player->priv->gst, player->priv->tag_message)) 
             g_signal_handler_disconnect (player->priv->gst, player->priv->tag_message);
+            
+        if (g_signal_handler_is_connected (player->priv->gst, player->priv->seeked)) 
+            g_signal_handler_disconnect (player->priv->gst, player->priv->seeked);
     }
     
     if ( player->priv->packed && GTK_IS_WIDGET (player->priv->box))
diff --git a/src/plugins/mpris2/mpris2-provider.c b/src/plugins/mpris2/mpris2-provider.c
index 25b3b86..106c08c 100644
--- a/src/plugins/mpris2/mpris2-provider.c
+++ b/src/plugins/mpris2/mpris2-provider.c
@@ -770,6 +770,17 @@ state_changed_cb (ParoleProviderPlayer *player, const ParoleStream *stream, Paro
 }
 
 static void
+seeked_cb (ParoleProviderPlayer *player, gdouble seeked, Mpris2Provider *provider)
+{
+    if(NULL == provider->dbus_connection)
+        return; /* better safe than sorry */
+
+    g_dbus_connection_emit_signal(provider->dbus_connection, NULL, MPRIS_PATH,
+            "org.mpris.MediaPlayer2.Player", "Seeked",
+            g_variant_new ("(x)", seeked), NULL);
+}
+
+static void
 conf_changed_cb (ParoleConf *conf, GParamSpec *pspec, Mpris2Provider *provider)
 {
     parole_mpris_update_any (provider);
@@ -1001,6 +1012,9 @@ mpris2_provider_set_player (ParoleProviderPlugin *plugin, ParoleProviderPlayer *
 
     g_signal_connect (player, "state_changed",
                       G_CALLBACK (state_changed_cb), plugin);
+                      
+    g_signal_connect (player, "seeked",
+                      G_CALLBACK (seeked_cb), plugin);
 
     provider->conf = parole_conf_new();
 


More information about the Xfce4-commits mailing list