[Xfce4-commits] <parole:0.2.2> Fix stream seekable detection.
Ali Abdallah
noreply at xfce.org
Tue Feb 15 21:36:03 CET 2011
Updating branch refs/heads/0.2.2
to e272615eec7b5d323ca376b845733e2387e9fd45 (commit)
from 287aff947b7f3e981dbd2ca58710a2b0a0547ecb (commit)
commit e272615eec7b5d323ca376b845733e2387e9fd45
Author: Ali Abdallah <aliov at xfce.org>
Date: Tue Feb 15 21:34:31 2011 +0100
Fix stream seekable detection.
configure.ac.in | 21 -------
data/interfaces/parole.ui | 140 ++++++++++++++++++++------------------------
gst/parole-gst.c | 77 +++++++++++++------------
parole/parole-stream.c | 2 +-
src/parole-player.c | 23 +++++++
5 files changed, 127 insertions(+), 136 deletions(-)
diff --git a/configure.ac.in b/configure.ac.in
index 10eb67b..32ff815 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -198,20 +198,6 @@ AM_CONDITIONAL([POWER_MANAGER_PLUGIN], [test x"$ac_power_manager_plugin" = x"yes
AC_MSG_RESULT([$ac_power_manager_plugin])
#=======================================================#
-# Build browser plugin? #
-#=======================================================#
-AC_ARG_ENABLE([browser-plugin], AC_HELP_STRING([--disable-browser-plugin], [Don't build the browser plugin]),
- [ac_browser_plugin=$enableval], [ac_browser_plugin=yes])
-AC_MSG_CHECKING([whether to build the browser plugin])
-AM_CONDITIONAL([ENABLE_BROWSER_PLUGIN], [test x"$ac_browser_plugin" = x"yes"])
-AC_MSG_RESULT([$ac_browser_plugin])
-if test x"$ac_browser_plugin" = x"yes"; then
- BROWSER_PLUGIN_DIR="${BROWSER_PLUGIN_DIR:-"\${libdir}/mozilla/plugins"}"
- AC_ARG_VAR([BROWSER_PLUGIN_DIR],[Where to install the browser plugin])
- AC_DEFINE(BUILD_BROWSER_PLUGIN, 1, [whether to build with browser plugin support])
-fi
-
-#=======================================================#
# Check for debugging support #
#=======================================================#
XDT_FEATURE_DEBUG()
@@ -286,13 +272,6 @@ echo "
Window title: ${ac_window_title_plugin}
Power Manager: ${ac_power_manager_plugin}
- Browser plugin:
- ===============
- Build browser plugin: ${ac_browser_plugin}"
- if test x${ac_browser_plugin} = x"yes"; then
-echo " installation path: ${BROWSER_PLUGIN_DIR}"
- fi
-echo "
------------------------------------------------------
Configuration finished, type make to compile"
diff --git a/data/interfaces/parole.ui b/data/interfaces/parole.ui
index fa2d6af..3410097 100644
--- a/data/interfaces/parole.ui
+++ b/data/interfaces/parole.ui
@@ -2,14 +2,6 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
- <object class="GtkListStore" id="sidebar_liststore">
- <columns>
- <!-- column-name img -->
- <column type="GdkPixbuf"/>
- <!-- column-name name -->
- <column type="gchararray"/>
- </columns>
- </object>
<object class="GtkWindow" id="main-window">
<property name="title" translatable="yes">Parole Media Player</property>
<property name="window_position">center</property>
@@ -32,68 +24,61 @@
<property name="top_padding">2</property>
<property name="left_padding">5</property>
<child>
- <object class="GtkViewport" id="viewport1">
+ <object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="resize_mode">queue</property>
- <property name="shadow_type">none</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">4</property>
<child>
- <object class="GtkVBox" id="vbox4">
+ <object class="GtkComboBox" id="combobox1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">4</property>
+ <property name="model">sidebar-combo-liststore</property>
+ <property name="active">0</property>
<child>
- <object class="GtkComboBox" id="combobox1">
- <property name="visible">True</property>
- <property name="model">sidebar-combo-liststore</property>
- <property name="active">0</property>
- <child>
- <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
- <attributes>
- <attribute name="icon-name">0</attribute>
- </attributes>
- </child>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext2"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="icon-name">0</attribute>
+ </attributes>
</child>
<child>
- <object class="GtkNotebook" id="sidebar-notebook">
- <property name="visible">True</property>
- <property name="show_tabs">False</property>
- <property name="show_border">False</property>
- <child>
- <placeholder/>
- </child>
- <child type="tab">
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child type="tab">
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child type="tab">
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="sidebar-notebook">
+ <property name="visible">True</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
</child>
@@ -817,20 +802,6 @@
</object>
</child>
</object>
- <object class="GtkListStore" id="sidebar-combo-liststore">
- <columns>
- <!-- column-name pix -->
- <column type="gchararray"/>
- <!-- column-name title -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">playlist</col>
- <col id="1" translatable="yes">Playlist</col>
- </row>
- </data>
- </object>
<object class="GtkImage" id="image7">
<property name="visible">True</property>
<property name="icon_name">media-playlist-shuffle</property>
@@ -936,4 +907,21 @@
<property name="stock">gtk-about</property>
<property name="icon-size">1</property>
</object>
+ <object class="GtkListStore" id="sidebar-combo-liststore">
+ <columns>
+ <!-- column-name pix -->
+ <column type="gchararray"/>
+ <!-- column-name title -->
+ <column type="gchararray"/>
+ <!-- column-name tab_id -->
+ <column type="guint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">playlist</col>
+ <col id="1" translatable="yes">Playlist</col>
+ <col id="2">0</col>
+ </row>
+ </data>
+ </object>
</interface>
diff --git a/gst/parole-gst.c b/gst/parole-gst.c
index ac21035..b9cde29 100644
--- a/gst/parole-gst.c
+++ b/gst/parole-gst.c
@@ -547,6 +547,31 @@ 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)
{
@@ -556,11 +581,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);
@@ -570,6 +600,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) )
@@ -608,28 +643,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;
@@ -903,29 +916,17 @@ parole_gst_evaluate_state (ParoleGst *gst, GstState old, GstState new, GstState
case GST_STATE_PLAYING:
{
gst->priv->media_state = PAROLE_STATE_PLAYING;
+ TRACE ("Playing");
+ parole_gst_query_capabilities (gst);
+ parole_gst_query_info (gst);
parole_gst_query_duration (gst);
+
g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0,
gst->priv->stream, PAROLE_STATE_PLAYING);
break;
}
case GST_STATE_PAUSED:
{
- if ( pending == GST_STATE_PLAYING )
- {
- ParoleMediaType media_type;
-
- g_object_get (G_OBJECT (gst->priv->stream),
- "media-type", &media_type,
- NULL);
-
- if ( (media_type == PAROLE_MEDIA_TYPE_LOCAL_FILE && old == GST_STATE_READY) ||
- media_type != PAROLE_MEDIA_TYPE_LOCAL_FILE )
- {
- parole_gst_query_capabilities (gst);
- parole_gst_query_info (gst);
- }
- }
-
if ( gst->priv->target == GST_STATE_PLAYING )
{
if ( gst->priv->update_color_balance )
diff --git a/parole/parole-stream.c b/parole/parole-stream.c
index 4e9cd21..a333499 100644
--- a/parole/parole-stream.c
+++ b/parole/parole-stream.c
@@ -452,7 +452,7 @@ parole_stream_class_init (ParoleStreamClass *klass)
* Since: 0.2
**/
g_object_class_install_property (object_class,
- PROP_SEEKABLE,
+ PROP_TAG_AVAILABLE,
g_param_spec_boolean ("tag-available",
"Tag available",
"Tag available",
diff --git a/src/parole-player.c b/src/parole-player.c
index 55d4fee..d529a2e 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -506,6 +506,19 @@ parole_player_media_cursor_changed_cb (ParoleMediaList *list, gboolean media_sel
}
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->range), seekable ? NULL : _("Media stream is not seekable"));
+ gtk_widget_set_sensitive (GTK_WIDGET (player->range), seekable);
+}
+
+static void
parole_player_media_progressed_cb (ParoleGst *gst, const ParoleStream *stream, gint64 value, ParolePlayer *player)
{
#ifdef DEBUG
@@ -516,6 +529,7 @@ parole_player_media_progressed_cb (ParoleGst *gst, const ParoleStream *stream, g
{
parole_player_change_range_value (player, value);
}
+
}
static void
@@ -613,6 +627,8 @@ parole_player_playing (ParolePlayer *player, const ParoleStream *stream)
gtk_widget_set_sensitive (player->range, seekable);
player->internal_range_change = TRUE;
+ g_debug ("live=%d duration=%lld\n", live, duration);
+
if ( live || duration == 0)
parole_player_change_range_value (player, 0);
else
@@ -2207,6 +2223,12 @@ parole_player_init (ParolePlayer *player)
gtk_widget_show (player->gst);
+ g_signal_connect (G_OBJECT (parole_gst_get_stream (PAROLE_GST (player->gst))), "notify::seekable",
+ G_CALLBACK (parole_player_seekable_notify), player);
+
+
+
+
g_signal_connect (player->list, "media_activated",
G_CALLBACK (parole_player_media_activated_cb), player);
@@ -2249,6 +2271,7 @@ parole_player_init (ParolePlayer *player)
g_signal_connect_swapped (player->window, "notify::is-active",
G_CALLBACK (parole_player_window_notify_is_active), player);
+
parole_player_dbus_init (player);
}
More information about the Xfce4-commits
mailing list