[rygel] gst-renderer: URI and metadata are always escaped



commit afa93f5fe7f97d1ca9f687ba0bf8f3372232acda
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Oct 13 01:09:03 2009 +0300

    gst-renderer: URI and metadata are always escaped
    
    GstAVTransport provides props for these fields whose getter always
    provides the markup escaped value rather than the raw value.

 .../gst-renderer/rygel-gst-av-transport.vala       |   53 +++++++++++---------
 1 files changed, 30 insertions(+), 23 deletions(-)
---
diff --git a/src/plugins/gst-renderer/rygel-gst-av-transport.vala b/src/plugins/gst-renderer/rygel-gst-av-transport.vala
index a59676a..8f570de 100644
--- a/src/plugins/gst-renderer/rygel-gst-av-transport.vala
+++ b/src/plugins/gst-renderer/rygel-gst-av-transport.vala
@@ -59,16 +59,35 @@ public class Rygel.GstAVTransport : Service {
 
     private string _metadata = "";
     public string metadata {
-        get {
-            return _metadata;
+        owned get {
+            if (this._metadata != null) {
+                return Markup.escape_text (this._metadata);
+            } else {
+                return "";
+            }
         }
 
         set {
             _metadata = value;
 
-            string escaped = Markup.escape_text (_metadata, -1);
+            this.changelog.log ("CurrentTrackMetadata", this.metadata);
+        }
+    }
+
+    public string uri {
+        owned get {
+            if (this.video_window.uri != null) {
+                return Markup.escape_text (this.video_window.uri);
+            } else {
+                return "";
+            }
+        }
+
+        set {
+            this.video_window.uri = value;
 
-            this.changelog.log ("CurrentTrackMetadata", escaped);
+            this.changelog.log ("CurrentTrackURI", this.uri);
+            this.changelog.log ("AVTransportURI", this.uri);
         }
     }
 
@@ -133,7 +152,6 @@ public class Rygel.GstAVTransport : Service {
         action_invoked["Next"]                  += next_cb;
         action_invoked["Previous"]              += previous_cb;
 
-        this.video_window.notify["uri"] += this.notify_uri_cb;
         this.video_window.notify["playback-state"] += this.notify_state_cb;
         this.video_window.notify["duration"] += this.notify_duration_cb;
     }
@@ -144,8 +162,6 @@ public class Rygel.GstAVTransport : Service {
         // Send current state
         GstChangeLog log = new GstChangeLog (null);
 
-        string escaped;
-
         log.log ("TransportState",
                  this.video_window.playback_state);
         log.log ("TransportStatus",              this.status);
@@ -162,11 +178,9 @@ public class Rygel.GstAVTransport : Service {
         log.log ("CurrentTrack",                 this.track.to_string ());
         log.log ("CurrentTrackDuration",         this.video_window.duration);
         log.log ("CurrentMediaDuration",         this.video_window.duration);
-        escaped = Markup.escape_text (this.metadata, -1);
-        log.log ("CurrentTrackMetadata",         escaped);
-        escaped = Markup.escape_text (this.video_window.uri, -1);
-        log.log ("CurrentTrackURI",              escaped);
-        log.log ("AVTransportURI",               escaped);
+        log.log ("CurrentTrackMetadata",         this.metadata);
+        log.log ("CurrentTrackURI",              this.uri);
+        log.log ("AVTransportURI",               this.uri);
         log.log ("NextAVTransportURI",           "NOT_IMPLEMENTED");
 
         value.init (typeof (string));
@@ -198,7 +212,7 @@ public class Rygel.GstAVTransport : Service {
         action.get ("CurrentURI",         typeof (string), out _uri,
                     "CurrentURIMetaData", typeof (string), out _metadata);
 
-        this.video_window.uri = _uri;
+        this.uri = _uri;
         this.metadata = _metadata;
 
         action.return ();
@@ -210,6 +224,7 @@ public class Rygel.GstAVTransport : Service {
             return;
         }
 
+
         action.set ("NrTracks",
                         typeof (uint),
                         this.n_tracks,
@@ -218,7 +233,7 @@ public class Rygel.GstAVTransport : Service {
                         this.video_window.duration,
                     "CurrentURI",
                         typeof (string),
-                        Markup.escape_text (this.video_window.uri, -1),
+                        this.uri,
                     "CurrentURIMetaData",
                         typeof (string),
                         this.metadata,
@@ -277,7 +292,7 @@ public class Rygel.GstAVTransport : Service {
                         this.metadata,
                     "TrackURI",
                         typeof (string),
-                        Markup.escape_text (this.video_window.uri, -1),
+                        this.uri,
                     "RelTime",
                         typeof (string),
                         this.video_window.position,
@@ -399,14 +414,6 @@ public class Rygel.GstAVTransport : Service {
         this.changelog.log ("TransportState", this.video_window.playback_state);
     }
 
-    private void notify_uri_cb (GstVideoWindow video_window,
-                                ParamSpec      p) {
-        var escaped = Markup.escape_text (video_window.uri, -1);
-
-        this.changelog.log ("CurrentTrackURI", escaped);
-        this.changelog.log ("AVTransportURI", escaped);
-    }
-
     private void notify_duration_cb (GstVideoWindow window,
                                      ParamSpec      p) {
         this.changelog.log ("CurrentTrackDuration", window.duration);



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