[rygel-grilo] Fix old references to MediaServer1 spec



commit f81b52f3204c80acbe30dd9111c1959c2009c882
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue Jun 15 10:44:15 2010 +0200

    Fix old references to MediaServer1 spec
    
    Replace them for MediaServer2.

 lib/media-server2-client.c   |   32 +++++++-------
 lib/media-server2-common.h   |    6 +-
 lib/media-server2-observer.c |    4 +-
 lib/media-server2-server.c   |  101 ++++++++++++++++++++---------------------
 src/rygel-grilo.c            |    2 +-
 5 files changed, 71 insertions(+), 74 deletions(-)
---
diff --git a/lib/media-server2-client.c b/lib/media-server2-client.c
index 5faddf2..5d1e02c 100644
--- a/lib/media-server2-client.c
+++ b/lib/media-server2-client.c
@@ -26,9 +26,9 @@
 #include "media-server2-private.h"
 #include "media-server2-client.h"
 
-#define IMEDIAOBJECT1_INDEX    0
-#define IMEDIAITEM1_INDEX      1
-#define IMEDIACONTAINER1_INDEX 2
+#define IMEDIAOBJECT2_INDEX    0
+#define IMEDIAITEM2_INDEX      1
+#define IMEDIACONTAINER2_INDEX 2
 
 #define MS2_CLIENT_GET_PRIVATE(o)                                       \
   G_TYPE_INSTANCE_GET_PRIVATE((o), MS2_TYPE_CLIENT, MS2ClientPrivate)
@@ -84,9 +84,9 @@ struct _MS2ClientPrivate {
 
 static guint32 signals[LAST_SIGNAL] = { 0 };
 
-static gchar *IFACES[] = { "org.gnome.UPnP.MediaObject1",
-                           "org.gnome.UPnP.MediaItem1",
-                           "org.gnome.UPnP.MediaContainer1" };
+static gchar *IFACES[] = { "org.gnome.UPnP.MediaObject2",
+                           "org.gnome.UPnP.MediaItem2",
+                           "org.gnome.UPnP.MediaContainer2" };
 
 G_DEFINE_TYPE (MS2Client, ms2_client, G_TYPE_OBJECT);
 
@@ -138,24 +138,24 @@ split_properties_by_interface (gchar **properties)
 
   prop_length = g_strv_length (properties) + 1;
   split = g_new (gchar **, 3);
-  split[IMEDIAOBJECT1_INDEX] = g_new0 (gchar *, prop_length);
-  split[IMEDIAITEM1_INDEX] = g_new0 (gchar *, prop_length);
-  split[IMEDIACONTAINER1_INDEX ] = g_new0 (gchar *, prop_length);
+  split[IMEDIAOBJECT2_INDEX] = g_new0 (gchar *, prop_length);
+  split[IMEDIAITEM2_INDEX] = g_new0 (gchar *, prop_length);
+  split[IMEDIACONTAINER2_INDEX ] = g_new0 (gchar *, prop_length);
   for (property = properties; *property; property++) {
     if (g_strcmp0 (*property, MS2_PROP_DISPLAY_NAME) == 0 ||
         g_strcmp0 (*property, MS2_PROP_PARENT) == 0 ||
         g_strcmp0 (*property, MS2_PROP_PATH) == 0 ||
         g_strcmp0 (*property, MS2_PROP_TYPE) == 0) {
-      split[IMEDIAOBJECT1_INDEX][mo_index++] = *property;
+      split[IMEDIAOBJECT2_INDEX][mo_index++] = *property;
     } else if (g_strcmp0 (*property, MS2_PROP_CHILD_COUNT) == 0 ||
                g_strcmp0 (*property, MS2_PROP_ITEMS) == 0 ||
                g_strcmp0 (*property, MS2_PROP_ITEM_COUNT) == 0 ||
                g_strcmp0 (*property, MS2_PROP_CONTAINERS) == 0 ||
                g_strcmp0 (*property, MS2_PROP_CONTAINER_COUNT) == 0 ||
                g_strcmp0 (*property, MS2_PROP_SEARCHABLE) == 0) {
-      split[IMEDIACONTAINER1_INDEX][mc_index++] = *property;
+      split[IMEDIACONTAINER2_INDEX][mc_index++] = *property;
     } else {
-      split[IMEDIAITEM1_INDEX][mi_index++] = *property;
+      split[IMEDIAITEM2_INDEX][mi_index++] = *property;
     }
   }
 
@@ -810,7 +810,7 @@ ms2_client_list_children_async (MS2Client *client,
   adata->gproxy = dbus_g_proxy_new_for_name (client->priv->bus,
                                              client->priv->fullname,
                                              object_path,
-                                             "org.gnome.UPnP.MediaContainer1");
+                                             "org.gnome.UPnP.MediaContainer2");
 
   dbus_g_proxy_begin_call (adata->gproxy,
                            "ListChildren", list_children_reply,
@@ -884,7 +884,7 @@ ms2_client_list_children (MS2Client *client,
   gproxy = dbus_g_proxy_new_for_name (client->priv->bus,
                                       client->priv->fullname,
                                       object_path,
-                                      "org.gnome.UPnP.MediaContainer1");
+                                      "org.gnome.UPnP.MediaContainer2");
 
   if (dbus_g_proxy_call (gproxy,
                          "ListChildren", error,
@@ -953,7 +953,7 @@ ms2_client_search_objects_async (MS2Client *client,
   adata->gproxy = dbus_g_proxy_new_for_name (client->priv->bus,
                                              client->priv->fullname,
                                              object_path,
-                                             "org.gnome.UPnP.MediaContainer1");
+                                             "org.gnome.UPnP.MediaContainer2");
 
   dbus_g_proxy_begin_call (adata->gproxy,
                            "SearchObjects", search_objects_reply,
@@ -1031,7 +1031,7 @@ ms2_client_search_objects (MS2Client *client,
   gproxy = dbus_g_proxy_new_for_name (client->priv->bus,
                                       client->priv->fullname,
                                       object_path,
-                                      "org.gnome.UPnP.MediaContainer1");
+                                      "org.gnome.UPnP.MediaContainer2");
 
   if (dbus_g_proxy_call (gproxy,
                          "SearchObjects", error,
diff --git a/lib/media-server2-common.h b/lib/media-server2-common.h
index 3e3517f..7e9a2ac 100644
--- a/lib/media-server2-common.h
+++ b/lib/media-server2-common.h
@@ -23,13 +23,13 @@
 #ifndef _MEDIA_SERVER2_COMMON_H_
 #define _MEDIA_SERVER2_COMMON_H_
 
-/* MediaObject1 properties */
+/* MediaObject2 properties */
 #define MS2_PROP_PARENT       "Parent"
 #define MS2_PROP_TYPE         "Type"
 #define MS2_PROP_PATH         "Path"
 #define MS2_PROP_DISPLAY_NAME "DisplayName"
 
-/* MediaItem1 properties */
+/* MediaItem2 properties */
 #define MS2_PROP_URLS            "URLs"
 #define MS2_PROP_MIME_TYPE       "MIMEType"
 #define MS2_PROP_SIZE            "Size"
@@ -50,7 +50,7 @@
 #define MS2_PROP_THUMBNAIL       "Thumbnail"
 #define MS2_PROP_ALBUM_ART       "AlbumArt"
 
-/* MediaContainer1 properties */
+/* MediaContainer2 properties */
 #define MS2_PROP_CHILD_COUNT     "ChildCount"
 #define MS2_PROP_ITEMS           "Items"
 #define MS2_PROP_ITEM_COUNT      "ItemCount"
diff --git a/lib/media-server2-observer.c b/lib/media-server2-observer.c
index fc419f7..7ddca93 100644
--- a/lib/media-server2-observer.c
+++ b/lib/media-server2-observer.c
@@ -96,7 +96,7 @@ listen_updated_signal (DBusConnection *connection,
   gchar **path;
 
   if (dbus_message_is_signal (message,
-                              "org.gnome.UPnP.MediaContainer1",
+                              "org.gnome.UPnP.MediaContainer2",
                               "Updated")) {
     dbus_message_get_path_decomposed (message, &path);
 
@@ -160,7 +160,7 @@ create_instance ()
   /* Listen for Updated signal */
   connection = dbus_g_connection_get_connection (gconnection);
   dbus_bus_add_match (connection,
-                      "interface='org.gnome.UPnP.MediaContainer1',"
+                      "interface='org.gnome.UPnP.MediaContainer2',"
                       "member='Updated'",
                       NULL);
   dbus_connection_add_filter (connection,
diff --git a/lib/media-server2-server.c b/lib/media-server2-server.c
index b7dcf59..d537599 100644
--- a/lib/media-server2-server.c
+++ b/lib/media-server2-server.c
@@ -27,9 +27,6 @@
 #include "media-server2-server.h"
 #include "media-server2-introspection.h"
 
-#define INTROSPECTION_FILE                                              \
-  "/home/jasuarez/Projects/grilo/rygel-grilo/data/media-server2.xml"
-
 #define DBUS_TYPE_G_ARRAY_OF_STRING                             \
   (dbus_g_type_get_collection ("GPtrArray", G_TYPE_STRING))
 
@@ -75,13 +72,13 @@ static const gchar searchobjects_sgn[] = { DBUS_TYPE_STRING,                  /*
 
 
 /* Properties in interfaces */
-static const gchar *mediaobject1_properties[] = { MS2_PROP_PARENT,
+static const gchar *mediaobject2_properties[] = { MS2_PROP_PARENT,
                                                   MS2_PROP_TYPE,
                                                   MS2_PROP_PATH,
                                                   MS2_PROP_DISPLAY_NAME,
                                                   NULL };
 
-static const gchar *mediaitem1_properties[] = { MS2_PROP_URLS,
+static const gchar *mediaitem2_properties[] = { MS2_PROP_URLS,
                                                 MS2_PROP_MIME_TYPE,
                                                 MS2_PROP_SIZE,
                                                 MS2_PROP_ARTIST,
@@ -102,7 +99,7 @@ static const gchar *mediaitem1_properties[] = { MS2_PROP_URLS,
                                                 MS2_PROP_ALBUM_ART,
                                                 NULL };
 
-static const gchar *mediacontainer1_properties[] = { MS2_PROP_CHILD_COUNT,
+static const gchar *mediacontainer2_properties[] = { MS2_PROP_CHILD_COUNT,
                                                      MS2_PROP_ITEMS,
                                                      MS2_PROP_ITEM_COUNT,
                                                      MS2_PROP_CONTAINERS,
@@ -298,48 +295,48 @@ is_property_valid (const gchar *interface,
   const gchar *prop_intern;
   gboolean found;
   int i;
-  static gchar **mo1_properties_intern = NULL;
-  static gchar **mi1_properties_intern = NULL;
-  static gchar **mc1_properties_intern = NULL;
-
-  /* Initialize MediaObject1 properties interns */
-  if (!mo1_properties_intern) {
-    mo1_properties_intern = g_new (gchar *,
-                                   g_strv_length ((gchar **) mediaobject1_properties) + 1);
-    for (i = 0; mediaobject1_properties[i]; i++) {
-      mo1_properties_intern[i] =
-        (gchar *) g_intern_static_string (mediaobject1_properties[i]);
+  static gchar **mo2_properties_intern = NULL;
+  static gchar **mi2_properties_intern = NULL;
+  static gchar **mc2_properties_intern = NULL;
+
+  /* Initialize MediaObject2 properties interns */
+  if (!mo2_properties_intern) {
+    mo2_properties_intern = g_new (gchar *,
+                                   g_strv_length ((gchar **) mediaobject2_properties) + 1);
+    for (i = 0; mediaobject2_properties[i]; i++) {
+      mo2_properties_intern[i] =
+        (gchar *) g_intern_static_string (mediaobject2_properties[i]);
     }
-    mo1_properties_intern[i] = NULL;
+    mo2_properties_intern[i] = NULL;
   }
 
-  /* Initialize MediaItem1 properties interns */
-  if (!mi1_properties_intern) {
-    mi1_properties_intern = g_new (gchar *,
-                                   g_strv_length ((gchar **) mediaitem1_properties) + 1);
-    for (i = 0; mediaitem1_properties[i]; i++) {
-      mi1_properties_intern[i] =
-        (gchar *) g_intern_static_string (mediaitem1_properties[i]);
+  /* Initialize MediaItem2 properties interns */
+  if (!mi2_properties_intern) {
+    mi2_properties_intern = g_new (gchar *,
+                                   g_strv_length ((gchar **) mediaitem2_properties) + 1);
+    for (i = 0; mediaitem2_properties[i]; i++) {
+      mi2_properties_intern[i] =
+        (gchar *) g_intern_static_string (mediaitem2_properties[i]);
     }
-    mi1_properties_intern[i] = NULL;
+    mi2_properties_intern[i] = NULL;
   }
 
-  /* Initialize MediaContainer1 properties interns */
-  if (!mc1_properties_intern) {
-    mc1_properties_intern = g_new (gchar *,
-                                   g_strv_length ((gchar **) mediacontainer1_properties) + 1);
-    for (i = 0; mediacontainer1_properties[i]; i++) {
-      mc1_properties_intern[i] =
-        (gchar *) g_intern_static_string (mediacontainer1_properties[i]);
+  /* Initialize MediaContainer2 properties interns */
+  if (!mc2_properties_intern) {
+    mc2_properties_intern = g_new (gchar *,
+                                   g_strv_length ((gchar **) mediacontainer2_properties) + 1);
+    for (i = 0; mediacontainer2_properties[i]; i++) {
+      mc2_properties_intern[i] =
+        (gchar *) g_intern_static_string (mediacontainer2_properties[i]);
     }
-    mc1_properties_intern[i] = NULL;
+    mc2_properties_intern[i] = NULL;
   }
 
   prop_intern = g_intern_string (property);
 
-  /* Check MediaObject1 interface */
-  if (!interface || g_strcmp0 (interface, "org.gnome.UPnP.MediaObject1") == 0) {
-    found = lookup_in_strv (mo1_properties_intern, prop_intern);
+  /* Check MediaObject2 interface */
+  if (!interface || g_strcmp0 (interface, "org.gnome.UPnP.MediaObject2") == 0) {
+    found = lookup_in_strv (mo2_properties_intern, prop_intern);
 
     if (found) {
       return TRUE;
@@ -351,9 +348,9 @@ is_property_valid (const gchar *interface,
     }
   }
 
-  /* Check MediaItem1 interface */
-  if (!interface || g_strcmp0 (interface, "org.gnome.UPnP.MediaItem1") == 0) {
-    found = lookup_in_strv (mi1_properties_intern, prop_intern);
+  /* Check MediaItem2 interface */
+  if (!interface || g_strcmp0 (interface, "org.gnome.UPnP.MediaItem2") == 0) {
+    found = lookup_in_strv (mi2_properties_intern, prop_intern);
 
     if (found) {
       return TRUE;
@@ -365,9 +362,9 @@ is_property_valid (const gchar *interface,
     }
   }
 
-  /* Check MediaContainer1 interface */
-  if (!interface || g_strcmp0 (interface, "org.gnome.UPnP.MediaContainer1") == 0) {
-    return lookup_in_strv (mc1_properties_intern, prop_intern);
+  /* Check MediaContainer2 interface */
+  if (!interface || g_strcmp0 (interface, "org.gnome.UPnP.MediaContainer2") == 0) {
+    return lookup_in_strv (mc2_properties_intern, prop_intern);
   }
 
   return FALSE;
@@ -690,12 +687,12 @@ handle_get_all_message (DBusConnection *c,
                            DBUS_TYPE_STRING, &interface,
                            DBUS_TYPE_INVALID);
     /* Get what properties we should ask */
-    if (g_strcmp0 (interface, "org.gnome.UPnP.MediaObject1") == 0) {
-      prop = mediaobject1_properties;
-    } else if (g_strcmp0 (interface, "org.gnome.UPnP.MediaItem1") == 0) {
-      prop = mediaitem1_properties;
-    } else if (g_strcmp0 (interface, "org.gnome.UPnP.MediaContainer1") == 0) {
-      prop = mediacontainer1_properties;
+    if (g_strcmp0 (interface, "org.gnome.UPnP.MediaObject2") == 0) {
+      prop = mediaobject2_properties;
+    } else if (g_strcmp0 (interface, "org.gnome.UPnP.MediaItem2") == 0) {
+      prop = mediaitem2_properties;
+    } else if (g_strcmp0 (interface, "org.gnome.UPnP.MediaContainer2") == 0) {
+      prop = mediacontainer2_properties;
     } else {
       return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
@@ -883,11 +880,11 @@ containers_handler (DBusConnection *c,
                                           "GetAll")) {
     return handle_get_all_message (c, m, userdata);
   } else if (dbus_message_is_method_call (m,
-                                          "org.gnome.UPnP.MediaContainer1",
+                                          "org.gnome.UPnP.MediaContainer2",
                                           "ListChildren")) {
     return handle_list_children_message (c, m, userdata);
   } else if (dbus_message_is_method_call (m,
-                                          "org.gnome.UPnP.MediaContainer1",
+                                          "org.gnome.UPnP.MediaContainer2",
                                           "SearchObjects")) {
     return handle_search_objects_message (c, m, userdata);
   } else {
@@ -1165,7 +1162,7 @@ ms2_server_updated (MS2Server *server,
   }
 
   message = dbus_message_new_signal (object_path,
-                                     "org.gnome.UPnP.MediaContainer1",
+                                     "org.gnome.UPnP.MediaContainer2",
                                      "Updated");
   dbus_connection_send (connection, message, NULL);
   dbus_message_unref (message);
diff --git a/src/rygel-grilo.c b/src/rygel-grilo.c
index 382b1d1..26056f9 100644
--- a/src/rygel-grilo.c
+++ b/src/rygel-grilo.c
@@ -311,7 +311,7 @@ get_items_and_containers (MS2Server *server,
   g_list_free (children);
 }
 
-/* Given a null-terminated array of MediaServerSpec1 properties, returns a list
+/* Given a null-terminated array of MediaServerSpec2 properties, returns a list
    with the corresponding Grilo metadata keys */
 static GList *
 get_grilo_keys (const gchar **ms_keys, GList **other_keys)



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