rygel r38 - in trunk: . data/xml src



Author: zeeshanak
Date: Tue Oct 28 20:58:52 2008
New Revision: 38
URL: http://svn.gnome.org/viewvc/rygel?rev=38&view=rev

Log:
Use a separate description document for Xbox 360 to keep the code simple.

Added:
   trunk/data/xml/description-xbox360.xml
Modified:
   trunk/ChangeLog
   trunk/src/main.c

Added: trunk/data/xml/description-xbox360.xml
==============================================================================
--- (empty file)
+++ trunk/data/xml/description-xbox360.xml	Tue Oct 28 20:58:52 2008
@@ -0,0 +1,46 @@
+<root xmlns="urn:schemas-upnp-org:device-1-0" xmlns:dlna="urn:schemas-dlna-org:device-1-0">
+<specVersion>
+<major>1</major>
+<minor>0</minor>
+</specVersion>
+<device>
+<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
+<UDN></UDN>
+<friendlyName></friendlyName>
+<manufacturer>GUPnP Team</manufacturer>
+<manufacturerURL>http://www.gupnp.org/</manufacturerURL>
+<modelName>Windows Media Connect</modelName>
+<modelNumber>0.1</modelNumber>
+<modelDescription></modelDescription>
+<serialNumber>0000001</serialNumber>
+<UPC></UPC>
+<presentationURL></presentationURL>
+<serviceList>
+<service>
+<serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>
+<serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>
+<SCPDURL>xml/ContentDirectory.xml</SCPDURL>
+<eventSubURL>/ContentDirectory/Event</eventSubURL>
+<controlURL>/ContentDirectory/Control</controlURL>
+</service>
+<service>
+<serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
+<serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
+<SCPDURL>xml/ConnectionManager.xml</SCPDURL>
+<eventSubURL>/ConnectionManager/Event</eventSubURL>
+<controlURL>/ConnectionManager/Control</controlURL>
+</service>
+<service>
+<serviceType>urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1</serviceType>
+<serviceId>urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar</serviceId>
+<SCPDURL>xml/X_MS_MediaReceiverRegistrar1.xml</SCPDURL>
+<eventSubURL>/X_MS_MediaReceiverRegistrar/Event</eventSubURL>
+<controlURL>/X_MS_MediaReceiverRegistrar/Control</controlURL>
+</service>
+</serviceList>
+<dlna:X_DLNADOC>DMS-1.50</dlna:X_DLNADOC>
+<dlna:X_DLNADOC>M-DMS-1.50</dlna:X_DLNADOC>
+<dlna:X_DLNACAP></dlna:X_DLNACAP>
+</device>
+</root>
+

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Tue Oct 28 20:58:52 2008
@@ -29,6 +29,7 @@
 #include "gupnp-media-server.h"
 
 #define DESC_DOC "xml/description.xml"
+#define XBOX_DESC_DOC "xml/description-xbox360.xml"
 #define MODIFIED_DESC_DOC "gupnp-media-server.xml"
 #define GCONF_PATH "/apps/gupnp-media-server/"
 
@@ -146,26 +147,10 @@
 }
 
 static void
-set_xbox_specifics (xmlDoc      *doc,
-                    GConfClient *gconf_client)
+add_xbox_specifics (xmlDoc *doc)
 {
         xmlNode *device_element;
         xmlNode *element;
-        gboolean enable_xbox;
-        GError *error;
-
-        error = NULL;
-        enable_xbox = gconf_client_get_bool (gconf_client,
-                                             GCONF_PATH "enable-xbox",
-                                             &error);
-        if (error) {
-                g_warning ("%s", error->message);
-
-                g_error_free (error);
-        }
-
-        if (!enable_xbox)
-                return;
 
         device_element = xml_util_get_element ((xmlNode *) doc,
                                                "root",
@@ -188,18 +173,6 @@
         }
 
         xmlNodeAddContent (element, (xmlChar *) ": 1 : Windows Media Connect");
-
-        /* modelName */
-        element = xml_util_get_element (device_element,
-                                        "modelName",
-                                        NULL);
-        if (element == NULL) {
-                g_warning ("Element /root/device/modelName not found.");
-
-                return;
-        }
-
-        xmlNodeSetContent (element, (xmlChar *) "Windows Media Connect");
 }
 
 /* Fills the description doc @doc with a friendly name, and UDN from gconf. If
@@ -286,28 +259,45 @@
         GUPnPMediaServer *server;
         GUPnPContext *context;
         GConfClient *gconf_client;
+        gboolean enable_xbox;
+        GError *error;
         char *desc_path;
         xmlDoc *doc;
         FILE *f;
         int res;
 
+        gconf_client = gconf_client_get_default ();
+
+        error = NULL;
+        enable_xbox = gconf_client_get_bool (gconf_client,
+                                             GCONF_PATH "enable-xbox",
+                                             &error);
+        if (error) {
+                g_warning ("%s", error->message);
+
+                g_error_free (error);
+        }
+
         /* We store a modified description.xml in the user's config dir */
         desc_path = g_build_filename (g_get_user_config_dir (),
                                       MODIFIED_DESC_DOC,
                                       NULL);
 
-        doc = xmlParseFile (DATA_DIR G_DIR_SEPARATOR_S DESC_DOC);
+        if (enable_xbox)
+                /* Use Xbox 360 specific description */
+                doc = xmlParseFile (DATA_DIR G_DIR_SEPARATOR_S XBOX_DESC_DOC);
+        else
+                doc = xmlParseFile (DATA_DIR G_DIR_SEPARATOR_S DESC_DOC);
 
         if (doc == NULL)
                 return NULL;
 
-        gconf_client = gconf_client_get_default ();
-
         /* Modify description.xml to include a UDN and a friendy name */
         set_friendly_name_and_udn (doc, gconf_client);
 
-        /* Put/Set XboX specific stuff to description.xml */
-        set_xbox_specifics (doc, gconf_client);
+        if (enable_xbox)
+                /* Put/Set XboX specific stuff to description */
+                add_xbox_specifics (doc);
 
         /* Save the modified description.xml into the user's config dir.
          * We do this so that we can host the modified file, and also to



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