rygel r366 - in trunk/src: plugins/test plugins/tracker rygel



Author: zeeshanak
Date: Thu Dec 25 11:59:31 2008
New Revision: 366
URL: http://svn.gnome.org/viewvc/rygel?rev=366&view=rev

Log:
MediaItem keeps a res struct instead of res fields itself.

Modified:
   trunk/src/plugins/test/rygel-test-item.vala
   trunk/src/plugins/tracker/rygel-tracker-image-item.vala
   trunk/src/plugins/tracker/rygel-tracker-music-item.vala
   trunk/src/plugins/tracker/rygel-tracker-video-item.vala
   trunk/src/rygel/rygel-media-item.vala

Modified: trunk/src/plugins/test/rygel-test-item.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-item.vala	(original)
+++ trunk/src/plugins/test/rygel-test-item.vala	Thu Dec 25 11:59:31 2008
@@ -44,11 +44,15 @@
                      Streamer streamer,
                      string   path) {
         base (id, parent_id, title, upnp_class, streamer);
-        this.mime = mime;
+
+        // FIXME: (Leaky) Hack to assign the string to weak fields
+        string *mime_type = mime;
+        this.res.mime_type = mime_type;
         this.author = TEST_AUTHOR;
         this.path= path;
 
-        this.uri = streamer.create_uri_for_path (path);
+        string *uri = streamer.create_uri_for_path (path);
+        this.res.uri = uri;
 
         streamer.stream_available += this.on_stream_available;
     }
@@ -62,7 +66,7 @@
         }
 
         // FIXME: This should be done by GstStream
-        stream.set_mime_type (this.mime);
+        stream.set_mime_type (this.res.mime_type);
 
         try {
             Element src = this.create_gst_source ();

Modified: trunk/src/plugins/tracker/rygel-tracker-image-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-image-item.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-image-item.vala	Thu Dec 25 11:59:31 2008
@@ -68,10 +68,10 @@
             this.title = values[0];
 
         if (values[4] != "")
-            this.width = values[4].to_int ();
+            this.res.width = values[4].to_int ();
 
         if (values[5] != "")
-            this.height = values[5].to_int ();
+            this.res.height = values[5].to_int ();
 
         if (values[8] != "") {
             this.date = seconds_to_iso8601 (values[8]);
@@ -79,10 +79,13 @@
             this.date = seconds_to_iso8601 (values[7]);
         }
 
-        this.mime = values[1];
+        // FIXME: (Leaky) Hack to assign the string to weak fields
+        string *mime = #values[1];
+        this.res.mime_type = mime;
         this.author = values[3];
         this.album = values[6];
-        this.uri = this.uri_from_path (path);
+        string *uri = this.uri_from_path (path);
+        this.res.uri = uri;
     }
 }
 

Modified: trunk/src/plugins/tracker/rygel-tracker-music-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-music-item.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-music-item.vala	Thu Dec 25 11:59:31 2008
@@ -78,10 +78,13 @@
             this.date = seconds_to_iso8601 (values[7]);
         }
 
-        this.mime = values[1];
+        // FIXME: (Leaky) Hack to assign the string to weak fields
+        string *mime = #values[1];
+        this.res.mime_type = mime;
         this.author = values[3];
         this.album = values[5];
-        this.uri = this.uri_from_path (path);
+        string *uri = this.uri_from_path (path);
+        this.res.uri = uri;
     }
 }
 

Modified: trunk/src/plugins/tracker/rygel-tracker-video-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-video-item.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-video-item.vala	Thu Dec 25 11:59:31 2008
@@ -66,15 +66,18 @@
             this.title = values[0];
 
         if (values[4] != "")
-            this.width = values[4].to_int ();
+            this.res.width = values[4].to_int ();
 
         if (values[5] != "")
-            this.height = values[5].to_int ();
+            this.res.height = values[5].to_int ();
 
         this.date = this.seconds_to_iso8601 (values[6]);
-        this.mime = values[1];
+        // FIXME: (Leaky) Hack to assign the string to weak fields
+        string *mime = #values[1];
+        this.res.mime_type = mime;
         this.author = values[3];
-        this.uri = this.uri_from_path (path);
+        string *uri = this.uri_from_path (path);
+        this.res.uri = uri;
     }
 }
 

Modified: trunk/src/rygel/rygel-media-item.vala
==============================================================================
--- trunk/src/rygel/rygel-media-item.vala	(original)
+++ trunk/src/rygel/rygel-media-item.vala	Thu Dec 25 11:59:31 2008
@@ -38,15 +38,13 @@
     public static const string AUDIO_CLASS = "object.item.audioItem";
     public static const string MUSIC_CLASS = "object.item.audioItem.musicTrack";
 
-    public string mime;
     public string author;
     public string album;
     public string date;
     public string upnp_class;
-    public string uri;
 
-    public int width = -1;
-    public int height = -1;
+    public DIDLLiteResource res;
+
     public int track_number = -1;
 
     protected Rygel.Streamer streamer;
@@ -61,6 +59,9 @@
         this.title = title;
         this.upnp_class = upnp_class;
         this.streamer = streamer;
+
+        this.res = DIDLLiteResource ();
+        this.res.reset ();
     }
 
     public override void serialize (DIDLLiteWriter didl_writer) throws Error {
@@ -121,27 +122,16 @@
         }
 
         /* Add resource data */
-        DIDLLiteResource res = DIDLLiteResource ();
-
-        res.reset ();
-
-        /* URI */
-        res.uri = uri;
-
         /* Protocol info */
-        string protocol = get_protocol_for_uri (uri);
-        res.protocol = protocol;
-        res.mime_type = mime;
-        res.dlna_profile = "MP3"; /* FIXME */
-        res.dlna_operation = GUPnP.DLNAOperation.RANGE;
-        res.dlna_flags = GUPnP.DLNAFlags.STREAMING_TRANSFER_MODE |
+        string protocol = get_protocol_for_uri (this.res.uri);
+        this.res.protocol = protocol;
+        this.res.dlna_profile = "MP3"; /* FIXME */
+        this.res.dlna_operation = GUPnP.DLNAOperation.RANGE;
+        this.res.dlna_flags = GUPnP.DLNAFlags.STREAMING_TRANSFER_MODE |
                          GUPnP.DLNAFlags.BACKGROUND_TRANSFER_MODE |
                          GUPnP.DLNAFlags.CONNECTION_STALL |
                          GUPnP.DLNAFlags.DLNA_V15;
 
-        res.width = width;
-        res.height = height;
-
         /* Now get the transcoded/proxy URIs */
         var res_list = this.get_transcoded_resources (res);
         foreach (DIDLLiteResource trans_res in res_list) {



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