[rygel] examples: Simulate image rendering in vala example



commit 41a72af1761a49fbf7064300187550cd943ae3c0
Author: Jens Georg <jensg openismus com>
Date:   Thu Oct 10 13:05:30 2013 +0200

    examples: Simulate image rendering in vala example

 .../renderer-plugins/vala/example-player-vala.vala |   22 ++++++++++++++++++++
 .../vala/example-renderer-plugin-vala.vala         |    9 ++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/examples/renderer-plugins/vala/example-player-vala.vala 
b/examples/renderer-plugins/vala/example-player-vala.vala
index 4768c67..6771e43 100644
--- a/examples/renderer-plugins/vala/example-player-vala.vala
+++ b/examples/renderer-plugins/vala/example-player-vala.vala
@@ -54,6 +54,25 @@ public class Rygel.Example.PlayerVala : GLib.Object, Rygel.MediaPlayer {
 
         set {
             this._playback_state = value;
+            if (this._playback_state == "PLAYING") {
+                Idle.add (() => {
+                    uint8[] data;
+                    try {
+                        var f = File.new_for_uri (this.uri);
+                        f.load_contents (null, out data, null);
+                    } catch (Error err) {
+                        warning ("Failed: %s", err.message);
+                    }
+
+                    Timeout.add_seconds (60, () => {
+                        this.playback_state = "EOS";
+
+                        return false;
+                    });
+
+                    return false;
+                });
+            }
         }
     }
 
@@ -92,6 +111,9 @@ public class Rygel.Example.PlayerVala : GLib.Object, Rygel.MediaPlayer {
              * rygel -g 5
              */
             debug ("URI set to %s.", value);
+            if (this._playback_state == "EOS") {
+                this.playback_state = "PLAYING";
+            }
         }
     }
 
diff --git a/examples/renderer-plugins/vala/example-renderer-plugin-vala.vala 
b/examples/renderer-plugins/vala/example-renderer-plugin-vala.vala
index 26b029e..53f6303 100644
--- a/examples/renderer-plugins/vala/example-renderer-plugin-vala.vala
+++ b/examples/renderer-plugins/vala/example-renderer-plugin-vala.vala
@@ -59,6 +59,15 @@ public class Rygel.Example.RendererPluginVala : Rygel.MediaRendererPlugin {
         base (NAME, TITLE, DESCRIPTION);
     }
 
+    public override void constructed () {
+        base.constructed ();
+        var l = new List<Rygel.Renderer.DLNAProfile> ();
+        l.prepend (new Rygel.Renderer.DLNAProfile ("JPEG_SM", "image/jpeg"));
+        l.prepend (new Rygel.Renderer.DLNAProfile ("MP3", "audio/mpeg"));
+
+        this.supported_profiles = l;
+    }
+
     public override MediaPlayer? get_player () {
         return Example.PlayerVala.get_default ();
     }


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