[rhythmbox] playbin: only emit images from the first tag list we get that has them



commit 16453ab046980e006e622fadfb483aee5044a99f
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Sep 30 08:38:56 2014 +1000

    playbin: only emit images from the first tag list we get that has them
    
    GStreamer now re-emits the whole tag list when something changes, so
    we pointlessly re-decode the same jpeg several times with some files.

 backends/gstreamer/rb-player-gst.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst.c b/backends/gstreamer/rb-player-gst.c
index 97f3dab..55a354a 100644
--- a/backends/gstreamer/rb-player-gst.c
+++ b/backends/gstreamer/rb-player-gst.c
@@ -110,6 +110,7 @@ struct _RBPlayerGstPrivate
        gboolean current_track_finishing;
        gboolean playbin_stream_changing;
        gboolean track_change;
+       gboolean emitted_image;
 
        gboolean emitted_error;
 
@@ -222,13 +223,16 @@ process_tag (const GstTagList *list, const gchar *tag, RBPlayerGst *player)
 
        /* process embedded images */
        if (!g_strcmp0 (tag, GST_TAG_IMAGE) || !g_strcmp0 (tag, GST_TAG_PREVIEW_IMAGE)) {
-               GdkPixbuf *pixbuf;
-               pixbuf = rb_gst_process_embedded_image (list, tag);
-               if (pixbuf != NULL) {
-                       _rb_player_emit_image (RB_PLAYER (player),
-                                              player->priv->stream_data,
-                                              pixbuf);
-                       g_object_unref (pixbuf);
+               if (player->priv->stream_change_pending || (player->priv->emitted_image == FALSE)) {
+                       GdkPixbuf *pixbuf;
+                       pixbuf = rb_gst_process_embedded_image (list, tag);
+                       if (pixbuf != NULL) {
+                               _rb_player_emit_image (RB_PLAYER (player),
+                                                      player->priv->stream_data,
+                                                      pixbuf);
+                               g_object_unref (pixbuf);
+                               player->priv->emitted_image = TRUE;
+                       }
                }
        } else if (rb_gst_process_tag_string (list, tag, &field, &value)) {
                rb_debug ("emitting info field %d", field);
@@ -839,6 +843,7 @@ impl_open (RBPlayer *player,
        mp->priv->next_stream_data_destroy = stream_data_destroy;
        mp->priv->emitted_error = FALSE;
        mp->priv->stream_change_pending = TRUE;
+       mp->priv->emitted_image = FALSE;
 
        return TRUE;
 }


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