[rygel/wip/didl-s: 12/35] WIP
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/didl-s: 12/35] WIP
- Date: Wed, 21 Nov 2012 16:56:16 +0000 (UTC)
commit dbffb3d588dc55072a46467520e612f7368d5c5d
Author: Jens Georg <jensg openismus com>
Date: Thu Nov 1 12:32:16 2012 +0100
WIP
.../rygel-sink-connection-manager.vala | 2 +
src/librygel-server/filelist.am | 1 +
src/librygel-server/rygel-http-get.vala | 4 ++
src/librygel-server/rygel-http-item-uri.vala | 14 +++++++-
.../rygel-http-playlist-handler.vala | 39 ++++++++++++++++++++
tests/rygel-http-get-test.vala | 4 ++
6 files changed, 63 insertions(+), 1 deletions(-)
---
diff --git a/src/librygel-renderer/rygel-sink-connection-manager.vala b/src/librygel-renderer/rygel-sink-connection-manager.vala
index cea868c..9f76c9d 100644
--- a/src/librygel-renderer/rygel-sink-connection-manager.vala
+++ b/src/librygel-renderer/rygel-sink-connection-manager.vala
@@ -37,6 +37,8 @@ internal class Rygel.SinkConnectionManager : Rygel.ConnectionManager {
this.player = plugin.get_player ();
var protocols = this.player.get_protocols ();
+ this.sink_protocol_info +=
+ "http-get:*:audio/L16;rate=44100;channels=2:DLNA.ORG_PN=LPCM,";
foreach (var protocol in protocols) {
if (protocols[0] != protocol) {
this.sink_protocol_info += ",";
diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am
index 2080398..ce9158f 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -40,6 +40,7 @@ LIBRYGEL_SERVER_NONVAPI_SOURCE_FILES = \
rygel-http-get-handler.vala \
rygel-http-get.vala \
rygel-http-identity-handler.vala \
+ rygel-http-playlist-handler.vala \
rygel-http-item-uri.vala \
rygel-http-post.vala \
rygel-http-request.vala \
diff --git a/src/librygel-server/rygel-http-get.vala b/src/librygel-server/rygel-http-get.vala
index 00a6a2a..4a8feb1 100644
--- a/src/librygel-server/rygel-http-get.vala
+++ b/src/librygel-server/rygel-http-get.vala
@@ -66,6 +66,10 @@ internal class Rygel.HTTPGet : HTTPRequest {
this.cancellable);
}
+ if (uri.playlist_format != null) {
+ this.handler = new HTTPPlaylistHandler (this.cancellable);
+ }
+
if (this.handler == null) {
this.handler = new HTTPIdentityHandler (this.cancellable);
}
diff --git a/src/librygel-server/rygel-http-item-uri.vala b/src/librygel-server/rygel-http-item-uri.vala
index fe3ad6b..fd96ca9 100644
--- a/src/librygel-server/rygel-http-item-uri.vala
+++ b/src/librygel-server/rygel-http-item-uri.vala
@@ -30,6 +30,7 @@ internal class Rygel.HTTPItemURI : Object {
public int thumbnail_index { get; set; default = -1; }
public int subtitle_index { get; set; default = -1; }
public string? transcode_target { get; set; default = null; }
+ public string? playlist_format { get; set; default = null; }
public unowned HTTPServer http_server { get; set; }
private string real_extension;
@@ -51,12 +52,14 @@ internal class Rygel.HTTPItemURI : Object {
HTTPServer http_server,
int thumbnail_index = -1,
int subtitle_index = -1,
- string? transcode_target = null) {
+ string? transcode_target = null,
+ string? playlist_format = null) {
this.item_id = item.id;
this.thumbnail_index = thumbnail_index;
this.subtitle_index = subtitle_index;
this.transcode_target = transcode_target;
this.http_server = http_server;
+ this.playlist_format = null;
this.extension = "";
if (thumbnail_index > -1) {
@@ -158,6 +161,9 @@ internal class Rygel.HTTPItemURI : Object {
this.subtitle_index = int.parse (parts[i + 1]);
break;
+ case "pl":
+ this.playlist_format = Soup.URI.decode (parts[i + 1]);
+ break;
default:
break;
}
@@ -185,6 +191,9 @@ internal class Rygel.HTTPItemURI : Object {
path += "/th/" + this.thumbnail_index.to_string ();
} else if (this.subtitle_index >= 0) {
path += "/sub/" + this.subtitle_index.to_string ();
+ } else if (this.playlist_format != null) {
+ path += "/pl/" +
+ Uri.escape_string (this.playlist_format, "", true);
}
path += this.extension;
return this.create_uri_for_path (path);
@@ -221,6 +230,9 @@ internal class Rygel.HTTPItemURI : Object {
// texts
mime_to_ext.set ("text/srt", "srt");
+ mime_to_ext.set ("text/xml", "xml");
+ mime_to_ext.set ("audio/x-mpegurl", "m3u");
+ mime_to_ext.set ("audio/m3u", "m3u");
// applications? (can be either video or audio?);
mime_to_ext.set ("application/ogg", "ogg");
diff --git a/src/librygel-server/rygel-http-playlist-handler.vala b/src/librygel-server/rygel-http-playlist-handler.vala
new file mode 100644
index 0000000..915d143
--- /dev/null
+++ b/src/librygel-server/rygel-http-playlist-handler.vala
@@ -0,0 +1,39 @@
+/*
+ * 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 GUPnP;
+
+internal class Rygel.HTTPPlaylistHandler : Rygel.HTTPGetHandler {
+ public HTTPPlaylistHandler (Cancellable? cancellable) {
+ this.cancellable = cancellable;
+ }
+
+ public override HTTPResponse render_body (HTTPGet request)
+ throws HTTPRequestError {
+ throw new HTTPRequestError.NOT_FOUND ("Not implemented yet");
+ }
+
+ protected override DIDLLiteResource add_resource (DIDLLiteItem didl_item,
+ HTTPGet request) {
+ // TODO: Implement
+ return null as DIDLLiteResource;
+ }
+}
diff --git a/tests/rygel-http-get-test.vala b/tests/rygel-http-get-test.vala
index 3c93ceb..3eb9cda 100644
--- a/tests/rygel-http-get-test.vala
+++ b/tests/rygel-http-get-test.vala
@@ -373,6 +373,10 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPGetHandler {
public HTTPIdentityHandler (Cancellable cancellable) {}
}
+internal class Rygel.HTTPPlaylistHandler : Rygel.HTTPGetHandler {
+ public HTTPPlaylistHandler (Cancellable cancellable) {}
+}
+
public abstract class Rygel.MediaItem : Rygel.MediaObject {
public long size = 1024;
public ArrayList<Subtitle> subtitles = new ArrayList<Subtitle> ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]