summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tpm@src.gnome.org>2006-12-16 16:01:20 +0000
committerTim-Philipp Müller <tpm@src.gnome.org>2006-12-16 16:01:20 +0000
commit847d0709e6df0401e24acd7125e44ad980e90ea6 (patch)
tree6697af7f5a1e352d1c7e4fd4f76517be7d6846d8
parent7b2781387bb27818f7f4bc9050a8c144a3190e5a (diff)
downloadtotem-847d0709e6df0401e24acd7125e44ad980e90ea6.tar.gz
Use SEEKING query to query seekability instead of second-guessing based on
* src/backend/bacon-video-widget-gst-0.10.c: (bacon_video_widget_open_with_subtitle), (bacon_video_widget_is_seekable): Use SEEKING query to query seekability instead of second-guessing based on whether we have a duration or not (Closes: #365414). Needs decoder/demuxer support.
-rw-r--r--ChangeLog9
-rw-r--r--src/backend/bacon-video-widget-gst-0.10.c23
2 files changed, 32 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 14998b61d..7c61f931d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-12-16 Tim-Philipp Müller <tim at centricular dot net>
+
+ * src/backend/bacon-video-widget-gst-0.10.c:
+ (bacon_video_widget_open_with_subtitle),
+ (bacon_video_widget_is_seekable):
+ Use SEEKING query to query seekability instead of second-guessing
+ based on whether we have a duration or not (Closes: #365414).
+ Needs decoder/demuxer support.
+
2006-12-14 Bastien Nocera <hadess@hadess.net>
* src/ev-sidebar.h: Fix typo, thanks uws
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index f88827028..f8332a480 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -117,6 +117,7 @@ struct BaconVideoWidgetPrivate
gboolean media_has_video;
gboolean media_has_audio;
+ gint seekable; /* -1 = don't know, FALSE = no */
gint64 stream_length;
gint64 current_time_nanos;
gint64 current_time;
@@ -2401,6 +2402,7 @@ bacon_video_widget_open_with_subtitle (BaconVideoWidget * bvw,
"suburi", subtitle_uri, NULL);
}
+ bvw->priv->seekable = -1;
bvw->priv->target_state = GST_STATE_PAUSED;
gst_element_set_state (bvw->priv->play, GST_STATE_PAUSED);
@@ -3484,12 +3486,33 @@ bacon_video_widget_is_seekable (BaconVideoWidget * bvw)
g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (bvw->priv->play), FALSE);
+ if (bvw->priv->seekable == -1) {
+ GstQuery *query;
+
+ query = gst_query_new_seeking (GST_FORMAT_TIME);
+ if (gst_element_query (bvw->priv->play, query)) {
+ gst_query_parse_seeking (query, NULL, &res, NULL, NULL);
+ bvw->priv->seekable = (res) ? 1 : 0;
+ } else {
+ GST_DEBUG ("seeking query failed");
+ }
+ gst_query_unref (query);
+ }
+
+ if (bvw->priv->seekable != -1) {
+ res = (bvw->priv->seekable != 0);
+ goto done;
+ }
+
+ /* try to guess from duration (this is very unreliable though) */
if (bvw->priv->stream_length == 0) {
res = (bacon_video_widget_get_stream_length (bvw) > 0);
} else {
res = (bvw->priv->stream_length > 0);
}
+done:
+
GST_DEBUG ("stream is%s seekable", (res) ? "" : " not");
return res;
}