rygel-searchable-container.vala \
rygel-visual-item.vala \
rygel-writable-container.vala \
- rygel-media-server.vala
+ rygel-media-server.vala \
+ rygel-media-engine.vala
LIBRYGEL_SERVER_NONVAPI_SOURCE_FILES = \
rygel-aac-transcoder.vala \
rygel-wmp-hacks.vala \
rygel-wmv-transcoder.vala \
rygel-xbmc-hacks.vala \
- rygel-xbox-hacks.vala
+ rygel-xbox-hacks.vala \
+ rygel-gst-media-engine.vala
LIBRYGEL_SERVER_VALAFLAGS_PKG = \
--pkg gstreamer-0.10 \
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * Author: Jens Georg <jensg@openismus.com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ */
+
+using Gst;
+
+internal class Rygel.GstMediaEngine : Rygel.MediaEngine {
+ private GLib.List<DLNAProfile> dlna_profiles = null;
+
+ public GstMediaEngine () {
+ var discoverer = new GUPnP.DLNADiscoverer ((ClockTime) SECOND,
+ true,
+ false);
+ foreach (var profile in discoverer.list_profiles ()) {
+ var p = new DLNAProfile (profile.mime, profile.name);
+ this.dlna_profiles.prepend (p);
+ }
+
+ this.dlna_profiles.reverse ();
+ }
+
+ public override unowned GLib.List<DLNAProfile> get_dlna_profiles () {
+ return this.dlna_profiles;
+ }
+}
/*
- * Copyright (C) 2010 Nokia Corporation.
+ * Copyright (C) 2010-2011 Nokia Corporation.
+ * Copyright (C) 2012 Intel Corporation.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
+ * Jens Georg <jensg@openismus.com>
*
* This file is part of Rygel.
*
*/
using GUPnP;
-using Gst;
/**
* CreateObject action implementation.
/**
* Check if the profile is supported.
*
- * The check is performed against GUPnP-DLNA's database explicitly excluding
+ * The check is performed against the MediaEngine's database explicitly excluding
* the transcoders.
*
* @param profile to check
* @returns true if the profile is supported, false otherwise.
*/
private bool is_profile_valid (string profile) {
- var discoverer = new GUPnP.DLNADiscoverer ((ClockTime) SECOND,
- true,
- false);
+ unowned GLib.List<DLNAProfile> profiles, result;
- var valid = false;
- foreach (var known_profile in discoverer.list_profiles ()) {
- if (known_profile.name == profile) {
- valid = true;
+ profiles = MediaEngine.get_default ().get_dlna_profiles ();
+ var p = new DLNAProfile (profile, "");
- break;
- }
- }
+ result = profiles.find_custom (p, DLNAProfile.compare_by_name);
- return valid;
+ return result != null;
}
}
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * Author: Jens Georg <jensg@openismus.com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ */
+
+/**
+ * Data class representing a DLNA profile.
+ * It contains the name and the corresponding DLNA mime type.
+ *
+ * Note: The mime type can deviate from mime types typically used elsewhere.
+ */
+public class Rygel.DLNAProfile {
+ public string mime;
+ public string name;
+
+ public DLNAProfile (string name, string mime) {
+ this.mime = mime;
+ this.name = name;
+ }
+
+ /**
+ * Compare two DLNA profiles by name
+ */
+ public static int compare_by_name (DLNAProfile a, DLNAProfile b) {
+ return a.name.ascii_casecmp (b.name);
+ }
+}
+
+/**
+ * Base class for the media engine that will contain knowledge about streaming
+ * and transcoding capabilites of the media library in use.
+ */
+public abstract class Rygel.MediaEngine : GLib.Object {
+ private static MediaEngine instance;
+
+ /**
+ * Get the singleton instance of the currently used media engine.
+ *
+ * @return An instance of a concreate #MediaEngine implementation.
+ */
+ public static MediaEngine get_default () {
+ if (instance == null) {
+ instance = new GstMediaEngine ();
+ }
+
+ return instance;
+ }
+
+ /**
+ * Get a list of the DLNA profiles that are supported by this media
+ * engine.
+ *
+ * @return A list of #DLNAProfile<!-- -->s
+ */
+ public abstract unowned List<DLNAProfile> get_dlna_profiles ();
+}
/*
- * Copyright (C) 2009 Nokia Corporation.
+ * Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2009-2011 Nokia Corporation.
* Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
+ * Jens Georg <jensg@openismus.com>
*
* This file is part of Rygel.
*
*/
using GUPnP;
-using Gst;
using Gee;
/**
var server = this.get_http_server ();
var protocol_infos = server.get_protocol_info ();
- var discoverer = new GUPnP.DLNADiscoverer ((ClockTime) SECOND,
- true,
- false);
+ unowned GLib.List<DLNAProfile> profiles = MediaEngine.get_default ().
+ get_dlna_profiles ();
+
var protocol = server.get_protocol ();
- foreach (var profile in discoverer.list_profiles ()) {
+ foreach (var profile in profiles) {
var protocol_info = new ProtocolInfo ();
protocol_info.protocol = protocol;
* Copyright (C) 2008 Zeeshan Ali <zeenix@gmail.com>.
* Copyright (C) 2008-2012 Nokia Corporation.
* Copyright (C) 2010 MediaNet Inh.
+ * Copyright (C) 2012 Intel Corporation.
*
* Authors: Zeeshan Ali <zeenix@gmail.com>
* Sunil Mohan Adapa <sunil@medhas.org>
rygel-item-creator.vala \
rygel-state-machine_item-creator.vala \
rygel-relational-expression.vala \
- rygel-search-expression.vala
+ rygel-search-expression.vala \
+ rygel-media-engine.vala
rygel_playbin_renderer_test_SOURCES = rygel-playbin-renderer-test.vala
/*
* Copyright (C) 2012 Nokia Corporation.
+ * Copyright (C) 2012 Intel Corporation.
*
* Author: Jens Georg <jensg@openismus.com>
*
ERROR
}
+public class Rygel.GstMediaEngine : Rygel.MediaEngine {
+ public override unowned GLib.List<DLNAProfile> get_dlna_profiles () {
+ return null;
+ }
+}
+
public class Rygel.HTTPItemCreatorTest : GLib.Object {
public static int main (string[] args) {
--- /dev/null
+../src/librygel-server/rygel-media-engine.vala
\ No newline at end of file