[sound-juicer/gnome-3-18] Fix duration detection in EggPlayPreview
- From: Phillip Wood <pwood src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer/gnome-3-18] Fix duration detection in EggPlayPreview
- Date: Tue, 22 Mar 2016 10:18:50 +0000 (UTC)
commit 7867c868fa7b6282ff71932e4cd1f10a414b68b7
Author: Phillip Wood <phillip wood dunelm org uk>
Date: Sun Feb 22 10:45:28 2015 +0000
Fix duration detection in EggPlayPreview
To get the track duration EggPlayPreview was checking for messages of
type GST_MESSAGE_DURATION and then calling
gst_message_parse_duration() which always returns a duration of
-1. This meant that the track duration was always zero which broke
seeking. It should check for messages of type
GST_MESSAGE_DURATION_CHANGED and query playbin for the new duration
instead.
https://bugzilla.gnome.org/show_bug.cgi?id=744941
src/egg-play-preview.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/egg-play-preview.c b/src/egg-play-preview.c
index 3dafb51..9c30251 100644
--- a/src/egg-play-preview.c
+++ b/src/egg-play-preview.c
@@ -582,7 +582,6 @@ static gboolean
_process_bus_messages (GstBus *bus, GstMessage *msg, EggPlayPreview *play_preview)
{
EggPlayPreviewPrivate *priv;
- GstFormat format = GST_FORMAT_TIME;
GstTagList *tag_list;
gint64 duration;
GstState state;
@@ -591,16 +590,16 @@ _process_bus_messages (GstBus *bus, GstMessage *msg, EggPlayPreview *play_previe
priv = GET_PRIVATE (play_preview);
switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_DURATION:
- gst_message_parse_duration (msg, &format, (gint64*) &duration);
-
- if (format != GST_FORMAT_TIME)
+ case GST_MESSAGE_DURATION_CHANGED:
+ if (!gst_element_query_duration (priv->playbin, GST_FORMAT_TIME, &duration))
break;
- priv->duration = duration / GST_SECOND;
+ duration /= GST_SECOND;
+ if (priv->duration == duration)
+ break;
+ priv->duration = duration;
g_object_notify (G_OBJECT (play_preview), "duration");
-
_ui_update_duration (play_preview);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]