rygel r58 - in trunk: . src



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

Log:
Re-write the MediaServer class in Vala.

Added:
   trunk/src/gupnp-media-server.vala
Removed:
   trunk/src/gupnp-media-server.c
   trunk/src/gupnp-media-server.h
Modified:
   trunk/ChangeLog
   trunk/src/Makefile.am

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Tue Oct 28 20:59:19 2008
@@ -17,6 +17,7 @@
 gupnp_media_server_SOURCES = main.c \
 			     gupnp-media-server.h \
 			     gupnp-media-server.c \
+			     gupnp-media-server.vala \
 			     gupnp-content-directory.h \
 			     gupnp-content-directory.c \
 			     gupnp-content-directory.vala \

Added: trunk/src/gupnp-media-server.vala
==============================================================================
--- (empty file)
+++ trunk/src/gupnp-media-server.vala	Tue Oct 28 20:59:19 2008
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
+ * Copyright (C) 2007 OpenedHand Ltd.
+ *
+ * Author: Zeeshan Ali <zeenix gmail com>
+ *         Jorn Baayen <jorn openedhand com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ */
+using GLib;
+using GUPnP;
+
+public class GUPnP.MediaServer: RootDevice {
+    public static const string CONTENT_DIR =
+                        "urn:schemas-upnp-org:service:ContentDirectory";
+    public static const string MEDIA_RECEIVER_REGISTRAR =
+                        "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar";
+
+    private ContentDirectory content_dir; /* ContentDirectory */
+    private MediaReceiverRegistrar msr;  /* MS MediaReceiverRegistrar */
+
+    construct {
+        ResourceFactory factory = this.resource_factory;
+
+        /* Register GUPnP.ContentDirectory */
+        factory.register_resource_type (CONTENT_DIR + ":1",
+                                        typeof (ContentDirectory));
+        factory.register_resource_type (CONTENT_DIR + ":2",
+                                        typeof (ContentDirectory));
+
+        /* Register GUPnP.MediaReceiverRegistrar */
+        factory.register_resource_type (MEDIA_RECEIVER_REGISTRAR + ":1",
+                                        typeof (MediaReceiverRegistrar));
+        factory.register_resource_type (MEDIA_RECEIVER_REGISTRAR + ":2",
+                                        typeof (MediaReceiverRegistrar));
+
+        /* Now create the sevice objects */
+        this.content_dir = (ContentDirectory) this.get_service (CONTENT_DIR);
+        this.msr = (MediaReceiverRegistrar) this.get_service
+                                                (MEDIA_RECEIVER_REGISTRAR);
+    }
+
+    public MediaServer (GUPnP.Context context,
+                        Xml.Doc       description_doc,
+                        string        relative_location) {
+        this.context = context;
+        this.resource_factory = GUPnP.ResourceFactory.get_default ();
+        this.root_device = null;
+        this.description_doc = description_doc;
+        this.relative_location = relative_location;
+    }
+}
+



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