[rygel] server: Fix mime-type rewriting
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] server: Fix mime-type rewriting
- Date: Thu, 14 May 2015 17:29:31 +0000 (UTC)
commit 74e8d8ad6f25af3287d660923579195eaa56e12c
Author: Jens Georg <mail jensge org>
Date: Thu May 14 19:23:46 2015 +0200
server: Fix mime-type rewriting
Signed-off-by: Jens Georg <mail jensge org>
https://bugzilla.gnome.org/show_bug.cgi?id=748628
src/librygel-server/rygel-client-hacks.vala | 5 +++
src/librygel-server/rygel-lg-tv-hacks.vala | 17 ++++++------
src/librygel-server/rygel-samsung-tv-hacks.vala | 31 ++++++++++------------
src/librygel-server/rygel-xbmc-hacks.vala | 16 ++++-------
src/librygel-server/rygel-xbox-hacks.vala | 18 +++++--------
5 files changed, 41 insertions(+), 46 deletions(-)
---
diff --git a/src/librygel-server/rygel-client-hacks.vala b/src/librygel-server/rygel-client-hacks.vala
index 32a9013..7defa45 100644
--- a/src/librygel-server/rygel-client-hacks.vala
+++ b/src/librygel-server/rygel-client-hacks.vala
@@ -89,6 +89,11 @@ internal abstract class Rygel.ClientHacks : GLib.Object {
public virtual void translate_container_id (MediaQueryAction action,
ref string container_id) {}
+ /**
+ * Modify the passed media object.
+ *
+ * Called before serializing the Object to DIDL-Lite.
+ */
public virtual void apply (MediaObject object) {}
public virtual void filter_sort_criteria (ref string sort_criteria) {}
diff --git a/src/librygel-server/rygel-lg-tv-hacks.vala b/src/librygel-server/rygel-lg-tv-hacks.vala
index 9a533d1..c92b4cc 100644
--- a/src/librygel-server/rygel-lg-tv-hacks.vala
+++ b/src/librygel-server/rygel-lg-tv-hacks.vala
@@ -31,19 +31,20 @@ internal class Rygel.LGTVHacks : ClientHacks {
}
public override void apply (MediaObject object) {
- if (!(object is MediaFileItem)) {
- return;
+ foreach (var resource in object.get_resource_list ()) {
+ if (resource.mime_type == "audio/x-vorbis+ogg" ||
+ resource.mime_type == "audio/x-flac+ogg") {
+ resource.mime_type = "application/ogg";
+ }
}
- 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";
+ if (!(object is MediaFileItem)) {
+ return;
}
// Re-order resources to it picks up the MP3
- if (item is MusicItem) {
- var resources = item.get_resource_list ();
+ if (object is MusicItem) {
+ var resources = object.get_resource_list ();
var i = 0;
foreach (var resource in resources) {
diff --git a/src/librygel-server/rygel-samsung-tv-hacks.vala b/src/librygel-server/rygel-samsung-tv-hacks.vala
index 7e16bc8..a2fbd67 100644
--- a/src/librygel-server/rygel-samsung-tv-hacks.vala
+++ b/src/librygel-server/rygel-samsung-tv-hacks.vala
@@ -29,23 +29,20 @@ internal class Rygel.SamsungTVHacks : ClientHacks {
}
public override void apply (MediaObject object) {
- if (!(object is MediaFileItem)) {
- return;
- }
-
- var item = object as MediaFileItem;
- if (item.mime_type == "video/x-matroska") {
- item.mime_type = "video/x-mkv";
- }
- else if (item.mime_type == "video/mp2t") {
- // Required to play Panasonic TZ-7 AVCHD-Lite movies. Verified on D+E-Series TV
- // Example: http://s3.amazonaws.com/movies.dpreview.com/panasonic_dmcfz150/00015.MTS
- item.mime_type = "video/vnd.dlna.mpeg-tts";
- }
- else if (item.mime_type == "video/quicktime") {
- // Required to play Canon EOS camera movies. Verfied on D-Series TV (E-Series still don't work)
- // Example: http://s3.amazonaws.com/movies.dpreview.com/canon_eos60d/MVI_1326.MOV
- item.mime_type = "video/mp4";
+ foreach (var resource in object.get_resource_list ()) {
+ if (resource.mime_type == "video/x-matroska") {
+ resource.mime_type = "video/x-mkv";
+ } else if (resource.mime_type == "video/mp2t") {
+ // Required to play Panasonic TZ-7 AVCHD-Lite movies. Verified
+ // on D+E-Series TV
+ // Example: http://s3.amazonaws.com/movies.dpreview.com/panasonic_dmcfz150/00015.MTS
+ resource.mime_type = "video/vnd.dlna.mpeg-tts";
+ } else if (resource.mime_type == "video/quicktime") {
+ // Required to play Canon EOS camera movies. Verfied on
+ // D-Series TV (E-Series still don't work)
+ // Example: http://s3.amazonaws.com/movies.dpreview.com/canon_eos60d/MVI_1326.MOV
+ resource.mime_type = "video/mp4";
+ }
}
}
diff --git a/src/librygel-server/rygel-xbmc-hacks.vala b/src/librygel-server/rygel-xbmc-hacks.vala
index 01c22c7..9126e0c 100644
--- a/src/librygel-server/rygel-xbmc-hacks.vala
+++ b/src/librygel-server/rygel-xbmc-hacks.vala
@@ -33,16 +33,12 @@ internal class Rygel.XBMCHacks : ClientHacks {
}
public override void apply (MediaObject object) {
- if (!(object is MediaFileItem)) {
- return;
- }
-
- var item = object as MediaFileItem;
-
- if (item.mime_type == "audio/mp4" ||
- item.mime_type == "audio/3gpp" ||
- item.mime_type == "audio/vnd.dlna.adts") {
- item.mime_type = "audio/aac";
+ foreach (var resource in object.get_resource_list ()) {
+ if (resource.mime_type == "audio/mp4" ||
+ resource.mime_type == "audio/3gpp" ||
+ resource.mime_type == "audio/vnd.dlna.adts") {
+ resource.mime_type = "audio/aac";
+ }
}
}
diff --git a/src/librygel-server/rygel-xbox-hacks.vala b/src/librygel-server/rygel-xbox-hacks.vala
index 02a989a..c27ae5c 100644
--- a/src/librygel-server/rygel-xbox-hacks.vala
+++ b/src/librygel-server/rygel-xbox-hacks.vala
@@ -121,17 +121,13 @@ internal class Rygel.XBoxHacks : ClientHacks {
return;
}
- if (! (object is MediaFileItem)) {
- return;
- }
-
- var item = object as MediaFileItem;
-
- if (item.mime_type == "video/x-msvideo") {
- item.mime_type = "video/avi";
- } else if (item.mime_type == "video/mpeg") {
- // Force transcoding for MPEG files
- item.mime_type = "invalid/content";
+ foreach (var resource in object.get_resource_list ()) {
+ if (resource.mime_type == "video/x-msvideo") {
+ resource.mime_type = "video/avi";
+ } else if (resource.mime_type == "video/mpeg") {
+ // Force transcoding for MPEG files
+ resource.mime_type = "invalid/content";
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]