[rygel/rygel-0-12] playbin: Add support for image/jpeg and image/png



commit 6b407ce15057cce3c5c910fe7d978b3c90c4a9cd
Author: Jens Georg <mail jensge org>
Date:   Mon Sep 26 08:51:34 2011 +0200

    playbin: Add support for image/jpeg and image/png
    
    Use the typefind element of Playbin2 to determine if we're rendering an
    image since UPnP allows the meta-data to be empty and it may not be
    possible to guess the type from the URI.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=633011

 src/plugins/playbin/rygel-playbin-player.vala |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/playbin/rygel-playbin-player.vala b/src/plugins/playbin/rygel-playbin-player.vala
index 80d387d..61e0ad6 100644
--- a/src/plugins/playbin/rygel-playbin-player.vala
+++ b/src/plugins/playbin/rygel-playbin-player.vala
@@ -37,6 +37,8 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
                                         "audio/x-wav",
                                         "audio/x-ac3",
                                         "audio/x-m4a",
+                                        "image/jpeg",
+                                        "image/png",
                                         "video/x-theora",
                                         "video/x-dirac",
                                         "video/x-wmv",
@@ -168,13 +170,27 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
         return mime_types;
     }
 
+    private bool is_rendering_image () {
+        dynamic Element typefind;
+
+        typefind = (this.playbin as Gst.Bin).get_by_name ("typefind");
+        Caps caps = typefind.caps;
+        var structure = caps.get_structure (0);
+
+        return structure.get_name () == "image/jpeg" ||
+               structure.get_name () == "image/png";
+    }
+
     private bool bus_handler (Gst.Bus bus,
                               Message message) {
         switch (message.type) {
         case MessageType.EOS:
-            debug ("EOS");
-
-            this.playback_state = "STOPPED";
+            if (!this.is_rendering_image ()) {
+                debug ("EOS");
+                this.playback_state = "STOPPED";
+            } else {
+                debug ("Content is image, ignoring EOS");
+            }
 
             break;
         case MessageType.ERROR:



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