[rygel] server: Hack for AVI files on recent Phillips TVs



commit 7bd00365b4ff26910dcc36953f83002c16c38476
Author: Jens Georg <mail jensge org>
Date:   Thu May 12 22:36:23 2016 +0200

    server: Hack for AVI files on recent Phillips TVs
    
    Also needs video/avi as mime type for AVI files.
    
    Signed-off-by: Jens Georg <mail jensge org>

 src/librygel-server/filelist.am               |    1 +
 src/librygel-server/rygel-client-hacks.vala   |    4 ++
 src/librygel-server/rygel-phillips-hacks.vala |   40 +++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am
index 516e635..c1b8a27 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -81,6 +81,7 @@ LIBRYGEL_SERVER_NONVAPI_SOURCE_FILES = \
        rygel-wmp-hacks.vala \
        rygel-xbmc-hacks.vala \
        rygel-xbox-hacks.vala \
+       rygel-phillips-hacks.vala \
        rygel-data-sink.vala \
        rygel-playspeed.vala \
        rygel-playspeed-request.vala \
diff --git a/src/librygel-server/rygel-client-hacks.vala b/src/librygel-server/rygel-client-hacks.vala
index abf73dd..709dd57 100644
--- a/src/librygel-server/rygel-client-hacks.vala
+++ b/src/librygel-server/rygel-client-hacks.vala
@@ -83,6 +83,10 @@ internal abstract class Rygel.ClientHacks : GLib.Object {
             return new LGTVHacks (message);
         } catch (Error error) { }
 
+        try {
+            return new PhillipsHacks (message);
+        } catch (Error error) { }
+
         return new XBMCHacks (message);
     }
 
diff --git a/src/librygel-server/rygel-phillips-hacks.vala b/src/librygel-server/rygel-phillips-hacks.vala
new file mode 100644
index 0000000..2a1984d
--- /dev/null
+++ b/src/librygel-server/rygel-phillips-hacks.vala
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2016 Jens Georg <mail jensge org>
+ *
+ * Author: Jens Georg <mail jensge org>
+ *
+ * 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.1 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+using Soup;
+using GUPnP;
+
+internal class Rygel.PhillipsHacks : ClientHacks {
+    private const string AGENT = ".*IPI/.*";
+
+    public PhillipsHacks (Message? message = null) throws ClientHacksError {
+        base (AGENT, message);
+    }
+
+    public override void apply (MediaObject object) {
+        foreach (var resource in object.get_resource_list ()) {
+            if (resource.mime_type == "video/x-msvideo") {
+                resource.mime_type = "video/avi";
+            }
+        }
+    }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]