[totem] backend: Parse the duration message
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] backend: Parse the duration message
- Date: Sun, 15 Jul 2012 18:41:05 +0000 (UTC)
commit 7ddfc722b19f3bff4da5521669208433be2b2aed
Author: Bastien Nocera <hadess hadess net>
Date: Sun Jul 15 17:09:51 2012 +0100
backend: Parse the duration message
Instead of calling _get_stream_length() which just does more work.
src/backend/bacon-video-widget.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 01db58f..41e4179 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -2062,10 +2062,14 @@ bvw_bus_message_cb (GstBus * bus, GstMessage * message, BaconVideoWidget *bvw)
}
case GST_MESSAGE_DURATION: {
- /* force _get_stream_length() to do new duration query */
- bvw->priv->stream_length = 0;
- if (bacon_video_widget_get_stream_length (bvw) == 0) {
- GST_DEBUG ("Failed to query duration after DURATION message?!");
+ gint64 duration;
+ GstFormat fmt;
+
+ gst_message_parse_duration (message, &fmt, &duration);
+ if (fmt == GST_FORMAT_TIME &&
+ duration != (gint64) GST_CLOCK_TIME_NONE) {
+ bvw->priv->stream_length = duration / 1000;
+ GST_DEBUG ("got new stream length %" G_GINT64_FORMAT, bvw->priv->stream_length);
}
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]