[rhythmbox] player-gst: process tags after emitting playing-stream (bug #594901)



commit 93090772557d610ae9c299f3f7e9f96b3d118acf
Author: Jonathan Matthew <jonathan d14n org>
Date:   Mon Nov 2 07:33:28 2009 +1000

    player-gst: process tags after emitting playing-stream (bug #594901)
    
    For the tags to be useful, they need to be emitted after the
    playing-stream signal.

 backends/gstreamer/rb-player-gst.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst.c b/backends/gstreamer/rb-player-gst.c
index e3740ca..b08112e 100644
--- a/backends/gstreamer/rb-player-gst.c
+++ b/backends/gstreamer/rb-player-gst.c
@@ -105,6 +105,8 @@ struct _RBPlayerGstPrivate
 
 	gboolean emitted_error;
 
+	GList *stream_tags;
+
 	gint volume_changed;
 	gint volume_applied;
 	float cur_volume;
@@ -301,8 +303,12 @@ bus_cb (GstBus *bus, GstMessage *message, RBPlayerGst *mp)
 		GstTagList *tags;
 		gst_message_parse_tag (message, &tags);
 
-		gst_tag_list_foreach (tags, (GstTagForeachFunc) process_tag, mp);
-		gst_tag_list_free (tags);
+		if (mp->priv->stream_change_pending) {
+			mp->priv->stream_tags = g_list_append (mp->priv->stream_tags, tags);
+		} else {
+			gst_tag_list_foreach (tags, (GstTagForeachFunc) process_tag, mp);
+			gst_tag_list_free (tags);
+		}
 		break;
 	}
 
@@ -805,6 +811,8 @@ impl_play (RBPlayer *player, RBPlayerPlayType play_type, gint64 crossfade, GErro
 	mp->priv->stream_change_pending = FALSE;
 
 	if (result) {
+		GList *t;
+
 		mp->priv->current_track_finishing = FALSE;
 		mp->priv->buffering = FALSE;
 		mp->priv->playing = TRUE;
@@ -839,6 +847,18 @@ impl_play (RBPlayer *player, RBPlayerPlayType play_type, gint64 crossfade, GErro
 
 			mp->priv->volume_applied = mp->priv->volume_changed;
 		}
+
+		/* process any tag lists we received while starting the stream */
+		for (t = mp->priv->stream_tags; t != NULL; t = t->next) {
+			GstTagList *tags;
+
+			tags = (GstTagList *)t->data;
+			rb_debug ("processing buffered taglist");
+			gst_tag_list_foreach (tags, (GstTagForeachFunc) process_tag, mp);
+			gst_tag_list_free (tags);
+		}
+		g_list_free (mp->priv->stream_tags);
+		mp->priv->stream_tags = NULL;
 	}
 
 	return result;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]