[rygel] all: Refactoring of the MediaObject class hierarchy
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] all: Refactoring of the MediaObject class hierarchy
- Date: Sun, 8 Feb 2015 13:24:52 +0000 (UTC)
commit b889e3d2590ef92458ef4afce0a3edaaa7027668
Author: Craig Pratt <craig ecaspia com>
Date: Sat Jun 21 21:49:19 2014 +0200
all: Refactoring of the MediaObject class hierarchy
Introduce a MediaFileItem class that represents a single file
Signed-off-by: Jens Georg <mail jensge org>
https://bugzilla.gnome.org/show_bug.cgi?id=720218
examples/server-plugins/C/example-root-container.c | 8 +-
examples/standalone-server.c | 3 +-
po/POTFILES.in | 1 +
po/POTFILES.skip | 1 +
src/librygel-server/filelist.am | 1 +
src/librygel-server/rygel-audio-item.vala | 2 +-
src/librygel-server/rygel-http-byte-seek.vala | 5 +-
src/librygel-server/rygel-http-get.vala | 9 +-
.../rygel-http-identity-handler.vala | 6 +-
src/librygel-server/rygel-http-item-uri.vala | 4 +-
src/librygel-server/rygel-http-post.vala | 10 +-
src/librygel-server/rygel-http-request.vala | 4 +-
src/librygel-server/rygel-http-server.vala | 14 +-
src/librygel-server/rygel-http-time-seek.vala | 2 +-
.../rygel-http-transcode-handler.vala | 4 +-
src/librygel-server/rygel-image-item.vala | 5 +-
src/librygel-server/rygel-import-resource.vala | 10 +-
src/librygel-server/rygel-item-destroyer.vala | 4 +-
src/librygel-server/rygel-lg-tv-hacks.vala | 4 +-
src/librygel-server/rygel-media-container.vala | 2 +
src/librygel-server/rygel-media-file-item.vala | 292 ++++++++++++++++++++
src/librygel-server/rygel-media-item.vala | 225 +---------------
src/librygel-server/rygel-media-object.vala | 10 +-
src/librygel-server/rygel-music-item.vala | 2 +-
src/librygel-server/rygel-object-creator.vala | 26 +-
src/librygel-server/rygel-panasonic-hacks.vala | 4 +-
src/librygel-server/rygel-playlist-item.vala | 2 +-
src/librygel-server/rygel-samsung-tv-hacks.vala | 4 +-
src/librygel-server/rygel-transcode-manager.vala | 12 +-
src/librygel-server/rygel-transcoder.vala | 2 +-
src/librygel-server/rygel-video-item.vala | 14 +-
src/librygel-server/rygel-visual-item.vala | 18 +-
src/librygel-server/rygel-writable-container.vala | 4 +-
src/librygel-server/rygel-xbmc-hacks.vala | 4 +-
src/librygel-server/rygel-xbox-hacks.vala | 6 +-
.../gstreamer/rygel-audio-transcoder.vala | 2 +-
.../gstreamer/rygel-avc-transcoder.vala | 2 +-
.../gstreamer/rygel-l16-transcoder.vala | 2 +-
.../gstreamer/rygel-mp2ts-transcoder.vala | 2 +-
.../gstreamer/rygel-video-transcoder.vala | 2 +-
.../external/rygel-external-item-factory.vala | 18 +-
.../rygel-gst-launch-root-container.vala | 2 +-
.../rygel-media-export-harvesting-task.vala | 2 +-
.../rygel-media-export-item-factory.vala | 66 +++---
.../rygel-media-export-media-cache.vala | 25 +-
.../rygel-media-export-object-factory.vala | 10 +-
.../rygel-media-export-playlist-container.vala | 2 +-
...rygel-media-export-playlist-root-container.vala | 4 +-
.../rygel-media-export-trackable-db-container.vala | 4 +-
.../rygel-media-export-writable-db-container.vala | 2 +-
.../rygel-tracker-category-all-container.vala | 5 +-
.../tracker/rygel-tracker-insertion-query.vala | 2 +-
.../tracker/rygel-tracker-item-factory.vala | 20 +-
.../tracker/rygel-tracker-music-item-factory.vala | 14 +-
.../rygel-tracker-picture-item-factory.vala | 12 +-
.../tracker/rygel-tracker-video-item-factory.vala | 16 +-
tests/rygel-http-byte-seek-test.vala | 4 +-
tests/rygel-http-get-test.vala | 6 +-
tests/rygel-http-item-uri-test.vala | 6 +-
tests/rygel-http-post-test.vala | 26 +-
tests/rygel-http-time-seek-test.vala | 4 +-
tests/rygel-object-creator-test.vala | 15 +-
62 files changed, 554 insertions(+), 445 deletions(-)
---
diff --git a/examples/server-plugins/C/example-root-container.c
b/examples/server-plugins/C/example-root-container.c
index 0d395ab..f3517b1 100644
--- a/examples/server-plugins/C/example-root-container.c
+++ b/examples/server-plugins/C/example-root-container.c
@@ -44,14 +44,14 @@ rygel_example_root_container_construct (GType object_type, const gchar *title) {
self = (RygelExampleRootContainer*) rygel_simple_container_construct_root (object_type, title);
item = rygel_music_item_new ("test 1", (RygelMediaContainer*) self, "Test 1", RYGEL_MUSIC_ITEM_UPNP_CLASS);
- rygel_media_item_add_uri (item, "file:///home/murrayc/Music/Madness/05_Baggy_Trousers.mp3");
- rygel_media_item_set_mime_type (item, "audio/mpeg");
+ rygel_media_file_item_add_uri (item, "file:///home/murrayc/Music/Madness/05_Baggy_Trousers.mp3");
+ rygel_media_file_item_set_mime_type (item, "audio/mpeg");
rygel_simple_container_add_child_item ((RygelSimpleContainer*) self, item);
g_object_unref (item);
item = rygel_music_item_new ("test 2", (RygelMediaContainer*) self, "Test 1", RYGEL_MUSIC_ITEM_UPNP_CLASS);
- rygel_media_item_add_uri (item, "file:///home/murrayc/Music/08%20Busload%20of%20Faith.mp3");
- rygel_media_item_set_mime_type (item, "audio/mpeg");
+ rygel_media_file_item_add_uri (item, "file:///home/murrayc/Music/08%20Busload%20of%20Faith.mp3");
+ rygel_media_file_item_set_mime_type (item, "audio/mpeg");
rygel_simple_container_add_child_item ((RygelSimpleContainer*) self, item);
g_object_unref (item);
diff --git a/examples/standalone-server.c b/examples/standalone-server.c
index 67ef199..b5e30b0 100644
--- a/examples/standalone-server.c
+++ b/examples/standalone-server.c
@@ -121,7 +121,8 @@ int main (int argc, char *argv[])
if (item != NULL) {
GeeArrayList* uris;
- rygel_media_item_set_mime_type (RYGEL_MEDIA_ITEM (item), content_type);
+ rygel_media_file_item_set_mime_type (RYGEL_MEDIA_FILE_ITEM (item),
+ content_type);
rygel_media_object_add_uri (RYGEL_MEDIA_OBJECT (item), uri);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7361458..1aa4911 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -166,6 +166,7 @@ src/librygel-server/rygel-media-art-store.vala
src/librygel-server/rygel-media-container.vala
src/librygel-server/rygel-media-engine.vala
src/librygel-server/rygel-media-item.vala
+src/librygel-server/rygel-media-file-item.vala
src/librygel-server/rygel-media-objects.vala
src/librygel-server/rygel-media-object.vala
src/librygel-server/rygel-media-query-action.vala
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index e297d75..63d355c 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -92,6 +92,7 @@ src/librygel-server/rygel-media-art-store.c
src/librygel-server/rygel-media-container.c
src/librygel-server/rygel-media-engine.c
src/librygel-server/rygel-media-item.c
+src/librygel-server/rygel-media-file-item.c
src/librygel-server/rygel-media-object.c
src/librygel-server/rygel-media-objects.c
src/librygel-server/rygel-media-query-action.c
diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am
index f40d699..21a71db 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -14,6 +14,7 @@ LIBRYGEL_SERVER_VAPI_SOURCE_FILES = \
rygel-video-item.vala \
rygel-media-container.vala \
rygel-media-item.vala \
+ rygel-media-file-item.vala \
rygel-media-object.vala \
rygel-media-server-plugin.vala \
rygel-search-expression.vala \
diff --git a/src/librygel-server/rygel-audio-item.vala b/src/librygel-server/rygel-audio-item.vala
index 5593074..b6cd7ba 100644
--- a/src/librygel-server/rygel-audio-item.vala
+++ b/src/librygel-server/rygel-audio-item.vala
@@ -30,7 +30,7 @@ using GUPnP;
/**
* Represents an audio item contained in a file.
*/
-public class Rygel.AudioItem : MediaItem {
+public class Rygel.AudioItem : MediaFileItem {
public new const string UPNP_CLASS = "object.item.audioItem";
/**
diff --git a/src/librygel-server/rygel-http-byte-seek.vala b/src/librygel-server/rygel-http-byte-seek.vala
index 590a1ae..5742e06 100644
--- a/src/librygel-server/rygel-http-byte-seek.vala
+++ b/src/librygel-server/rygel-http-byte-seek.vala
@@ -34,7 +34,7 @@ internal class Rygel.HTTPByteSeek : Rygel.HTTPSeek {
} else if (request.subtitle != null) {
total_length = request.subtitle.size;
} else {
- total_length = (request.object as MediaItem).size;
+ total_length = (request.object as MediaFileItem).size;
}
var stop = total_length - 1;
@@ -68,7 +68,8 @@ internal class Rygel.HTTPByteSeek : Rygel.HTTPSeek {
force_seek = hack.force_seek ();
} catch (Error error) { }
- return force_seek || (!(request.object is MediaContainer) && ((request.object as MediaItem).size > 0
&&
+ return force_seek || (!(request.object is MediaContainer) &&
+ ((request.object as MediaFileItem).size > 0 &&
request.handler is HTTPIdentityHandler) ||
(request.thumbnail != null &&
request.thumbnail.size > 0) ||
diff --git a/src/librygel-server/rygel-http-get.vala b/src/librygel-server/rygel-http-get.vala
index 1ddb3c1..19f587f 100644
--- a/src/librygel-server/rygel-http-get.vala
+++ b/src/librygel-server/rygel-http-get.vala
@@ -89,7 +89,8 @@ internal class Rygel.HTTPGet : HTTPRequest {
return;
}
- if (unlikely ((this.object as MediaItem).place_holder)) {
+ if (unlikely ((this.object is MediaFileItem)
+ && (this.object as MediaFileItem).place_holder)) {
throw new HTTPRequestError.NOT_FOUND ("Item '%s' is empty",
this.object.id);
}
@@ -214,15 +215,15 @@ internal class Rygel.HTTPGet : HTTPRequest {
case "Streaming":
correct = (!(this.handler is HTTPPlaylistHandler)) && (
(this.handler is HTTPTranscodeHandler ||
- ((this.object as MediaItem).streamable () &&
+ ((this.object as MediaFileItem).streamable () &&
this.subtitle == null &&
this.thumbnail == null)));
break;
case "Interactive":
correct = (this.handler is HTTPIdentityHandler &&
- ((!(this.object as MediaItem).is_live_stream () &&
- !(this.object as MediaItem).streamable ()) ||
+ ((!(this.object as MediaFileItem).is_live_stream () &&
+ !(this.object as MediaFileItem).streamable ()) ||
(this.subtitle != null ||
this.thumbnail != null))) ||
this.handler is HTTPPlaylistHandler;
diff --git a/src/librygel-server/rygel-http-identity-handler.vala
b/src/librygel-server/rygel-http-identity-handler.vala
index 215a6ea..54f03c0 100644
--- a/src/librygel-server/rygel-http-identity-handler.vala
+++ b/src/librygel-server/rygel-http-identity-handler.vala
@@ -42,7 +42,7 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPGetHandler {
request.thumbnail.mime_type);
} else {
request.msg.response_headers.append ("Content-Type",
- (request.object as MediaItem).mime_type);
+ (request.object as MediaFileItem).mime_type);
}
if (request.seek != null) {
@@ -98,7 +98,7 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPGetHandler {
} else if (request.thumbnail != null) {
src = engine.create_data_source (request.thumbnail.uri);
} else {
- src = (request.object as MediaItem).create_stream_source
+ src = (request.object as MediaFileItem).create_stream_source
(request.http_server.context.host_ip);
}
@@ -118,6 +118,6 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPGetHandler {
return request.thumbnail.size;
}
- return (request.object as MediaItem).size;
+ return (request.object as MediaFileItem).size;
}
}
diff --git a/src/librygel-server/rygel-http-item-uri.vala b/src/librygel-server/rygel-http-item-uri.vala
index cf00df4..914288b 100644
--- a/src/librygel-server/rygel-http-item-uri.vala
+++ b/src/librygel-server/rygel-http-item-uri.vala
@@ -62,11 +62,11 @@ internal class Rygel.HTTPItemURI : Object {
this.playlist_format = playlist_format;
this.extension = "";
- if (!(object is MediaItem)) {
+ if (!(object is MediaFileItem)) {
return;
}
- var item = object as MediaItem;
+ var item = object as MediaFileItem;
if (thumbnail_index > -1) {
if (item is VisualItem) {
var thumbnails = (item as VisualItem).thumbnails;
diff --git a/src/librygel-server/rygel-http-post.vala b/src/librygel-server/rygel-http-post.vala
index f2b598b..c0b4181 100644
--- a/src/librygel-server/rygel-http-post.vala
+++ b/src/librygel-server/rygel-http-post.vala
@@ -58,13 +58,13 @@ internal class Rygel.HTTPPost : HTTPRequest {
}
private async void handle_real () throws Error {
- if (!(this.object as MediaItem).place_holder) {
+ if (!(this.object as MediaFileItem).place_holder) {
var msg = _("Pushing data to non-empty item '%s' not allowed");
throw new ContentDirectoryError.INVALID_ARGS (msg, this.object.id);
}
- this.file = yield (this.object as MediaItem).get_writable
+ this.file = yield (this.object as MediaFileItem).get_writable
(this.cancellable);
if (this.file == null) {
throw new HTTPRequestError.BAD_REQUEST
@@ -109,13 +109,13 @@ internal class Rygel.HTTPPost : HTTPRequest {
private async void wait_for_item (MediaContainer container,
string id,
uint timeout) {
- MediaItem item = null;
+ MediaFileItem item = null;
while (item == null || item.place_holder) {
try {
item = (yield container.find_object (id,
this.cancellable))
- as MediaItem;
+ as MediaFileItem;
} catch (Error error) {
// Handle
break;
@@ -218,7 +218,7 @@ internal class Rygel.HTTPPost : HTTPRequest {
private async void remove_item () {
var queue = ObjectRemovalQueue.get_default ();
- yield queue.remove_now (this.object as MediaItem, null);
+ yield queue.remove_now (this.object as MediaFileItem, null);
}
private void disconnect_message_signals () {
diff --git a/src/librygel-server/rygel-http-request.vala b/src/librygel-server/rygel-http-request.vala
index 7fb229e..2d3baef 100644
--- a/src/librygel-server/rygel-http-request.vala
+++ b/src/librygel-server/rygel-http-request.vala
@@ -1,10 +1,12 @@
/*
* Copyright (C) 2008-2010 Nokia Corporation.
* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
* <zeeshan ali nokia com>
* Jorn Baayen <jorn baayen gmail com>
+ * Craig Pratt <craig ecaspia com>
*
* This file is part of Rygel.
*
@@ -88,7 +90,7 @@ internal abstract class Rygel.HTTPRequest : GLib.Object, Rygel.StateMachine {
if (media_object == null ||
!((media_object is MediaContainer &&
this.uri.playlist_format != null) ||
- (media_object is MediaItem && this.uri.playlist_format == null))) {
+ (media_object is MediaFileItem && this.uri.playlist_format == null))) {
throw new HTTPRequestError.NOT_FOUND
(_("Requested item '%s' not found"),
this.uri.item_id);
diff --git a/src/librygel-server/rygel-http-server.vala b/src/librygel-server/rygel-http-server.vala
index 6986eb2..76fa86d 100644
--- a/src/librygel-server/rygel-http-server.vala
+++ b/src/librygel-server/rygel-http-server.vala
@@ -65,8 +65,8 @@ public class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
}
}
- internal void add_proxy_resource (DIDLLiteItem didl_item,
- MediaItem item)
+ internal void add_proxy_resource (DIDLLiteItem didl_item,
+ MediaFileItem item)
throws Error {
if (this.http_uri_present (item)) {
return;
@@ -104,11 +104,11 @@ public class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
this.completed ();
}
- internal override string create_uri_for_item (MediaItem item,
- int thumbnail_index,
- int subtitle_index,
- string? transcode_target,
- string? playlist_target) {
+ internal override string create_uri_for_item (MediaFileItem item,
+ int thumbnail_index,
+ int subtitle_index,
+ string? transcode_target,
+ string? playlist_target) {
var uri = new HTTPItemURI (item,
this,
thumbnail_index,
diff --git a/src/librygel-server/rygel-http-time-seek.vala b/src/librygel-server/rygel-http-time-seek.vala
index 675d4e1..7b248a9 100644
--- a/src/librygel-server/rygel-http-time-seek.vala
+++ b/src/librygel-server/rygel-http-time-seek.vala
@@ -102,7 +102,7 @@ internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
(request.handler is HTTPTranscodeHandler ||
(request.thumbnail == null &&
request.subtitle == null &&
- (request.object as MediaItem).is_live_stream ())));
+ (request.object as MediaFileItem).is_live_stream ())));
}
public static bool requested (HTTPGet request) {
diff --git a/src/librygel-server/rygel-http-transcode-handler.vala
b/src/librygel-server/rygel-http-transcode-handler.vala
index da21a06..f6486e4 100644
--- a/src/librygel-server/rygel-http-transcode-handler.vala
+++ b/src/librygel-server/rygel-http-transcode-handler.vala
@@ -51,7 +51,7 @@ internal class Rygel.HTTPTranscodeHandler : HTTPGetHandler {
public override HTTPResponse render_body (HTTPGet request)
throws HTTPRequestError {
- var item = request.object as MediaItem;
+ var item = request.object as MediaFileItem;
var src = item.create_stream_source
(request.http_server.context.host_ip);
if (src == null) {
@@ -72,7 +72,7 @@ internal class Rygel.HTTPTranscodeHandler : HTTPGetHandler {
HTTPGet request)
throws Error {
return this.transcoder.add_resource (didl_object as DIDLLiteItem,
- request.object as MediaItem,
+ request.object as MediaFileItem,
request.http_server);
}
}
diff --git a/src/librygel-server/rygel-image-item.vala b/src/librygel-server/rygel-image-item.vala
index 9720590..219dac3 100644
--- a/src/librygel-server/rygel-image-item.vala
+++ b/src/librygel-server/rygel-image-item.vala
@@ -2,9 +2,12 @@
* Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
* Copyright (C) 2010 Nokia Corporation.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
* <zeeshan ali nokia com>
+ * Doug Galligan <doug sentosatech com>
+ * Craig Pratt <craig ecaspia com>
*
* This file is part of Rygel.
*
@@ -29,7 +32,7 @@ using Gee;
/**
* Represents an image item.
*/
-public class Rygel.ImageItem : MediaItem, VisualItem {
+public class Rygel.ImageItem : MediaFileItem, VisualItem {
public new const string UPNP_CLASS = "object.item.imageItem";
//TODO: This property documentation is not used.
diff --git a/src/librygel-server/rygel-import-resource.vala b/src/librygel-server/rygel-import-resource.vala
index 3467dc2..d4532f9 100644
--- a/src/librygel-server/rygel-import-resource.vala
+++ b/src/librygel-server/rygel-import-resource.vala
@@ -48,7 +48,7 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
public int64 bytes_copied;
public int64 bytes_total;
- private MediaItem item;
+ private MediaFileItem item;
private Session session;
public string status_as_string {
@@ -166,7 +166,7 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
this.completed ();
}
- private async MediaItem fetch_item () throws Error {
+ private async MediaFileItem fetch_item () throws Error {
HTTPItemURI uri;
try {
uri = new HTTPItemURI.from_string (this.destination_uri,
@@ -180,11 +180,11 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
string msg = null;
if (media_object == null ||
- !(media_object is MediaItem) ||
+ !(media_object is MediaFileItem) ||
!(media_object.parent is WritableContainer)) {
msg = _("URI '%s' invalid for importing contents to").printf
(this.destination_uri);
- } else if (!(media_object as MediaItem).place_holder) {
+ } else if (!(media_object as MediaFileItem).place_holder) {
msg = _("Pushing data to non-empty item '%s' not allowed").printf
(media_object.id);
} else if (media_object.get_uris ().is_empty) {
@@ -195,7 +195,7 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
throw new ContentDirectoryError.INVALID_ARGS (msg);
}
- return media_object as MediaItem;
+ return media_object as MediaFileItem;
}
private void got_headers_cb (Message message) {
diff --git a/src/librygel-server/rygel-item-destroyer.vala b/src/librygel-server/rygel-item-destroyer.vala
index 846fd2a..93e8f18 100644
--- a/src/librygel-server/rygel-item-destroyer.vala
+++ b/src/librygel-server/rygel-item-destroyer.vala
@@ -77,10 +77,10 @@ internal class Rygel.ItemDestroyer: GLib.Object, Rygel.StateMachine {
var media_object = yield this.fetch_object ();
var parent = media_object.parent as WritableContainer;
- if (media_object is MediaItem ) {
+ if (media_object is MediaFileItem ) {
yield parent.remove_item (this.object_id, this.cancellable);
- if (!(media_object as MediaItem).place_holder) {
+ if (!(media_object as MediaFileItem).place_holder) {
var writables = yield media_object.get_writables (this.cancellable);
foreach (var file in writables) {
if (file.query_exists (this.cancellable)) {
diff --git a/src/librygel-server/rygel-lg-tv-hacks.vala b/src/librygel-server/rygel-lg-tv-hacks.vala
index a24ed65..ab8ff97 100644
--- a/src/librygel-server/rygel-lg-tv-hacks.vala
+++ b/src/librygel-server/rygel-lg-tv-hacks.vala
@@ -31,11 +31,11 @@ internal class Rygel.LGTVHacks : ClientHacks {
}
public override void apply (MediaObject object) {
- if (!(object is MediaItem)) {
+ if (!(object is MediaFileItem)) {
return;
}
- var item = object as MediaItem;
+ var item = object as MediaFileItem;
if (item.mime_type == "audio/x-vorbis+ogg" ||
item.mime_type == "audio/x-flac+ogg") {
item.mime_type = "application/ogg";
diff --git a/src/librygel-server/rygel-media-container.vala b/src/librygel-server/rygel-media-container.vala
index a0b6f49..5000084 100644
--- a/src/librygel-server/rygel-media-container.vala
+++ b/src/librygel-server/rygel-media-container.vala
@@ -3,9 +3,11 @@
* Copyright (C) 2010 MediaNet Inh.
* Copyright (C) 2010 Nokia Corporation.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Authors: Zeeshan Ali <zeenix gmail com>
* Sunil Mohan Adapa <sunil medhas org>
+ * Craig Pratt <craig ecaspia com>
*
* This file is part of Rygel.
*
diff --git a/src/librygel-server/rygel-media-file-item.vala b/src/librygel-server/rygel-media-file-item.vala
new file mode 100644
index 0000000..77d33ec
--- /dev/null
+++ b/src/librygel-server/rygel-media-file-item.vala
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
+ * Copyright (C) 2010 Nokia Corporation.
+ * Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ * <zeeshan ali nokia com>
+ * Doug Galligan <doug sentosatech com>
+ * Craig Pratt <craig ecaspia 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;
+
+private errordomain Rygel.MediaFileItemError {
+ BAD_URI
+}
+
+/**
+ * Represents a file-accessible or http-accessible media item (music file, image file,
+ * video file, etc) with some pre-established metadata or a content placeholder for
+ * uploaded content.
+ *
+ * Items representing non-file-accessible content should create their own MediaItem subclass.
+ */
+public abstract class Rygel.MediaFileItem : MediaItem {
+ /**
+ * The mime type of the source content (this.uri).
+ * A null/empty value means that the mime-type is unknown
+ */
+ public string mime_type { get; set; }
+
+ /**
+ * The DLNA profile of the source content (this.uri).
+ * A null/empty value means that the DLNA profile is unknown
+ */
+ public string dlna_profile { get; set; }
+
+ /**
+ * The size of the source content (this.uri).
+ * A value of -1 means that the size is unknown
+ */
+ private int64 _size = -1;
+ public int64 size {
+ get {
+ return this._size;
+ }
+
+ set {
+ if (value == 0) {
+ this.place_holder = true;
+ }
+
+ this._size = value;
+ }
+ } // Size in bytes
+
+ public bool place_holder { get; set; default = false; }
+
+ public override OCMFlags ocm_flags {
+ get {
+ var flags = OCMFlags.NONE;
+
+ if (this.place_holder) {
+ // Place-holder items are always destroyable.
+ flags |= OCMFlags.DESTROYABLE;
+ } else {
+ var config = MetaConfig.get_default ();
+ var allow_deletion = true;
+
+ try {
+ allow_deletion = config.get_allow_deletion ();
+ } catch (Error error) {}
+
+ if (allow_deletion) {
+ flags |= OCMFlags.DESTROYABLE;
+ }
+ }
+
+ if (this is UpdatableObject) {
+ flags |= OCMFlags.CHANGE_METADATA;
+ }
+
+ return flags;
+ }
+ }
+
+ protected static Regex address_regex;
+
+ public MediaFileItem (string id,
+ MediaContainer parent,
+ string title,
+ string upnp_class) {
+ Object (id : id,
+ parent : parent,
+ title : title,
+ upnp_class : upnp_class);
+ }
+
+ static construct {
+ try {
+ address_regex = new Regex (Regex.escape_string ("@ADDRESS@"));
+ } catch (GLib.RegexError err) {
+ assert_not_reached ();
+ }
+ }
+
+ // Live media items need to provide a nice working implementation of this
+ // method if they can/do not provide a valid URI
+ public virtual DataSource? create_stream_source (string? host_ip = null) {
+ if (this.get_uris ().is_empty) {
+ return null;
+ }
+
+ string translated_uri = this.get_primary_uri ();
+ if (host_ip != null) {
+ try {
+ translated_uri = MediaFileItem.address_regex.replace_literal
+ (translated_uri, -1, 0, host_ip);
+ } catch (Error error) {
+ assert_not_reached ();
+ }
+ }
+
+ return MediaEngine.get_default ().create_data_source (translated_uri);
+ }
+
+ public bool is_live_stream () {
+ return this.streamable () && this.size <= 0;
+ }
+
+ public abstract bool streamable ();
+
+ internal int compare_transcoders (Transcoder transcoder1,
+ Transcoder transcoder2) {
+ return (int) transcoder1.get_distance (this) -
+ (int) transcoder2.get_distance (this);
+ }
+
+ internal override DIDLLiteResource add_resource
+ (DIDLLiteObject didl_object,
+ string? uri,
+ string protocol,
+ string? import_uri = null)
+ throws Error {
+ var res = base.add_resource (didl_object,
+ uri,
+ protocol,
+ import_uri);
+
+ if (uri != null && !this.place_holder) {
+ res.uri = uri;
+ } else {
+ // Set empty string otherwise gupnp-av (libxml actually) will add
+ // a self-enclosing node in the DIDL-Lite which is not very much
+ // appreciated by UPnP devices using crappy XML parsers.
+ res.uri = "";
+ }
+
+ if (import_uri != null && this.place_holder) {
+ res.import_uri = import_uri;
+ }
+
+ if (this is TrackableItem) {
+ // This is attribute is mandatory for track changes
+ // implementation. We don't really support updating the resources
+ // so we just set it to 0.
+ res.update_count = 0;
+ }
+
+ res.size64 = this.size;
+
+ /* Protocol info */
+ res.protocol_info = this.get_protocol_info (uri, protocol);
+
+ return res;
+ }
+
+ internal override DIDLLiteObject? serialize (Serializer serializer,
+ HTTPServer http_server)
+ throws Error {
+ var didl_item = base.serialize (serializer, http_server)
+ as DIDLLiteItem;
+
+ /* We list proxy/transcoding resources first instead of original URIs
+ * because some crappy MediaRenderer/ControlPoint implemenation out
+ * there just choose the first one in the list instead of the one they
+ * can handle.
+ */
+ this.add_proxy_resources (http_server, didl_item);
+
+ if (!this.place_holder) {
+ var host_ip = http_server.context.host_ip;
+
+ // then original URIs
+ bool internal_allowed;
+ internal_allowed = http_server.context.interface == "lo" ||
+ host_ip == "127.0.0.1";
+ this.add_resources (didl_item, internal_allowed);
+
+ foreach (var res in didl_item.get_resources ()) {
+ res.uri = MediaFileItem.address_regex.replace_literal (res.uri,
+ -1,
+ 0,
+ host_ip);
+ }
+ }
+
+ return didl_item;
+ }
+
+ internal virtual void add_proxy_resources (HTTPServer server,
+ DIDLLiteItem didl_item)
+ throws Error {
+ // Proxy resource for the original resources
+ server.add_proxy_resource (didl_item, this);
+
+ if (!this.place_holder) {
+ // Transcoding resources
+ server.add_resources (didl_item, this);
+ }
+ }
+
+ protected override ProtocolInfo get_protocol_info (string? uri,
+ string protocol) {
+ var protocol_info = base.get_protocol_info (uri, protocol);
+
+ protocol_info.mime_type = this.mime_type;
+ protocol_info.dlna_profile = this.dlna_profile;
+
+ if (this.size > 0) {
+ protocol_info.dlna_operation = DLNAOperation.RANGE;
+ }
+
+ if (this.streamable ()) {
+ protocol_info.dlna_flags |= DLNAFlags.STREAMING_TRANSFER_MODE;
+ }
+
+ return protocol_info;
+ }
+
+ internal string get_protocol_for_uri (string uri) throws Error {
+ var scheme = Uri.parse_scheme (uri);
+ if (scheme == null) {
+ throw new MediaItemError.BAD_URI (_("Bad URI: %s"), uri);
+ }
+
+ if (scheme == "http") {
+ return "http-get";
+ } else if (scheme == "file") {
+ return "internal";
+ } else if (scheme == "rtsp") {
+ // FIXME: Assuming that RTSP is always accompanied with RTP over UDP
+ return "rtsp-rtp-udp";
+ } else {
+ // Assume the protocol to be the scheme of the URI
+ warning (_("Failed to probe protocol for URI %s. Assuming '%s'"),
+ uri,
+ scheme);
+
+ return scheme;
+ }
+ }
+
+ protected virtual void add_resources (DIDLLiteItem didl_item,
+ bool allow_internal)
+ throws Error {
+ foreach (var uri in this.get_uris ()) {
+ var protocol = this.get_protocol_for_uri (uri);
+
+ if (allow_internal || protocol != "internal") {
+ this.add_resource (didl_item, uri, protocol);
+ }
+ }
+ }
+}
diff --git a/src/librygel-server/rygel-media-item.vala b/src/librygel-server/rygel-media-item.vala
index 2782e8d..dbaf579 100644
--- a/src/librygel-server/rygel-media-item.vala
+++ b/src/librygel-server/rygel-media-item.vala
@@ -2,9 +2,12 @@
* Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
* Copyright (C) 2010 Nokia Corporation.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
* <zeeshan ali nokia com>
+ * Doug Galligan <doug sentosatech com>
+ * Craig Pratt <craig ecaspia com>
*
* This file is part of Rygel.
*
@@ -30,154 +33,14 @@ private errordomain Rygel.MediaItemError {
}
/**
- * Represents a media item (Music, Video or Image).
+ * Abstract class representing a MediaItem
*
- * These objects correspond to items in the UPnP ContentDirectory's DIDL-Lite XML.
+ * MediaItems must live in a container and may not contain other MediaItems
*/
public abstract class Rygel.MediaItem : MediaObject {
- // Resource info
- public string mime_type { get; set; }
- public string dlna_profile { get; set; }
-
- // Size in bytes
- private int64 _size = -1;
- public int64 size {
- get {
- return this._size;
- }
-
- set {
- if (value == 0) {
- this.place_holder = true;
- }
-
- this._size = value;
- }
- } // Size in bytes
-
- public bool place_holder { get; set; default = false; }
public string description { get; set; default = null; }
- public override OCMFlags ocm_flags {
- get {
- var flags = OCMFlags.NONE;
-
- if (this.place_holder) {
- // Place-holder items are always destroyable.
- flags |= OCMFlags.DESTROYABLE;
- } else {
- var config = MetaConfig.get_default ();
- var allow_deletion = true;
-
- try {
- allow_deletion = config.get_allow_deletion ();
- } catch (Error error) {}
-
- if (allow_deletion) {
- flags |= OCMFlags.DESTROYABLE;
- }
- }
-
- if (this is UpdatableObject) {
- flags |= OCMFlags.CHANGE_METADATA;
- }
-
- return flags;
- }
- }
-
- protected static Regex address_regex;
-
- public MediaItem (string id,
- MediaContainer parent,
- string title,
- string upnp_class) {
- Object (id : id,
- parent : parent,
- title : title,
- upnp_class : upnp_class);
- }
-
- static construct {
- try {
- address_regex = new Regex (Regex.escape_string ("@ADDRESS@"));
- } catch (GLib.RegexError err) {
- assert_not_reached ();
- }
- }
-
- // Live media items need to provide a nice working implementation of this
- // method if they can/do not provide a valid URI
- public virtual DataSource? create_stream_source (string? host_ip = null) {
- if (this.get_uris ().is_empty) {
- return null;
- }
-
- string translated_uri = this.get_primary_uri ();
- if (host_ip != null) {
- try {
- translated_uri = MediaItem.address_regex.replace_literal
- (this.get_primary_uri (), -1, 0, host_ip);
- } catch (Error error) {
- assert_not_reached ();
- }
- }
-
- return MediaEngine.get_default ().create_data_source (translated_uri);
- }
-
- public bool is_live_stream () {
- return this.streamable () && this.size <= 0;
- }
-
- public abstract bool streamable ();
-
- internal int compare_transcoders (Transcoder transcoder1,
- Transcoder transcoder2) {
- return (int) transcoder1.get_distance (this) -
- (int) transcoder2.get_distance (this);
- }
-
- internal override DIDLLiteResource add_resource
- (DIDLLiteObject didl_object,
- string? uri,
- string protocol,
- string? import_uri = null)
- throws Error {
- var res = base.add_resource (didl_object,
- uri,
- protocol,
- import_uri);
-
- if (uri != null && !this.place_holder) {
- res.uri = uri;
- } else {
- // Set empty string otherwise gupnp-av (libxml actually) will add
- // a self-enclosing node in the DIDL-Lite which is not very much
- // appreciated by UPnP devices using crappy XML parsers.
- res.uri = "";
- }
-
- if (import_uri != null && this.place_holder) {
- res.import_uri = import_uri;
- }
-
- if (this is TrackableItem) {
- // This is attribute is mandatory for track changes
- // implementation. We don't really support updating the resources
- // so we just set it to 0.
- res.update_count = 0;
- }
-
- res.size64 = this.size;
-
- /* Protocol info */
- res.protocol_info = this.get_protocol_info (uri, protocol);
-
- return res;
- }
-
internal override void apply_didl_lite (DIDLLiteObject didl_object) {
base.apply_didl_lite (didl_object);
@@ -239,96 +102,18 @@ public abstract class Rygel.MediaItem : MediaObject {
didl_item.genre = this.genre;
}
- /* We list proxy/transcoding resources first instead of original URIs
- * because some crappy MediaRenderer/ControlPoint implemenation out
- * there just choose the first one in the list instead of the one they
- * can handle.
- */
- this.add_proxy_resources (http_server, didl_item);
- if (!this.place_holder) {
- var host_ip = http_server.context.host_ip;
-
- // then original URIs
- this.add_resources (didl_item, http_server.is_local ());
-
- foreach (var res in didl_item.get_resources ()) {
- res.uri = MediaItem.address_regex.replace_literal (res.uri,
- -1,
- 0,
- host_ip);
- }
- }
-
return didl_item;
}
- internal virtual void add_proxy_resources (HTTPServer server,
- DIDLLiteItem didl_item)
- throws Error {
- // Proxy resource for the original resources
- server.add_proxy_resource (didl_item, this);
-
- if (!this.place_holder) {
- // Transcoding resources
- server.add_resources (didl_item, this);
- }
- }
-
protected virtual ProtocolInfo get_protocol_info (string? uri,
string protocol) {
var protocol_info = new ProtocolInfo ();
- protocol_info.mime_type = this.mime_type;
- protocol_info.dlna_profile = this.dlna_profile;
protocol_info.protocol = protocol;
protocol_info.dlna_flags = DLNAFlags.DLNA_V15 |
DLNAFlags.CONNECTION_STALL |
DLNAFlags.BACKGROUND_TRANSFER_MODE;
- if (this.size > 0) {
- protocol_info.dlna_operation = DLNAOperation.RANGE;
- }
-
- if (this.streamable ()) {
- protocol_info.dlna_flags |= DLNAFlags.STREAMING_TRANSFER_MODE;
- }
-
return protocol_info;
}
-
- internal string get_protocol_for_uri (string uri) throws Error {
- var scheme = Uri.parse_scheme (uri);
- if (scheme == null) {
- throw new MediaItemError.BAD_URI (_("Bad URI: %s"), uri);
- }
-
- if (scheme == "http") {
- return "http-get";
- } else if (scheme == "file") {
- return "internal";
- } else if (scheme == "rtsp") {
- // FIXME: Assuming that RTSP is always accompanied with RTP over UDP
- return "rtsp-rtp-udp";
- } else {
- // Assume the protocol to be the scheme of the URI
- warning (_("Failed to probe protocol for URI %s. Assuming '%s'"),
- uri,
- scheme);
-
- return scheme;
- }
- }
-
- protected virtual void add_resources (DIDLLiteItem didl_item,
- bool allow_internal)
- throws Error {
- foreach (var uri in this.get_uris ()) {
- var protocol = this.get_protocol_for_uri (uri);
-
- if (allow_internal || protocol != "internal") {
- this.add_resource (didl_item, uri, protocol);
- }
- }
- }
-
}
diff --git a/src/librygel-server/rygel-media-object.vala b/src/librygel-server/rygel-media-object.vala
index 7446ed1..4b185f7 100644
--- a/src/librygel-server/rygel-media-object.vala
+++ b/src/librygel-server/rygel-media-object.vala
@@ -1,8 +1,11 @@
/*
* Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Author: Zeeshan Ali <zeenix gmail com>
+ * Doug Galligan <doug sentosatech com>
+ * Craig Pratt <craig ecaspia com>
*
* This file is part of Rygel.
*
@@ -27,11 +30,8 @@ using Gee;
/**
* Represents a media object (container or item).
*
- * The derived RygelMediaContainer class represents a container,
- * and the derived RygelMediaItem classes (RygelAudioItem,
- * RygelImageItem and RygelVideoItem) represent media items.
- *
- * These objects correspond to items and containers in the UPnP ContentDirectory's DIDL-Lite XML.
+ * The derived RygelMediaContainer class represents a container
+ * and the derived MediaItem classes represent media items.
*/
public abstract class Rygel.MediaObject : GLib.Object {
private static Regex real_name_regex;
diff --git a/src/librygel-server/rygel-music-item.vala b/src/librygel-server/rygel-music-item.vala
index a7963cb..38edff5 100644
--- a/src/librygel-server/rygel-music-item.vala
+++ b/src/librygel-server/rygel-music-item.vala
@@ -112,7 +112,7 @@ public class Rygel.MusicItem : AudioItem {
}
if (didl_item.album_art != null) {
- didl_item.album_art = MediaItem.address_regex.replace_literal
+ didl_item.album_art = MediaFileItem.address_regex.replace_literal
(didl_item.album_art,
-1,
0,
diff --git a/src/librygel-server/rygel-object-creator.vala b/src/librygel-server/rygel-object-creator.vala
index cd28655..1922a49 100644
--- a/src/librygel-server/rygel-object-creator.vala
+++ b/src/librygel-server/rygel-object-creator.vala
@@ -152,8 +152,8 @@ internal class Rygel.ObjectCreator: GLib.Object, Rygel.StateMachine {
}
yield this.create_object_from_didl (container);
- if (this.object is MediaItem) {
- yield container.add_item (this.object as MediaItem,
+ if (this.object is MediaFileItem) {
+ yield container.add_item (this.object as MediaFileItem,
this.cancellable);
} else {
yield container.add_container (this.object as MediaContainer,
@@ -168,8 +168,8 @@ internal class Rygel.ObjectCreator: GLib.Object, Rygel.StateMachine {
this.conclude ();
if (this.container_id == MediaContainer.ANY &&
- (this.object is MediaItem && (this.object as
- MediaItem).place_holder)) {
+ (this.object is MediaFileItem &&
+ (this.object as MediaFileItem).place_holder)) {
var queue = ObjectRemovalQueue.get_default ();
queue.queue (this.object, this.cancellable);
@@ -474,11 +474,11 @@ internal class Rygel.ObjectCreator: GLib.Object, Rygel.StateMachine {
}
private string get_generic_mime_type () {
- if (!(this.object is MediaItem)) {
+ if (!(this.object is MediaFileItem)) {
return "";
}
- var item = this.object as MediaItem;
+ var item = this.object as MediaFileItem;
if (item is ImageItem) {
return "image";
@@ -516,13 +516,13 @@ internal class Rygel.ObjectCreator: GLib.Object, Rygel.StateMachine {
if (this.object.get_uris ().is_empty) {
var uri = yield this.create_uri (container, this.object.title);
this.object.add_uri (uri);
- if (this.object is MediaItem) {
- (this.object as MediaItem).place_holder = true;
+ if (this.object is MediaFileItem) {
+ (this.object as MediaFileItem).place_holder = true;
}
} else {
- if (this.object is MediaItem) {
+ if (this.object is MediaFileItem) {
var file = File.new_for_uri (this.object.get_primary_uri ());
- (this.object as MediaItem).place_holder = !file.is_native ();
+ (this.object as MediaFileItem).place_holder = !file.is_native ();
}
}
@@ -532,7 +532,7 @@ internal class Rygel.ObjectCreator: GLib.Object, Rygel.StateMachine {
}
private void extract_item_parameters () throws Error {
- var item = this.object as MediaItem;
+ var item = this.object as MediaFileItem;
foreach (var resource in this.didl_object.get_resources ()) {
var info = resource.protocol_info;
@@ -585,7 +585,7 @@ internal class Rygel.ObjectCreator: GLib.Object, Rygel.StateMachine {
var parsed_date = new Soup.Date.from_string (didl_item.date);
if (parsed_date != null) {
- (this.object as MediaItem).date = parsed_date.to_string
+ (this.object as MediaFileItem).date = parsed_date.to_string
(Soup.DateFormat.ISO8601);
return;
@@ -611,7 +611,7 @@ internal class Rygel.ObjectCreator: GLib.Object, Rygel.StateMachine {
didl_item.date);
}
- (this.object as MediaItem).date = didl_item.date + "T00:00:00";
+ (this.object as MediaFileItem).date = didl_item.date + "T00:00:00";
}
private MediaObject create_object (string id,
diff --git a/src/librygel-server/rygel-panasonic-hacks.vala b/src/librygel-server/rygel-panasonic-hacks.vala
index e3bd7de..6a08ddb 100644
--- a/src/librygel-server/rygel-panasonic-hacks.vala
+++ b/src/librygel-server/rygel-panasonic-hacks.vala
@@ -43,11 +43,11 @@ internal class Rygel.PanasonicHacks : ClientHacks {
}
public override void apply (MediaObject object) {
- if (!(object is MediaItem)) {
+ if (!(object is MediaFileItem)) {
return;
}
- var item = object as MediaItem;
+ var item = object as MediaFileItem;
if (!(item is VisualItem)) {
return;
diff --git a/src/librygel-server/rygel-playlist-item.vala b/src/librygel-server/rygel-playlist-item.vala
index 4495941..8306d92 100644
--- a/src/librygel-server/rygel-playlist-item.vala
+++ b/src/librygel-server/rygel-playlist-item.vala
@@ -27,7 +27,7 @@ using GUPnP;
*
* These objects correspond to DLNA's DIDL_S items.
*/
-public class Rygel.PlaylistItem : MediaItem {
+public class Rygel.PlaylistItem : MediaFileItem {
public new const string UPNP_CLASS = "object.item.playlistItem";
public PlaylistItem (string id,
diff --git a/src/librygel-server/rygel-samsung-tv-hacks.vala b/src/librygel-server/rygel-samsung-tv-hacks.vala
index e6a35fc..ef59d6c 100644
--- a/src/librygel-server/rygel-samsung-tv-hacks.vala
+++ b/src/librygel-server/rygel-samsung-tv-hacks.vala
@@ -29,11 +29,11 @@ internal class Rygel.SamsungTVHacks : ClientHacks {
}
public override void apply (MediaObject object) {
- if (!(object is MediaItem)) {
+ if (!(object is MediaFileItem)) {
return;
}
- var item = object as MediaItem;
+ var item = object as MediaFileItem;
if (item.mime_type == "video/x-matroska") {
item.mime_type = "video/x-mkv";
}
diff --git a/src/librygel-server/rygel-transcode-manager.vala
b/src/librygel-server/rygel-transcode-manager.vala
index 8df32d3..5367215 100644
--- a/src/librygel-server/rygel-transcode-manager.vala
+++ b/src/librygel-server/rygel-transcode-manager.vala
@@ -41,13 +41,13 @@ public abstract class Rygel.TranscodeManager : GLib.Object {
public TranscodeManager () { }
- public abstract string create_uri_for_item (MediaItem item,
- int thumbnail_index,
- int subtitle_index,
- string? transcode_target,
- string? playlist_target);
+ public abstract string create_uri_for_item (MediaFileItem item,
+ int thumbnail_index,
+ int subtitle_index,
+ string? transcode_target,
+ string? playlist_target);
- public void add_resources (DIDLLiteItem didl_item, MediaItem item)
+ public void add_resources (DIDLLiteItem didl_item, MediaFileItem item)
throws Error {
var engine = MediaEngine.get_default ();
var list = new GLib.List<Transcoder> ();
diff --git a/src/librygel-server/rygel-transcoder.vala b/src/librygel-server/rygel-transcoder.vala
index fcaab7b..45071e0 100644
--- a/src/librygel-server/rygel-transcoder.vala
+++ b/src/librygel-server/rygel-transcoder.vala
@@ -70,7 +70,7 @@ public abstract class Rygel.Transcoder : GLib.Object {
* @return The new resource.
*/
public virtual DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
- MediaItem item,
+ MediaFileItem item,
TranscodeManager manager)
throws Error {
if (this.mime_type_is_a (item.mime_type, this.mime_type) &&
diff --git a/src/librygel-server/rygel-video-item.vala b/src/librygel-server/rygel-video-item.vala
index 40bb464..379fe55 100644
--- a/src/librygel-server/rygel-video-item.vala
+++ b/src/librygel-server/rygel-video-item.vala
@@ -2,10 +2,12 @@
* Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
* Copyright (C) 2010 Nokia Corporation.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
* <zeeshan ali nokia com>
* Jens Georg <jensg openismus com>
+ * Craig Pratt <craig ecaspia com>
*
* This file is part of Rygel.
*
@@ -39,20 +41,20 @@ public class Rygel.VideoItem : AudioItem, VisualItem {
//See valadoc bug: https://bugzilla.gnome.org/show_bug.cgi?id=684367
/**
- * The width of the item in pixels.
- * A value of -1 means that the width is unknown and will not, or did not, appear in DIDL-Lite XML.
+ * The width of the item source content (this.uri) in pixels
+ * A value of -1 means that the width is unknown
*/
public int width { get; set; default = -1; }
/**
- * The height of the item in pixels.
- * A value of -1 means that the height is unknown and will not, or did not, appear in DIDL-Lite XML.
+ * The height of the item source content (this.uri) in pixels
+ * A value of -1 means that the height is unknown
*/
public int height { get; set; default = -1; }
/**
- * The number of bits per pixel used to represent the video resource.
- * A value of -1 means that the color depth is unknown and will not, or did not, appear in DIDL-Lite XML.
+ * The number of bits per pixel in the source video resource (this.uri)
+ * A value of -1 means that the color depth is unknown
*/
public int color_depth { get; set; default = -1; }
diff --git a/src/librygel-server/rygel-visual-item.vala b/src/librygel-server/rygel-visual-item.vala
index 2caaf34..de2ae54 100644
--- a/src/librygel-server/rygel-visual-item.vala
+++ b/src/librygel-server/rygel-visual-item.vala
@@ -2,10 +2,12 @@
* Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
* Copyright (C) 2010 Nokia Corporation.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
* <zeeshan ali nokia com>
* Jens Georg <jensg openismus com>
+ * Craig Pratt <craig ecaspia com>
*
* This file is part of Rygel.
*
@@ -28,25 +30,25 @@ using GUPnP;
using Gee;
/**
- * An interface that visual (video and image) items must implement.
+ * An interface representing visual properties of an item stored in a file.
*/
-public interface Rygel.VisualItem : MediaItem {
+public interface Rygel.VisualItem : MediaFileItem {
/**
- * The width of the item in pixels.
- * A value of -1 means that the width is unknown and will not, or did not, appear in DIDL-Lite XML.
+ * The width of the source content (this.uri) in pixels.
+ * A value of -1 means that the width is unknown
*/
public abstract int width { get; set; }
/**
- * The height of the item in pixels.
- * A value of -1 means that the height is unknown and will not, or did not, appear in DIDL-Lite XML.
+ * The height of the source content (this.uri) in pixels.
+ * A value of -1 means that the height is unknown
*/
public abstract int height { get; set; }
/**
- * The number of bits per pixel used to represent the video or image resource.
- * A value of -1 means that the color depth is unknown and will not, or did not, appear in DIDL-Lite XML.
+ * The number of bits per pixel in the video or image resource (this.uri).
+ * A value of -1 means that the color depth is unknown
*/
public abstract int color_depth { get; set; }
diff --git a/src/librygel-server/rygel-writable-container.vala
b/src/librygel-server/rygel-writable-container.vala
index dc87a79..148ecfb 100644
--- a/src/librygel-server/rygel-writable-container.vala
+++ b/src/librygel-server/rygel-writable-container.vala
@@ -84,8 +84,8 @@ public interface Rygel.WritableContainer : MediaContainer {
*
* @return nothing.
*/
- public async abstract void add_item (MediaItem item,
- Cancellable? cancellable) throws Error;
+ public async abstract void add_item (MediaFileItem item,
+ Cancellable? cancellable) throws Error;
/**
diff --git a/src/librygel-server/rygel-xbmc-hacks.vala b/src/librygel-server/rygel-xbmc-hacks.vala
index f028ace..0a57a60 100644
--- a/src/librygel-server/rygel-xbmc-hacks.vala
+++ b/src/librygel-server/rygel-xbmc-hacks.vala
@@ -33,11 +33,11 @@ internal class Rygel.XBMCHacks : ClientHacks {
}
public override void apply (MediaObject object) {
- if (!(object is MediaItem)) {
+ if (!(object is MediaFileItem)) {
return;
}
- var item = object as MediaItem;
+ var item = object as MediaFileItem;
if (item.mime_type == "audio/mp4" ||
item.mime_type == "audio/3gpp" ||
diff --git a/src/librygel-server/rygel-xbox-hacks.vala b/src/librygel-server/rygel-xbox-hacks.vala
index 9592d45..13ae89b 100644
--- a/src/librygel-server/rygel-xbox-hacks.vala
+++ b/src/librygel-server/rygel-xbox-hacks.vala
@@ -121,7 +121,11 @@ internal class Rygel.XBoxHacks : ClientHacks {
return;
}
- var item = object as MediaItem;
+ if (! (object is MediaFileItem)) {
+ return;
+ }
+
+ var item = object as MediaFileItem;
if (item.mime_type == "video/x-msvideo") {
item.mime_type = "video/avi";
diff --git a/src/media-engines/gstreamer/rygel-audio-transcoder.vala
b/src/media-engines/gstreamer/rygel-audio-transcoder.vala
index bdddc04..8694f54 100644
--- a/src/media-engines/gstreamer/rygel-audio-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-audio-transcoder.vala
@@ -68,7 +68,7 @@ internal class Rygel.AudioTranscoder : Rygel.GstTranscoder {
public override DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
- MediaItem item,
+ MediaFileItem item,
TranscodeManager manager)
throws Error {
var resource = base.add_resource (didl_item, item, manager);
diff --git a/src/media-engines/gstreamer/rygel-avc-transcoder.vala
b/src/media-engines/gstreamer/rygel-avc-transcoder.vala
index b53764b..7d49d8e 100644
--- a/src/media-engines/gstreamer/rygel-avc-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-avc-transcoder.vala
@@ -51,7 +51,7 @@ internal class Rygel.AVCTranscoder : Rygel.VideoTranscoder {
}
public override DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
- MediaItem item,
+ MediaFileItem item,
TranscodeManager manager)
throws Error {
var resource = base.add_resource (didl_item, item, manager);
diff --git a/src/media-engines/gstreamer/rygel-l16-transcoder.vala
b/src/media-engines/gstreamer/rygel-l16-transcoder.vala
index 538d405..a9e0044 100644
--- a/src/media-engines/gstreamer/rygel-l16-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-l16-transcoder.vala
@@ -53,7 +53,7 @@ internal class Rygel.L16Transcoder : Rygel.AudioTranscoder {
}
public override DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
- MediaItem item,
+ MediaFileItem item,
TranscodeManager manager)
throws Error {
var resource = base.add_resource (didl_item, item, manager);
diff --git a/src/media-engines/gstreamer/rygel-mp2ts-transcoder.vala
b/src/media-engines/gstreamer/rygel-mp2ts-transcoder.vala
index 05c5a2b..04334b3 100644
--- a/src/media-engines/gstreamer/rygel-mp2ts-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-mp2ts-transcoder.vala
@@ -75,7 +75,7 @@ internal class Rygel.MP2TSTranscoder : Rygel.VideoTranscoder {
}
public override DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
- MediaItem item,
+ MediaFileItem item,
TranscodeManager manager)
throws Error {
var resource = base.add_resource (didl_item, item, manager);
diff --git a/src/media-engines/gstreamer/rygel-video-transcoder.vala
b/src/media-engines/gstreamer/rygel-video-transcoder.vala
index 2863917..4cd3c68 100644
--- a/src/media-engines/gstreamer/rygel-video-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-video-transcoder.vala
@@ -57,7 +57,7 @@ internal class Rygel.VideoTranscoder : Rygel.AudioTranscoder {
}
public override DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
- MediaItem item,
+ MediaFileItem item,
TranscodeManager manager)
throws Error {
var resource = base.add_resource (didl_item, item, manager);
diff --git a/src/plugins/external/rygel-external-item-factory.vala
b/src/plugins/external/rygel-external-item-factory.vala
index 46711c7..77b1cf2 100644
--- a/src/plugins/external/rygel-external-item-factory.vala
+++ b/src/plugins/external/rygel-external-item-factory.vala
@@ -28,14 +28,14 @@ using GUPnP;
* Creates item for external plugins.
*/
public class Rygel.External.ItemFactory {
- public async MediaItem create (string id,
- string type,
- string title,
- HashTable<string,Variant> props,
- string service_name,
- MediaContainer parent)
- throws IOError, DBusError {
- MediaItem item;
+ public async MediaFileItem create (string id,
+ string type,
+ string title,
+ HashTable<string,Variant> props,
+ string service_name,
+ MediaContainer parent)
+ throws IOError, DBusError {
+ MediaFileItem item;
if (type.has_prefix ("music") ||
type.has_prefix ("audio.music")) {
@@ -129,7 +129,7 @@ public class Rygel.External.ItemFactory {
this.set_audio_metadata (video, props, service_name);
}
- private void set_generic_metadata (MediaItem item,
+ private void set_generic_metadata (MediaFileItem item,
HashTable<string,Variant> props,
string service_name) {
item.mime_type = get_mandatory_string_value (props,
diff --git a/src/plugins/gst-launch/rygel-gst-launch-root-container.vala
b/src/plugins/gst-launch/rygel-gst-launch-root-container.vala
index b917c91..d307c34 100644
--- a/src/plugins/gst-launch/rygel-gst-launch-root-container.vala
+++ b/src/plugins/gst-launch/rygel-gst-launch-root-container.vala
@@ -53,7 +53,7 @@ public class Rygel.GstLaunch.RootContainer : SimpleContainer {
var launch_line = config.get_string (CONFIG_GROUP,
"%s-launch".printf (name));
string dlna_profile = null;
- MediaItem item;
+ MediaFileItem item;
try {
dlna_profile = config.get_string (CONFIG_GROUP,
"%s-dlnaprofile".printf
diff --git a/src/plugins/media-export/rygel-media-export-harvesting-task.vala
b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
index a2bd29f..fc5756f 100644
--- a/src/plugins/media-export/rygel-media-export-harvesting-task.vala
+++ b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
@@ -290,7 +290,7 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
this.completed ();
}
- MediaItem item;
+ MediaFileItem item;
if (dlna == null) {
item = ItemFactory.create_simple (this.containers.peek_head (),
file,
diff --git a/src/plugins/media-export/rygel-media-export-item-factory.vala
b/src/plugins/media-export/rygel-media-export-item-factory.vala
index a04b455..34248ee 100644
--- a/src/plugins/media-export/rygel-media-export-item-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-item-factory.vala
@@ -31,11 +31,11 @@ using Gst.PbUtils;
* Represents MediaExport item.
*/
namespace Rygel.MediaExport.ItemFactory {
- public static MediaItem? create_simple (MediaContainer parent,
- File file,
- FileInfo info) {
+ public static MediaFileItem? create_simple (MediaContainer parent,
+ File file,
+ FileInfo info) {
var title = info.get_display_name ();
- MediaItem item;
+ MediaFileItem item;
var mime = ContentType.get_mime_type (info.get_content_type ());
if (mime.has_prefix ("video/")) {
@@ -62,9 +62,9 @@ namespace Rygel.MediaExport.ItemFactory {
return item;
}
- private static MediaItem? create_playlist_item (File file,
- MediaContainer parent,
- string fallback_title) {
+ private static MediaFileItem? create_playlist_item (File file,
+ MediaContainer parent,
+ string fallback_title) {
try {
uint8[] contents;
@@ -112,12 +112,12 @@ namespace Rygel.MediaExport.ItemFactory {
}
}
- public static MediaItem? create_from_info (MediaContainer parent,
- File file,
- DiscovererInfo info,
- GUPnPDLNA.Profile? profile,
- FileInfo file_info) {
- MediaItem item;
+ public static MediaFileItem? create_from_info (MediaContainer parent,
+ File file,
+ DiscovererInfo info,
+ GUPnPDLNA.Profile? profile,
+ FileInfo file_info) {
+ MediaFileItem item;
string id = MediaCache.get_id (file);
GLib.List<DiscovererAudioInfo> audio_streams;
GLib.List<DiscovererVideoInfo> video_streams;
@@ -195,13 +195,13 @@ namespace Rygel.MediaExport.ItemFactory {
}
- private static MediaItem fill_video_item (VideoItem item,
- File file,
- DiscovererInfo info,
- GUPnPDLNA.Profile? profile,
- DiscovererVideoInfo video_info,
- DiscovererAudioInfo? audio_info,
- FileInfo file_info) {
+ private static MediaFileItem fill_video_item (VideoItem item,
+ File file,
+ DiscovererInfo info,
+ GUPnPDLNA.Profile? profile,
+ DiscovererVideoInfo video_info,
+ DiscovererAudioInfo? audio_info,
+ FileInfo file_info) {
fill_audio_item (item as AudioItem, info, audio_info);
fill_media_item (item, file, info, profile, file_info);
@@ -214,12 +214,12 @@ namespace Rygel.MediaExport.ItemFactory {
return item;
}
- private static MediaItem fill_photo_item (PhotoItem item,
- File file,
- DiscovererInfo info,
- GUPnPDLNA.Profile? profile,
- DiscovererVideoInfo video_info,
- FileInfo file_info) {
+ private static MediaFileItem fill_photo_item (PhotoItem item,
+ File file,
+ DiscovererInfo info,
+ GUPnPDLNA.Profile? profile,
+ DiscovererVideoInfo video_info,
+ FileInfo file_info) {
fill_media_item (item, file, info, profile, file_info);
item.width = (int) video_info.get_width ();
@@ -231,12 +231,12 @@ namespace Rygel.MediaExport.ItemFactory {
return item;
}
- private static MediaItem fill_music_item (MusicItem item,
- File file,
- DiscovererInfo info,
- GUPnPDLNA.Profile? profile,
- DiscovererAudioInfo? audio_info,
- FileInfo file_info) {
+ private static MediaFileItem fill_music_item (MusicItem item,
+ File file,
+ DiscovererInfo info,
+ GUPnPDLNA.Profile? profile,
+ DiscovererAudioInfo? audio_info,
+ FileInfo file_info) {
fill_audio_item (item as AudioItem, info, audio_info);
fill_media_item (item, file, info, profile, file_info);
@@ -309,7 +309,7 @@ namespace Rygel.MediaExport.ItemFactory {
return item;
}
- private static void fill_media_item (MediaItem item,
+ private static void fill_media_item (MediaFileItem item,
File file,
DiscovererInfo info,
GUPnPDLNA.Profile? profile,
diff --git a/src/plugins/media-export/rygel-media-export-media-cache.vala
b/src/plugins/media-export/rygel-media-export-media-cache.vala
index 3221e61..d24c81b 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache.vala
@@ -1,8 +1,11 @@
/*
* Copyright (C) 2009,2010 Jens Georg <mail jensge org>.
* Copyright (C) 2013 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Author: Jens Georg <mail jensge org>
+ * Doug Galligan <doug sentosatech com>
+ * Craig Pratt <craig ecaspia com>
*
* This file is part of Rygel.
*
@@ -21,7 +24,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
using Gee;
using GUPnP;
using Sqlite;
@@ -119,7 +121,7 @@ public class Rygel.MediaExport.MediaCache : Object {
/**
* Add the item to the cache.
*/
- public void save_item (Rygel.MediaItem item,
+ public void save_item (Rygel.MediaFileItem item,
bool override_guarded = false) throws Error {
try {
db.begin ();
@@ -574,7 +576,7 @@ public class Rygel.MediaExport.MediaCache : Object {
}
object.id = UUID.get ();
- this.save_item (object as MediaItem);
+ this.save_item (object as MediaFileItem);
return object.id;
}
@@ -692,7 +694,7 @@ public class Rygel.MediaExport.MediaCache : Object {
}
- private void save_item_metadata (Rygel.MediaItem item) throws Error {
+ private void save_item_metadata (Rygel.MediaFileItem item) throws Error {
// Fill common properties
GLib.Value[] values = { item.size,
item.mime_type,
@@ -756,7 +758,7 @@ public class Rygel.MediaExport.MediaCache : Object {
int type = ObjectType.CONTAINER;
GLib.Value parent;
- if (object is MediaItem) {
+ if (object is MediaFileItem) {
type = ObjectType.ITEM;
}
@@ -789,7 +791,7 @@ public class Rygel.MediaExport.MediaCache : Object {
int type = ObjectType.CONTAINER;
GLib.Value parent;
- if (object is MediaItem) {
+ if (object is MediaFileItem) {
type = ObjectType.ITEM;
}
@@ -902,10 +904,11 @@ public class Rygel.MediaExport.MediaCache : Object {
object_id,
title,
upnp_class);
- fill_item (statement, object as MediaItem);
+ var item = object as MediaFileItem;
+ fill_item (statement, item);
if (uri != null) {
- (object as MediaItem).add_uri (uri);
+ item.add_uri (uri);
}
break;
default:
@@ -914,9 +917,9 @@ public class Rygel.MediaExport.MediaCache : Object {
if (object != null) {
object.modified = statement.column_int64 (DetailColumn.TIMESTAMP);
- if (object.modified == int64.MAX && object is MediaItem) {
+ if (object.modified == int64.MAX && object is MediaFileItem) {
object.modified = 0;
- (object as MediaItem).place_holder = true;
+ (object as MediaFileItem).place_holder = true;
}
object.object_update_id = (uint) statement.column_int64
(DetailColumn.OBJECT_UPDATE_ID);
@@ -926,7 +929,7 @@ public class Rygel.MediaExport.MediaCache : Object {
return object;
}
- private void fill_item (Statement statement, MediaItem item) {
+ private void fill_item (Statement statement, MediaFileItem item) {
// Fill common properties
item.date = statement.column_text (DetailColumn.DATE);
item.mime_type = statement.column_text (DetailColumn.MIME_TYPE);
diff --git a/src/plugins/media-export/rygel-media-export-object-factory.vala
b/src/plugins/media-export/rygel-media-export-object-factory.vala
index 0335d70..8ce86cd 100644
--- a/src/plugins/media-export/rygel-media-export-object-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-object-factory.vala
@@ -78,17 +78,17 @@ internal class Rygel.MediaExport.ObjectFactory : Object {
}
/**
- * Return a new instance of MediaItem
+ * Return a new instance of MediaFileItem
*
* @param media_db instance of MediaDB
* @param id id of the item
* @param title title of the item
* @param upnp_class upnp_class of the item
*/
- public virtual MediaItem get_item (MediaContainer parent,
- string id,
- string title,
- string upnp_class) {
+ public virtual MediaFileItem get_item (MediaContainer parent,
+ string id,
+ string title,
+ string upnp_class) {
switch (upnp_class) {
case Rygel.MusicItem.UPNP_CLASS:
case Rygel.AudioItem.UPNP_CLASS:
diff --git a/src/plugins/media-export/rygel-media-export-playlist-container.vala
b/src/plugins/media-export/rygel-media-export-playlist-container.vala
index cb20146..5c80def 100644
--- a/src/plugins/media-export/rygel-media-export-playlist-container.vala
+++ b/src/plugins/media-export/rygel-media-export-playlist-container.vala
@@ -63,7 +63,7 @@ internal class Rygel.MediaExport.PlaylistContainer : DBContainer,
}
}
- public async void add_item (Rygel.MediaItem item,
+ public async void add_item (Rygel.MediaFileItem item,
Cancellable? cancellable)
throws Error {
throw new WritableContainerError.NOT_IMPLEMENTED
diff --git a/src/plugins/media-export/rygel-media-export-playlist-root-container.vala
b/src/plugins/media-export/rygel-media-export-playlist-root-container.vala
index 224626d..ee1b582 100644
--- a/src/plugins/media-export/rygel-media-export-playlist-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-playlist-root-container.vala
@@ -68,8 +68,8 @@ internal class Rygel.MediaExport.PlaylistRootContainer : Rygel.WritableContainer
}
}
- public async void add_item (Rygel.MediaItem item,
- Cancellable? cancellable)
+ public async void add_item (Rygel.MediaFileItem item,
+ Cancellable? cancellable)
throws Error {
throw new WritableContainerError.NOT_IMPLEMENTED
(_("Can't create items in %s"),
diff --git a/src/plugins/media-export/rygel-media-export-trackable-db-container.vala
b/src/plugins/media-export/rygel-media-export-trackable-db-container.vala
index 10c1d8f..918aba4 100644
--- a/src/plugins/media-export/rygel-media-export-trackable-db-container.vala
+++ b/src/plugins/media-export/rygel-media-export-trackable-db-container.vala
@@ -45,7 +45,7 @@ public class Rygel.MediaExport.TrackableDbContainer : DBContainer,
var cache = this.media_db;
if (object is MediaItem) {
- cache.save_item (object as MediaItem);
+ cache.save_item (object as MediaFileItem);
} else if (object is MediaContainer) {
cache.save_container (object as MediaContainer);
} else {
@@ -69,7 +69,7 @@ public class Rygel.MediaExport.TrackableDbContainer : DBContainer,
protected async void add_child (MediaObject object) {
try {
if (object is MediaItem) {
- this.media_db.save_item (object as MediaItem);
+ this.media_db.save_item (object as MediaFileItem);
} else if (object is MediaContainer) {
this.media_db.save_container (object as MediaContainer);
} else {
diff --git a/src/plugins/media-export/rygel-media-export-writable-db-container.vala
b/src/plugins/media-export/rygel-media-export-writable-db-container.vala
index cae8745..4b68956 100644
--- a/src/plugins/media-export/rygel-media-export-writable-db-container.vala
+++ b/src/plugins/media-export/rygel-media-export-writable-db-container.vala
@@ -56,7 +56,7 @@ internal class Rygel.MediaExport.WritableDbContainer : TrackableDbContainer,
this.create_classes.add (Rygel.MediaContainer.UPNP_CLASS);
}
- public virtual async void add_item (Rygel.MediaItem item,
+ public virtual async void add_item (Rygel.MediaFileItem item,
Cancellable? cancellable)
throws Error {
item.parent = this;
diff --git a/src/plugins/tracker/rygel-tracker-category-all-container.vala
b/src/plugins/tracker/rygel-tracker-category-all-container.vala
index d5bd213..5df1640 100644
--- a/src/plugins/tracker/rygel-tracker-category-all-container.vala
+++ b/src/plugins/tracker/rygel-tracker-category-all-container.vala
@@ -82,7 +82,7 @@ public class Rygel.Tracker.CategoryAllContainer : SearchContainer,
cleanup_query.execute.begin (this.resources);
}
- public async void add_item (MediaItem item, Cancellable? cancellable)
+ public async void add_item (MediaFileItem item, Cancellable? cancellable)
throws Error {
var urn = yield this.create_entry_in_store (item);
@@ -133,7 +133,8 @@ public class Rygel.Tracker.CategoryAllContainer : SearchContainer,
this.get_children_count.begin ();
}
- private async string create_entry_in_store (MediaItem item) throws Error {
+ private async string create_entry_in_store (MediaFileItem item)
+ throws Error {
var category = this.item_factory.category;
var query = new InsertionQuery (item, category);
diff --git a/src/plugins/tracker/rygel-tracker-insertion-query.vala
b/src/plugins/tracker/rygel-tracker-insertion-query.vala
index a953ebe..7a9d52d 100644
--- a/src/plugins/tracker/rygel-tracker-insertion-query.vala
+++ b/src/plugins/tracker/rygel-tracker-insertion-query.vala
@@ -53,7 +53,7 @@ public class Rygel.Tracker.InsertionQuery : Query {
private string uri;
- public InsertionQuery (MediaItem item, string category) {
+ public InsertionQuery (MediaFileItem item, string category) {
var type = "nie:DataObject";
var file = File.new_for_uri (item.get_primary_uri ());
diff --git a/src/plugins/tracker/rygel-tracker-item-factory.vala
b/src/plugins/tracker/rygel-tracker-item-factory.vala
index 0edbafb..2b86881 100644
--- a/src/plugins/tracker/rygel-tracker-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-item-factory.vala
@@ -3,10 +3,12 @@
* Copyright (C) 2008-2012 Nokia Corporation.
* Copyright (C) 2010 MediaNet Inh.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Authors: Zeeshan Ali <zeenix gmail com>
* Sunil Mohan Adapa <sunil medhas org>
* Jens Georg <jensg openismus com>
+ * Doug Galligan <doug sentosatech com>
*
* This file is part of Rygel.
*
@@ -80,13 +82,13 @@ public abstract class Rygel.Tracker.ItemFactory {
this.properties.add ("date");
}
- public abstract MediaItem create (string id,
- string uri,
- SearchContainer parent,
- Sparql.Cursor metadata)
- throws GLib.Error;
+ public abstract MediaFileItem create (string id,
+ string uri,
+ SearchContainer parent,
+ Sparql.Cursor metadata)
+ throws GLib.Error;
- protected void set_ref_id (MediaItem item, string prefix) {
+ protected void set_ref_id (MediaFileItem item, string prefix) {
if (item.id.has_prefix (prefix)) {
return;
}
@@ -99,7 +101,7 @@ public abstract class Rygel.Tracker.ItemFactory {
item.ref_id = prefix + "," + split_id[1];
}
- protected virtual void set_metadata (MediaItem item,
+ protected virtual void set_metadata (MediaFileItem item,
string uri,
Sparql.Cursor metadata)
throws GLib.Error {
@@ -129,7 +131,9 @@ public abstract class Rygel.Tracker.ItemFactory {
item.dlna_profile = metadata.get_string (Metadata.DLNA_PROFILE);
}
- item.mime_type = metadata.get_string (Metadata.MIME);
+ if (metadata.is_bound (Metadata.MIME)) {
+ item.mime_type = metadata.get_string (Metadata.MIME);
+ }
item.add_uri (uri);
}
diff --git a/src/plugins/tracker/rygel-tracker-music-item-factory.vala
b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
index fbd491d..802d8fe 100644
--- a/src/plugins/tracker/rygel-tracker-music-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
@@ -71,11 +71,11 @@ public class Rygel.Tracker.MusicItemFactory : ItemFactory {
this.properties.add ("upnp:bitrate");
}
- public override MediaItem create (string id,
- string uri,
- SearchContainer parent,
- Sparql.Cursor metadata)
- throws GLib.Error {
+ public override MediaFileItem create (string id,
+ string uri,
+ SearchContainer parent,
+ Sparql.Cursor metadata)
+ throws GLib.Error {
var item = new MusicItem (id, parent, "");
this.set_metadata (item, uri, metadata);
@@ -83,8 +83,8 @@ public class Rygel.Tracker.MusicItemFactory : ItemFactory {
return item;
}
- protected override void set_metadata (MediaItem item,
- string uri,
+ protected override void set_metadata (MediaFileItem item,
+ string uri,
Sparql.Cursor metadata)
throws GLib.Error {
base.set_metadata (item, uri, metadata);
diff --git a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
index 4cf398e..8282f0e 100644
--- a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
@@ -56,11 +56,11 @@ public class Rygel.Tracker.PictureItemFactory : ItemFactory {
this.properties.add ("width");
}
- public override MediaItem create (string id,
- string uri,
- SearchContainer parent,
- Sparql.Cursor metadata)
- throws GLib.Error {
+ public override MediaFileItem create (string id,
+ string uri,
+ SearchContainer parent,
+ Sparql.Cursor metadata)
+ throws GLib.Error {
var item = new PhotoItem (id, parent, "");
this.set_metadata (item, uri, metadata);
@@ -68,7 +68,7 @@ public class Rygel.Tracker.PictureItemFactory : ItemFactory {
return item;
}
- protected override void set_metadata (MediaItem item,
+ protected override void set_metadata (MediaFileItem item,
string uri,
Sparql.Cursor metadata)
throws GLib.Error {
diff --git a/src/plugins/tracker/rygel-tracker-video-item-factory.vala
b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
index e2f79c3..95a5667 100644
--- a/src/plugins/tracker/rygel-tracker-video-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
@@ -59,11 +59,11 @@ public class Rygel.Tracker.VideoItemFactory : ItemFactory {
this.properties.add ("res duration");
}
- public override MediaItem create (string id,
- string uri,
- SearchContainer parent,
- Sparql.Cursor metadata)
- throws GLib.Error {
+ public override MediaFileItem create (string id,
+ string uri,
+ SearchContainer parent,
+ Sparql.Cursor metadata)
+ throws GLib.Error {
var item = new VideoItem (id, parent, "");
this.set_metadata (item, uri, metadata);
@@ -71,9 +71,9 @@ public class Rygel.Tracker.VideoItemFactory : ItemFactory {
return item;
}
- protected override void set_metadata (MediaItem item,
- string uri,
- Sparql.Cursor metadata)
+ protected override void set_metadata (MediaFileItem item,
+ string uri,
+ Sparql.Cursor metadata)
throws GLib.Error {
base.set_metadata (item, uri, metadata);
diff --git a/tests/rygel-http-byte-seek-test.vala b/tests/rygel-http-byte-seek-test.vala
index 087a661..dd6329a 100644
--- a/tests/rygel-http-byte-seek-test.vala
+++ b/tests/rygel-http-byte-seek-test.vala
@@ -31,7 +31,7 @@ public class Rygel.MediaObject : GLib.Object {
public int64 size = 2048;
}
-private class Rygel.MediaItem : MediaObject {
+private class Rygel.MediaFileItem : MediaObject {
}
private class Rygel.Thumbnail : GLib.Object {
@@ -67,7 +67,7 @@ private class Rygel.HTTPGet : GLib.Object {
public HTTPGet (Thumbnail? thumbnail, Subtitle? subtitle) {
this.msg = new Soup.Message ("HTTP", ITEM_URI);
- this.object = new MediaItem ();
+ this.object = new MediaFileItem ();
this.handler = new HTTPIdentityHandler ();
this.thumbnail = thumbnail;
this.subtitle = subtitle;
diff --git a/tests/rygel-http-get-test.vala b/tests/rygel-http-get-test.vala
index bd5e2bb..0d04bc5 100644
--- a/tests/rygel-http-get-test.vala
+++ b/tests/rygel-http-get-test.vala
@@ -388,7 +388,7 @@ internal class Rygel.HTTPPlaylistHandler : Rygel.HTTPGetHandler {
public static bool is_supported (string? arg) { return true; }
}
-public abstract class Rygel.MediaItem : Rygel.MediaObject {
+public abstract class Rygel.MediaFileItem : Rygel.MediaObject {
public long size = 1024;
public ArrayList<string> uris = new ArrayList<string> ();
@@ -408,7 +408,7 @@ public abstract class Rygel.MediaItem : Rygel.MediaObject {
}
}
-private class Rygel.AudioItem : MediaItem {
+private class Rygel.AudioItem : MediaFileItem {
public int64 duration = 2048;
public AudioItem () {
@@ -416,7 +416,7 @@ private class Rygel.AudioItem : MediaItem {
}
}
-private interface Rygel.VisualItem : MediaItem {
+private interface Rygel.VisualItem : MediaFileItem {
public abstract int width { get; set; }
public abstract int height { get; set; }
public abstract int color_depth { get; set; }
diff --git a/tests/rygel-http-item-uri-test.vala b/tests/rygel-http-item-uri-test.vala
index 1a15353..6028325 100644
--- a/tests/rygel-http-item-uri-test.vala
+++ b/tests/rygel-http-item-uri-test.vala
@@ -76,7 +76,7 @@ private class Rygel.MediaObject : GLib.Object {
public string id;
}
-private class Rygel.MediaItem : Rygel.MediaObject {
+private class Rygel.MediaFileItem : Rygel.MediaObject {
public ArrayList<string> uris = new ArrayList<string> ();
public string mime_type;
public Gee.ArrayList<string> get_uris () { return this.uris; }
@@ -86,7 +86,7 @@ private class Rygel.Thumbnail {
public string file_extension;
}
-private class Rygel.VisualItem : MediaItem {
+private class Rygel.VisualItem : MediaFileItem {
public ArrayList<Thumbnail> thumbnails = new ArrayList<Thumbnail> ();
}
@@ -98,7 +98,7 @@ private class Rygel.VideoItem : VisualItem {
public ArrayList<Subtitle> subtitles = new ArrayList<Subtitle> ();
}
-private class Rygel.MusicItem : MediaItem {
+private class Rygel.MusicItem : MediaFileItem {
public Thumbnail album_art;
}
diff --git a/tests/rygel-http-post-test.vala b/tests/rygel-http-post-test.vala
index 34d35a2..25eff3c 100644
--- a/tests/rygel-http-post-test.vala
+++ b/tests/rygel-http-post-test.vala
@@ -38,7 +38,7 @@ public class Rygel.ClientHacks {
throw new ClientHacksError.NA ("");
}
- public void apply (MediaItem item) {
+ public void apply (MediaFileItem item) {
}
}
@@ -102,7 +102,7 @@ public class Rygel.HTTPPostTest : GLib.Object {
public virtual void run () throws Error {
// cleanup
- var file = File.new_for_uri (MediaItem.URI);
+ var file = File.new_for_uri (MediaFileItem.URI);
FileUtils.remove (file.get_path ());
Timeout.add_seconds (10, this.on_timeout);
@@ -254,14 +254,14 @@ public class Rygel.HTTPServer : GLib.Object {
public string uri {
owned get {
- var item = new MediaItem (MediaContainer.ITEM_ID, this.root_container);
+ var item = new MediaFileItem (MediaContainer.ITEM_ID, this.root_container);
var item_uri = new HTTPItemURI (item, this);
return item_uri.to_string ();
}
}
public string create_uri(string item_id) {
- var item = new MediaItem (item_id, this.root_container);
+ var item = new MediaFileItem (item_id, this.root_container);
var item_uri = new HTTPItemURI (item, this);
return item_uri.to_string ();
}
@@ -339,7 +339,7 @@ public class Rygel.MediaContainer : Rygel.MediaObject {
public signal void container_updated (MediaContainer container);
- public MediaItem item;
+ public MediaFileItem item;
private bool vanish;
private bool error;
@@ -347,8 +347,8 @@ public class Rygel.MediaContainer : Rygel.MediaObject {
private FileMonitor monitor;
public MediaContainer () {
- this.file = File.new_for_uri (MediaItem.URI);
- this.item = new MediaItem (ITEM_ID, this);
+ this.file = File.new_for_uri (MediaFileItem.URI);
+ this.item = new MediaFileItem (ITEM_ID, this);
this.vanish = false;
this.error = false;
this.id = "TesContainer";
@@ -392,7 +392,7 @@ public class Rygel.MediaContainer : Rygel.MediaObject {
}
if (item_id != this.item.id) {
- this.item = new MediaItem (item_id, this);
+ this.item = new MediaFileItem (item_id, this);
}
return this.item;
@@ -416,7 +416,7 @@ public class Rygel.MediaContainer : Rygel.MediaObject {
}
}
-public class Rygel.MediaItem : Rygel.MediaObject {
+public class Rygel.MediaFileItem : Rygel.MediaObject {
public const string URI = "file:///tmp/rygel-upload-test.wav";
public long size = 1024;
@@ -428,9 +428,9 @@ public class Rygel.MediaItem : Rygel.MediaObject {
public File file;
- public MediaItem.for_visual_item () {}
+ public MediaFileItem.for_visual_item () {}
- public MediaItem (string id, MediaContainer parent) {
+ public MediaFileItem (string id, MediaContainer parent) {
this.id = id;
this.parent = parent;
@@ -514,7 +514,7 @@ public class Rygel.Thumbnail : GLib.Object {
public string file_extension;
}
-public class Rygel.VisualItem : Rygel.MediaItem {
+public class Rygel.VisualItem : Rygel.MediaFileItem {
public ArrayList<Thumbnail> thumbnails = new ArrayList<Thumbnail> ();
public VisualItem () {
@@ -530,7 +530,7 @@ private class Rygel.VideoItem : Rygel.VisualItem {
public ArrayList<Subtitle> subtitles = new ArrayList<Subtitle> ();
}
-private class Rygel.MusicItem : MediaItem {
+private class Rygel.MusicItem : MediaFileItem {
public Thumbnail album_art;
public MusicItem (string id, MediaContainer parent) {
diff --git a/tests/rygel-http-time-seek-test.vala b/tests/rygel-http-time-seek-test.vala
index e916c68..47a6fb5 100644
--- a/tests/rygel-http-time-seek-test.vala
+++ b/tests/rygel-http-time-seek-test.vala
@@ -34,13 +34,13 @@ public class Rygel.MediaObject : GLib.Object {
public class Rygel.MediaContainer : MediaObject {
}
-private abstract class Rygel.MediaItem : MediaObject {
+private abstract class Rygel.MediaFileItem : MediaObject {
public bool is_live_stream () {
return true;
}
}
-private class Rygel.AudioItem : MediaItem {
+private class Rygel.AudioItem : MediaFileItem {
public int64 duration = 2048;
}
diff --git a/tests/rygel-object-creator-test.vala b/tests/rygel-object-creator-test.vala
index 99af3c8..08f4efb 100644
--- a/tests/rygel-object-creator-test.vala
+++ b/tests/rygel-object-creator-test.vala
@@ -160,13 +160,16 @@ public interface Rygel.TrackableItem : Rygel.MediaItem {
}
public class Rygel.MediaItem : Rygel.MediaObject {
+}
+
+public class Rygel.MediaFileItem : Rygel.MediaItem {
public string dlna_profile;
public string mime_type;
public long size;
public bool place_holder;
public string date;
- public MediaItem (string id, MediaContainer parent, string title) {
+ public MediaFileItem (string id, MediaContainer parent, string title) {
this.id = id;
this.parent = parent;
this.title = title;
@@ -182,7 +185,7 @@ public class Rygel.MusicItem : Rygel.AudioItem {
}
}
-public class Rygel.AudioItem : Rygel.MediaItem {
+public class Rygel.AudioItem : Rygel.MediaFileItem {
public const string UPNP_CLASS = "object.item.audioItem";
public string artist;
public string album;
@@ -191,21 +194,21 @@ public class Rygel.AudioItem : Rygel.MediaItem {
base (id, parent, title);
}
}
-public class Rygel.ImageItem : Rygel.MediaItem {
+public class Rygel.ImageItem : Rygel.MediaFileItem {
public new const string UPNP_CLASS = "object.item.imageItem";
public ImageItem (string id, MediaContainer parent, string title) {
base (id, parent, title);
}
}
-public class Rygel.VideoItem : Rygel.MediaItem {
+public class Rygel.VideoItem : Rygel.MediaFileItem {
public const string UPNP_CLASS = "object.item.videoItem";
public VideoItem (string id, MediaContainer parent, string title) {
base (id, parent, title);
}
}
-public class Rygel.PhotoItem : Rygel.MediaItem {
+public class Rygel.PhotoItem : Rygel.MediaFileItem {
public const string UPNP_CLASS = "object.item.imageItem.photo";
public string creator;
@@ -214,7 +217,7 @@ public class Rygel.PhotoItem : Rygel.MediaItem {
}
}
-public class Rygel.PlaylistItem : Rygel.MediaItem {
+public class Rygel.PlaylistItem : Rygel.MediaFileItem {
public const string UPNP_CLASS = "object.item.playlistItem";
public PlaylistItem (string id, MediaContainer parent, string title) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]