rygel r685 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r685 - trunk/src/rygel
- Date: Sun, 15 Mar 2009 19:03:23 +0000 (UTC)
Author: zeeshanak
Date: Sun Mar 15 19:03:22 2009
New Revision: 685
URL: http://svn.gnome.org/viewvc/rygel?rev=685&view=rev
Log:
Add TranscodeManager.
Put the transcode-related code from HTTPServer to a separate baseclass.
Added:
trunk/src/rygel/rygel-transcode-manager.vala
Modified:
trunk/src/rygel/Makefile.am
trunk/src/rygel/rygel-http-server.vala
Modified: trunk/src/rygel/Makefile.am
==============================================================================
--- trunk/src/rygel/Makefile.am (original)
+++ trunk/src/rygel/Makefile.am Sun Mar 15 19:03:22 2009
@@ -40,6 +40,8 @@
rygel-plugin.c \
rygel-plugin-loader.h \
rygel-plugin-loader.c \
+ rygel-transcode-manager.c \
+ rygel-transcode-manager.h \
rygel-http-server.c \
rygel-http-server.h \
rygel-state-machine.c \
@@ -92,6 +94,8 @@
rygel-plugin-loader.h \
rygel-plugin-loader.c \
rygel-plugin-loader.vala \
+ rygel-transcode-manager.c \
+ rygel-transcode-manager.h \
rygel-http-server.c \
rygel-http-server.h \
rygel-state-machine.c \
@@ -143,6 +147,7 @@
VAPI_SOURCE_FILES = rygel-content-directory.vala \
rygel-connection-manager.vala \
rygel-media-receiver-registrar.vala \
+ rygel-transcode-manager.vala \
rygel-http-server.vala \
rygel-state-machine.vala \
rygel-http-request.vala \
Modified: trunk/src/rygel/rygel-http-server.vala
==============================================================================
--- trunk/src/rygel/rygel-http-server.vala (original)
+++ trunk/src/rygel/rygel-http-server.vala Sun Mar 15 19:03:22 2009
@@ -26,7 +26,7 @@
using GUPnP;
using Gee;
-public class Rygel.HTTPServer : GLib.Object, Rygel.StateMachine {
+public class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
private const string SERVER_PATH_PREFIX = "/RygelHTTPServer";
private string path_root;
@@ -60,8 +60,10 @@
* implemenation out there just choose the first one in the list instead of
* the one they can handle.
*/
- public void add_resources (ArrayList<DIDLLiteResource?> resources,
- MediaItem item) throws Error {
+ internal override void add_resources (
+ ArrayList<DIDLLiteResource?> resources,
+ MediaItem item)
+ throws Error {
// Create the HTTP proxy URI
var uri = this.create_uri_for_item (item, null);
DIDLLiteResource res = item.create_res (uri);
@@ -71,20 +73,7 @@
resources.insert (0, res);
}
- if (item.upnp_class.has_prefix (MediaItem.IMAGE_CLASS)) {
- // No transcoding for images yet :(
- return;
- } else {
- // Modify the res for transcoding resources
- res.mime_type = "video/mpeg";
- res.uri = this.create_uri_for_item (item, res.mime_type);
- res.dlna_conversion = DLNAConversion.TRANSCODED;
- res.dlna_flags = DLNAFlags.STREAMING_TRANSFER_MODE;
- res.dlna_operation = DLNAOperation.NONE;
- res.size = -1;
-
- resources.insert (1, res);
- }
+ base.add_resources (resources, item);
}
private bool http_res_present (ArrayList<DIDLLiteResource?> res_list) {
@@ -117,8 +106,8 @@
path);
}
- private string create_uri_for_item (MediaItem item,
- string? transcode_target) {
+ internal override string create_uri_for_item (MediaItem item,
+ string? transcode_target) {
string escaped = Uri.escape_string (item.id, "", true);
string query = "?itemid=" + escaped;
if (transcode_target != null) {
Added: trunk/src/rygel/rygel-transcode-manager.vala
==============================================================================
--- (empty file)
+++ trunk/src/rygel/rygel-transcode-manager.vala Sun Mar 15 19:03:22 2009
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation, all rights reserved.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ * <zeeshan ali nokia 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 Rygel;
+using GUPnP;
+using Gee;
+
+public abstract class Rygel.TranscodeManager : GLib.Object {
+ internal abstract string create_uri_for_item
+ (MediaItem item,
+ string? transcode_target);
+
+ internal virtual void add_resources (ArrayList<DIDLLiteResource?> resources,
+ MediaItem item)
+ throws Error {
+ if (item.upnp_class.has_prefix (MediaItem.IMAGE_CLASS)) {
+ // No transcoding for images yet :(
+ return;
+ } else {
+ var mime_type = "video/mpeg";
+ var uri = this.create_uri_for_item (item, mime_type);
+ DIDLLiteResource res = item.create_res (uri);
+ res.mime_type = mime_type;
+ res.protocol = "http-get";
+ res.dlna_conversion = DLNAConversion.TRANSCODED;
+ res.dlna_flags = DLNAFlags.STREAMING_TRANSFER_MODE;
+ res.dlna_operation = DLNAOperation.NONE;
+ res.size = -1;
+
+ resources.add (res);
+ }
+ }
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]