rygel r36 - in trunk: . data/xml src



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

Log:
Add basic support for Xbox.

Added:
   trunk/data/xml/X_MS_MediaReceiverRegistrar1.xml
Modified:
   trunk/ChangeLog
   trunk/data/xml/description.xml
   trunk/src/gupnp-media-server.c
   trunk/src/main.c

Added: trunk/data/xml/X_MS_MediaReceiverRegistrar1.xml
==============================================================================
--- (empty file)
+++ trunk/data/xml/X_MS_MediaReceiverRegistrar1.xml	Tue Oct 28 20:58:50 2008
@@ -0,0 +1,96 @@
+<scpd>
+    <specVersion>
+        <major>1</major>
+        <minor>0</minor>
+    </specVersion>
+    <actionList>
+        <action>
+            <name>IsAuthorized</name>
+            <argumentList>
+                <argument>
+                    <name>DeviceID</name>
+                    <direction>in</direction>
+                    <relatedStateVariable>A_ARG_TYPE_DeviceID</relatedStateVariable>
+                </argument>
+                <argument>
+                    <name>Result</name>
+                    <direction>out</direction>
+                    <relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
+                </argument>
+            </argumentList>
+        </action>
+        <action>
+            <name>RegisterDevice</name>
+            <argumentList>
+                <argument>
+                    <name>RegistrationReqMsg</name>
+                    <direction>in</direction>
+                    <relatedStateVariable>A_ARG_TYPE_RegistrationReqMsg</relatedStateVariable>
+                </argument>
+                <argument>
+                    <name>RegistrationRespMsg</name>
+                    <direction>out</direction>
+                    <relatedStateVariable>A_ARG_TYPE_RegistrationRespMsg</relatedStateVariable>
+                </argument>
+            </argumentList>
+        </action>
+        <action>
+            <name>IsValidated</name>
+            <argumentList>
+                <argument>
+                    <name>DeviceID</name>
+                    <direction>in</direction>
+                    <relatedStateVariable>A_ARG_TYPE_DeviceID</relatedStateVariable>
+                </argument>
+                <argument>
+                    <name>Result</name>
+                    <direction>out</direction>
+                    <relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
+                </argument>
+            </argumentList>
+        </action>
+    </actionList>
+    <serviceStateTable>
+        <stateVariable>
+            <name>A_ARG_TYPE_DeviceID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>string</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>A_ARG_TYPE_Result</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>int</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>A_ARG_TYPE_RegistrationReqMsg</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>bin.base64</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>A_ARG_TYPE_RegistrationRespMsg</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>bin.base64</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>AuthorizationGrantedUpdateID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>ui4</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>AuthorizationDeniedUpdateID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>ui4</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>ValidationSucceededUpdateID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>ui4</dataType>
+        </stateVariable>
+        <stateVariable>
+            <name>ValidationRevokedUpdateID</name>
+            <sendEventsAttribute>no</sendEventsAttribute>
+            <dataType>ui4</dataType>
+        </stateVariable>
+    </serviceStateTable>
+</scpd>
+

Modified: trunk/data/xml/description.xml
==============================================================================
--- trunk/data/xml/description.xml	(original)
+++ trunk/data/xml/description.xml	Tue Oct 28 20:58:50 2008
@@ -30,6 +30,13 @@
 <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>

Modified: trunk/src/gupnp-media-server.c
==============================================================================
--- trunk/src/gupnp-media-server.c	(original)
+++ trunk/src/gupnp-media-server.c	Tue Oct 28 20:58:50 2008
@@ -41,6 +41,7 @@
         guint32 system_update_id;
 
         GUPnPService *content_dir;
+        GUPnPService *msr;              /* MS MediaReceiverRegistrar */
 
         GUPnPMediaTracker *tracker;
 };
@@ -63,6 +64,10 @@
                 g_object_unref (server->priv->content_dir);
                 server->priv->content_dir = NULL;
         }
+        if (server->priv->msr) {
+                g_object_unref (server->priv->msr);
+                server->priv->msr = NULL;
+        }
 
         /* Call super */
         object_class = G_OBJECT_CLASS (gupnp_media_server_parent_class);
@@ -118,6 +123,27 @@
                 }
         }
 
+        /* Connect MS MediaReceiverRegistrar signals */
+        service = gupnp_device_info_get_service
+                        (GUPNP_DEVICE_INFO (server),
+                         "urn:microsoft.com:service"
+                         ":X_MS_MediaReceiverRegistrar:1");
+        if (service != NULL) {
+                GError *error;
+
+                server->priv->msr = GUPNP_SERVICE (service);
+
+                error = NULL;
+                gupnp_service_signals_autoconnect (server->priv->msr,
+                                                   server,
+                                                   &error);
+                if (error) {
+                        g_warning ("Error autoconnecting signals: %s",
+                                   error->message);
+                        g_error_free (error);
+                }
+        }
+
         context = gupnp_device_info_get_context (GUPNP_DEVICE_INFO (server));
 
         server->priv->tracker = gupnp_media_tracker_new ("0", context);
@@ -251,6 +277,54 @@
         g_free (object_id);
 }
 
+/* IsAuthorized action implementation (fake) */
+void
+is_authorized_cb (GUPnPService       *service,
+                  GUPnPServiceAction *action,
+                  gpointer            user_data)
+{
+        /* Set action return arguments */
+        gupnp_service_action_set (action,
+                                  "Result",
+                                  G_TYPE_INT,
+                                  1,
+                                  NULL);
+
+        gupnp_service_action_return (action);
+}
+
+/* RegisterDevice action implementation (fake) */
+void
+register_device_cb (GUPnPService       *service,
+                    GUPnPServiceAction *action,
+                    gpointer            user_data)
+{
+        /* Set action return arguments */
+        gupnp_service_action_set (action,
+                                  "RegistrationRespMsg",
+                                  GUPNP_TYPE_BIN_BASE64,
+                                  "WhatisSupposedToBeHere",
+                                  NULL);
+
+        gupnp_service_action_return (action);
+}
+
+/* IsValidated action implementation (fake) */
+void
+is_validated_cb (GUPnPService       *service,
+                 GUPnPServiceAction *action,
+                 gpointer            user_data)
+{
+        /* Set action return arguments */
+        gupnp_service_action_set (action,
+                                  "Result",
+                                  G_TYPE_INT,
+                                  1,
+                                  NULL);
+
+        gupnp_service_action_return (action);
+}
+
 GUPnPMediaServer *
 gupnp_media_server_new (GUPnPContext *context,
                         xmlDoc       *description_doc,

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Tue Oct 28 20:58:50 2008
@@ -145,6 +145,63 @@
         return str;
 }
 
+static void
+set_xbox_specifics (xmlDoc      *doc,
+                    GConfClient *gconf_client)
+{
+        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",
+                                               "device",
+                                               NULL);
+        if (device_element == NULL) {
+                g_warning ("Element /root/device not found.");
+
+                return;
+        }
+
+        /* friendlyName */
+        element = xml_util_get_element (device_element,
+                                        "friendlyName",
+                                        NULL);
+        if (element == NULL) {
+                g_warning ("Element /root/device/friendlyName not found.");
+
+                return;
+        }
+
+        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
  * these keys are not present in gconf, they are set with default values */
 static void
@@ -192,7 +249,6 @@
         g_free (str);
 
         xmlNodeSetContent (element, xml_str);
-
         xmlFree (xml_str);
 
         /* UDN */
@@ -250,6 +306,9 @@
         /* 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);
+
         /* 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
          * make sure the generated UDN stays the same between sessions. */



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