[Xfce4-commits] <parole:master> Check stream seekable on the tick timeout idle after playing to make seeking working with newer versions of GStreamer.
Ali Abdallah
noreply at xfce.org
Fri Apr 15 16:44:03 CEST 2011
Updating branch refs/heads/master
to ef9b1bcc2ff829085dfc77e6bf53e650e26ce445 (commit)
from b1004d01881ff5a18d2bdf99552b4b077dba3c35 (commit)
commit ef9b1bcc2ff829085dfc77e6bf53e650e26ce445
Author: Ali Abdallah <aliov at xfce.org>
Date: Fri Apr 15 15:24:58 2011 +0200
Check stream seekable on the tick timeout idle after playing
to make seeking working with newer versions of GStreamer.
gst/parole-gst.c | 54 ++++++++++++++++++++++++++++++--------------------
src/parole-player.c | 18 +++++++++++++++++
2 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/gst/parole-gst.c b/gst/parole-gst.c
index ae49623..6e0a28a 100644
--- a/gst/parole-gst.c
+++ b/gst/parole-gst.c
@@ -565,6 +565,28 @@ parole_gst_load_logo (ParoleGst *gst)
g_free (path);
}
+static void
+parole_gst_query_capabilities (ParoleGst *gst)
+{
+ GstQuery *query;
+ gboolean seekable;
+
+ query = gst_query_new_seeking (GST_FORMAT_TIME);
+
+ if ( gst_element_query (gst->priv->playbin, query) )
+ {
+ gst_query_parse_seeking (query,
+ NULL,
+ &seekable,
+ NULL,
+ NULL);
+ g_object_set (G_OBJECT (gst->priv->stream),
+ "seekable", seekable,
+ NULL);
+ }
+ gst_query_unref (query);
+}
+
static gboolean
parole_gst_tick_timeout (gpointer data)
{
@@ -574,11 +596,16 @@ parole_gst_tick_timeout (gpointer data)
GstFormat format = GST_FORMAT_TIME;
gint64 value;
gboolean video;
+ gboolean seekable;
+ gint64 duration;
+
gst = PAROLE_GST (data);
g_object_get (G_OBJECT (gst->priv->stream),
"has-video", &video,
+ "seekable", &seekable,
+ "duration", &duration,
NULL);
gst_element_query_position (gst->priv->playbin, &format, &pos);
@@ -588,6 +615,11 @@ parole_gst_tick_timeout (gpointer data)
if ( gst->priv->state == GST_STATE_PLAYING )
{
+ if (duration != 0 && seekable == FALSE)
+ {
+ parole_gst_query_capabilities (gst);
+ }
+
value = pos / GST_SECOND;
if ( G_LIKELY (value > 0) )
@@ -620,28 +652,6 @@ parole_gst_tick (ParoleGst *gst)
}
static void
-parole_gst_query_capabilities (ParoleGst *gst)
-{
- GstQuery *query;
- gboolean seekable;
-
- query = gst_query_new_seeking (GST_FORMAT_TIME);
-
- if ( gst_element_query (gst->priv->playbin, query) )
- {
- gst_query_parse_seeking (query,
- NULL,
- &seekable,
- NULL,
- NULL);
- g_object_set (G_OBJECT (gst->priv->stream),
- "seekable", seekable,
- NULL);
- }
- gst_query_unref (query);
-}
-
-static void
parole_gst_query_duration (ParoleGst *gst)
{
gint64 absolute_duration = 0;
diff --git a/src/parole-player.c b/src/parole-player.c
index 6a057d3..5dbb434 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -540,6 +540,21 @@ parole_player_media_progressed_cb (ParoleGst *gst, const ParoleStream *stream, g
}
static void
+parole_player_seekable_notify (ParoleStream *stream, GParamSpec *spec, ParolePlayer *player)
+{
+ gboolean seekable;
+
+ g_object_get (G_OBJECT (stream),
+ "seekable", &seekable,
+ NULL);
+
+ gtk_widget_set_tooltip_text (GTK_WIDGET (player->priv->range), seekable ? NULL : _("Media stream is not seekable"));
+ gtk_widget_set_sensitive (GTK_WIDGET (player->priv->range), seekable);
+ gtk_widget_set_sensitive (player->priv->seekf, seekable);
+ gtk_widget_set_sensitive (player->priv->seekb, seekable);
+}
+
+static void
parole_player_set_playpause_button_image (GtkWidget *widget, const gchar *stock_id)
{
GtkWidget *img;
@@ -1993,6 +2008,9 @@ parole_player_init (ParolePlayer *player)
gtk_widget_realize (player->priv->gst);
gtk_widget_show (player->priv->gst);
+ g_signal_connect (G_OBJECT (parole_gst_get_stream (PAROLE_GST (player->priv->gst))), "notify::seekable",
+ G_CALLBACK (parole_player_seekable_notify), player);
+
parole_player_change_volume (player,
(gdouble) (parole_rc_read_entry_int ("volume", PAROLE_RC_GROUP_GENERAL, 100)/100.));
More information about the Xfce4-commits
mailing list