[rygel] tracker: Take mime-type from gupnp-dlna



commit 331cbb4e43d7a6eacfdcdc6e1b088ce542579cae
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Apr 12 19:03:10 2011 +0300

    tracker: Take mime-type from gupnp-dlna
    
    In order to work around bug#647575, we take mime-type from gupnp-dlna
    (whenever possible) rather than Tracker.

 src/plugins/tracker/Makefile.am                    |    8 +++++---
 .../tracker/rygel-tracker-item-factory.vala        |   17 ++++++++++++++---
 2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/tracker/Makefile.am b/src/plugins/tracker/Makefile.am
index 507582f..ccb1c1f 100644
--- a/src/plugins/tracker/Makefile.am
+++ b/src/plugins/tracker/Makefile.am
@@ -2,7 +2,7 @@ include ../../../common.am
 
 plugin_LTLIBRARIES = librygel-tracker.la
 
-AM_CFLAGS += -DG_LOG_DOMAIN='"Tracker"'
+AM_CFLAGS += -DG_LOG_DOMAIN='"Tracker"' $(LIBGUPNP_DLNA_CFLAGS)
 
 librygel_tracker_la_SOURCES = \
 	rygel-tracker-root-container.vala \
@@ -35,6 +35,8 @@ librygel_tracker_la_SOURCES = \
 	rygel-tracker-plugin-factory.vala \
 	rygel-tracker-interfaces.vala
 
-librygel_tracker_la_VALAFLAGS = --pkg posix $(RYGEL_COMMON_PLUGIN_VALAFLAGS)
-librygel_tracker_la_LIBADD = $(RYGEL_COMMON_LDADD)
+librygel_tracker_la_VALAFLAGS = --pkg posix \
+				--pkg gupnp-dlna-1.0 \
+				$(RYGEL_COMMON_PLUGIN_VALAFLAGS)
+librygel_tracker_la_LIBADD = $(RYGEL_COMMON_LDADD) $(LIBGUPNP_DLNA_LIBS)
 librygel_tracker_la_LDFLAGS = $(RYGEL_PLUGIN_LINKER_FLAGS)
diff --git a/src/plugins/tracker/rygel-tracker-item-factory.vala b/src/plugins/tracker/rygel-tracker-item-factory.vala
index afe9f29..84ff639 100644
--- a/src/plugins/tracker/rygel-tracker-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-item-factory.vala
@@ -24,6 +24,8 @@
  */
 
 using Gee;
+using GUPnP;
+using Gst;
 
 /**
  * Abstract Tracker item factory.
@@ -47,6 +49,8 @@ public abstract class Rygel.Tracker.ItemFactory {
 
     public ArrayList<string> properties;
 
+    private DLNADiscoverer discoverer;
+
     public ItemFactory (string  category,
                         string  upnp_class,
                         string? upload_dir) {
@@ -54,6 +58,10 @@ public abstract class Rygel.Tracker.ItemFactory {
         this.upnp_class = upnp_class;
         this.upload_dir = upload_dir;
 
+        // FIXME: In order to work around bug#647575, we take mime-type from
+        //        gupnp-dlna rather than Tracker.
+        this.discoverer = new DLNADiscoverer ((ClockTime) SECOND, true, true);
+
         this.properties = new ArrayList<string> ();
 
         // These must be the same order as enum Metadata
@@ -92,10 +100,13 @@ public abstract class Rygel.Tracker.ItemFactory {
         if (metadata[Metadata.DATE] != "")
             item.date = metadata[Metadata.DATE];
 
-        if (metadata[Metadata.DLNA_PROFILE] != "")
+        if (metadata[Metadata.DLNA_PROFILE] != "") {
             item.dlna_profile = metadata[Metadata.DLNA_PROFILE];
-
-        item.mime_type = metadata[Metadata.MIME];
+            var profile = this.discoverer.get_profile (item.dlna_profile);
+            item.mime_type = profile.mime;
+        } else {
+            item.mime_type = metadata[Metadata.MIME];
+        }
 
         item.add_uri (uri);
     }



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