[Xfce4-commits] <parole:master> Emit MEDIA_SEEKED signal when finalize the async thread. Use gint64 vars where appropriate.. GVariant is sensitive to the type of data.
matiasdelellis
noreply at xfce.org
Thu Dec 12 00:18:38 CET 2013
Updating branch refs/heads/master
to c0567fce118afb41f37526d6cf32a92d7ade8a00 (commit)
from 20f5473559b4c560985a211c1741ec9bc4e97fdf (commit)
commit c0567fce118afb41f37526d6cf32a92d7ade8a00
Author: matiasdelellis <mati86dl at hotmail.com>
Date: Mon Dec 9 11:06:18 2013 -0300
Emit MEDIA_SEEKED signal when finalize the async thread.
Use gint64 vars where appropriate.. GVariant is sensitive to the type of data.
src/gst/parole-gst.c | 18 ++++++++++++++----
src/plugins/mpris2/mpris2-provider.c | 10 +++++++---
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index e59112e..92e888d 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -123,6 +123,7 @@ struct ParoleGstPrivate
gboolean with_vis;
gboolean vis_loaded;
gboolean buffering;
+ gboolean seeking;
gboolean update_color_balance;
gdouble volume;
@@ -923,6 +924,7 @@ parole_gst_evaluate_state (ParoleGst *gst, GstState old, GstState new, GstState
case GST_STATE_READY:
{
gst->priv->buffering = FALSE;
+ gst->priv->seeking = FALSE;
gst->priv->media_state = PAROLE_STATE_STOPPED;
g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0,
gst->priv->stream, PAROLE_STATE_STOPPED);
@@ -946,6 +948,7 @@ parole_gst_evaluate_state (ParoleGst *gst, GstState old, GstState new, GstState
case GST_STATE_NULL:
{
gst->priv->buffering = FALSE;
+ gst->priv->seeking = FALSE;
gst->priv->media_state = PAROLE_STATE_STOPPED;
g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0,
gst->priv->stream, PAROLE_STATE_STOPPED);
@@ -1677,6 +1680,13 @@ parole_gst_bus_event (GstBus *bus, GstMessage *msg, gpointer data)
case GST_MESSAGE_STREAM_STATUS:
TRACE ("Stream status");
break;
+ case GST_MESSAGE_ASYNC_DONE:
+ if (gst->priv->seeking)
+ {
+ gst->priv->seeking = FALSE;
+ g_signal_emit (G_OBJECT (gst), signals [MEDIA_SEEKED], 0, 0);
+ }
+ break;
case GST_MESSAGE_WARNING:
case GST_MESSAGE_STEP_DONE:
case GST_MESSAGE_CLOCK_PROVIDE:
@@ -1686,7 +1696,6 @@ parole_gst_bus_event (GstBus *bus, GstMessage *msg, gpointer data)
case GST_MESSAGE_SEGMENT_START:
case GST_MESSAGE_LATENCY:
case GST_MESSAGE_ASYNC_START:
- case GST_MESSAGE_ASYNC_DONE:
default:
break;
}
@@ -2411,6 +2420,7 @@ parole_gst_init (ParoleGst *gst)
gst->priv->hidecursor_timer = g_timer_new ();
gst->priv->update_vis = FALSE;
gst->priv->buffering = FALSE;
+ gst->priv->seeking = FALSE;
gst->priv->update_color_balance = TRUE;
gst->priv->state_change_id = 0;
gst->priv->device = NULL;
@@ -2632,15 +2642,15 @@ void parole_gst_shutdown (ParoleGst *gst)
void parole_gst_seek (ParoleGst *gst, gdouble seek)
{
- TRACE ("Seeking");
+ g_print ("Seeking\n");
g_warn_if_fail ( gst_element_seek (gst->priv->playbin,
1.0,
GST_FORMAT_TIME,
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);
+
+ gst->priv->seeking = TRUE;
}
void parole_gst_set_volume (ParoleGst *gst, gdouble volume)
diff --git a/src/plugins/mpris2/mpris2-provider.c b/src/plugins/mpris2/mpris2-provider.c
index 106c08c..1519c4a 100644
--- a/src/plugins/mpris2/mpris2-provider.c
+++ b/src/plugins/mpris2/mpris2-provider.c
@@ -602,9 +602,9 @@ static void mpris_Player_put_Volume (GVariant *value, GError **error, Mpris2Prov
static GVariant* mpris_Player_get_Position (GError **error, Mpris2Provider *provider)
{
ParoleProviderPlayer *player = provider->player;
- gdouble position = 0;
+ gint64 position = 0;
- position = parole_provider_player_get_stream_position (player);
+ position = (gint64) parole_provider_player_get_stream_position (player);
return g_variant_new_int64(position);
}
@@ -772,12 +772,16 @@ state_changed_cb (ParoleProviderPlayer *player, const ParoleStream *stream, Paro
static void
seeked_cb (ParoleProviderPlayer *player, gdouble seeked, Mpris2Provider *provider)
{
+ gint64 position = 0;
+
if(NULL == provider->dbus_connection)
return; /* better safe than sorry */
+ position = (gint64) parole_provider_player_get_stream_position (provider->player);
+
g_dbus_connection_emit_signal(provider->dbus_connection, NULL, MPRIS_PATH,
"org.mpris.MediaPlayer2.Player", "Seeked",
- g_variant_new ("(x)", seeked), NULL);
+ g_variant_new ("(x)", position), NULL);
}
static void
More information about the Xfce4-commits
mailing list