src/rygel/Makefile
src/plugins/Makefile
src/plugins/tracker/Makefile
+src/plugins/test/Makefile
data/Makefile
data/xml/Makefile
])
-SUBDIRS = tracker
+SUBDIRS = tracker test
MAINTAINERCLEANFILES = Makefile.in
--- /dev/null
+plugindir = $(libdir)/rygel-1.0
+
+plugin_LTLIBRARIES = librygel-test.la
+
+AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
+ $(LIBGUPNP_AV_CFLAGS) \
+ $(LIBDBUS_GLIB_CFLAGS) \
+ $(GEE_CFLAGS) \
+ -I$(top_srcdir)/src/rygel -DDATA_DIR='"$(datadir)"'
+
+BUILT_SOURCES = rygel-test.stamp \
+ rygel-test-content-dir.h \
+ rygel-test-content-dir.c \
+ rygel-test-audio-item.h \
+ rygel-test-audio-item.c \
+ rygel-test-plugin.h \
+ rygel-test-plugin.c
+
+librygel_test_la_SOURCES = rygel-test-content-dir.h \
+ rygel-test-content-dir.c \
+ rygel-test-content-dir.vala \
+ rygel-test-audio-item.h \
+ rygel-test-audio-item.c \
+ rygel-test-audio-item.vala \
+ rygel-test-plugin.h \
+ rygel-test-plugin.c \
+ rygel-test-plugin.vala
+
+rygel-test.stamp: $(filter %.vala,$(librygel_test_la_SOURCES))
+ $(VALAC) -C --vapidir=$(top_srcdir)/src/rygel \
+ --pkg rygel-1.0 --pkg cstuff \
+ --pkg gupnp-1.0 --pkg gupnp-av-1.0 --pkg dbus-glib-1 --pkg gee-1.0 $^
+ touch $@
+
+librygel_test_la_LIBADD = $(LIBGUPNP_LIBS) \
+ $(LIBGUPNP_AV_LIBS) \
+ $(LIBDBUS_GLIB_LIBS) \
+ $(GEE_LIBS)
+librygel_test_la_LDFLAGS = -shared -fPIC -module -avoid-version
+
+CLEANFILES = $(BUILT_SOURCES)
+MAINTAINERCLEANFILES = Makefile.in
+
--- /dev/null
+/*
+ * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
+ * <zeeshan.ali@nokia.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 Rygel;
+using GUPnP;
+using DBus;
+
+/**
+ * Represents Test audio item.
+ */
+public class Rygel.TestAudioItem : Rygel.MediaItem {
+ public TestAudioItem (string id,
+ string parent_id,
+ string title,
+ Streamer streamer) {
+ base (id, parent_id, title, MediaItem.AUDIO_CLASS);
+ }
+
+ public override void serialize (DIDLLiteWriter didl_writer) {
+ this.mime = "audio/wav";
+ this.author = "Zeeshan Ali (Khattak)";
+ //this.uri = this.uri_from_path (path);
+
+ base.serialize (didl_writer);
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
+ * <zeeshan.ali@nokia.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 Rygel;
+using GUPnP;
+using DBus;
+
+/**
+ * Implementation of ContentDirectory service, meant for testing purposes only.
+ */
+public class Rygel.TestContentDir : ContentDirectory {
+ private List<MediaItem> items;
+
+ /* Pubic methods */
+ public override void constructed () {
+ // Chain-up to base first
+ base.constructed ();
+
+ Streamer streamer = new Streamer (context);
+
+ this.items = new List<MediaItem> ();
+ this.items.append (new TestAudioItem ("testaudio",
+ this.root_container.id,
+ "testaudio",
+ streamer));
+
+ // Now we know how many top-level items we have
+ this.root_container.child_count = this.items.length ();
+ }
+
+ public override void add_metadata (DIDLLiteWriter didl_writer,
+ BrowseArgs args) throws GLib.Error {
+ MediaItem item = find_item_by_id (args.object_id);
+ if (item == null) {
+ throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
+ }
+
+ item.serialize (didl_writer);
+ args.update_id = uint32.MAX;
+ }
+
+ public override void add_root_children_metadata (DIDLLiteWriter didl_writer,
+ BrowseArgs args)
+ throws GLib.Error {
+ foreach (MediaItem item in this.items)
+ item.serialize (didl_writer);
+
+ args.total_matches = args.number_returned = this.items.length ();
+ args.update_id = uint32.MAX;
+ }
+
+ /* Private methods */
+ private MediaItem? find_item_by_id (string item_id) {
+ MediaItem item = null;
+
+ foreach (MediaItem tmp in this.items) {
+ if (item_id == tmp.id) {
+ item = tmp;
+
+ break;
+ }
+ }
+
+ return item;
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
+ * <zeeshan.ali@nokia.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 Rygel;
+using GUPnP;
+using DBus;
+
+/**
+ * Represents Test item.
+ */
+public abstract class Rygel.TestItem : MediaItem {
+ protected string parent_id;
+
+ public TestItem (string id,
+ string parent_id,
+ string title) {
+ this.id = id;
+ this.parent_id = parent_id;
+ this.title = title;
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
+ * <zeeshan.ali@nokia.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 Rygel;
+using Gee;
+using CStuff;
+
+[ModuleInit]
+public Plugin load_plugin () {
+ Plugin plugin = new Plugin ("Test");
+
+ // We only implement a ContentDirectory service
+ var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
+ ContentDirectory.UPNP_TYPE,
+ ContentDirectory.DESCRIPTION_PATH,
+ typeof (TestContentDir));
+
+ plugin.add_resource (resource_info);
+
+ return plugin;
+}
+