[rygel/wip/dvd: 51/56] media-export: More details on DVD videos



commit 7470b3d4cec15e67ef02e0761bf4e64f59aeb8f3
Author: Jens Georg <mail jensge org>
Date:   Wed Sep 16 15:05:15 2015 +0200

    media-export: More details on DVD videos
    
    Signed-off-by: Jens Georg <mail jensge org>

 .../rygel-media-export-dvd-container.vala          |   42 +++++++++++++------
 1 files changed, 29 insertions(+), 13 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-dvd-container.vala 
b/src/plugins/media-export/rygel-media-export-dvd-container.vala
index 073da27..1113951 100644
--- a/src/plugins/media-export/rygel-media-export-dvd-container.vala
+++ b/src/plugins/media-export/rygel-media-export-dvd-container.vala
@@ -160,19 +160,35 @@ internal class Rygel.MediaExport.DVDContainer : SimpleContainer, UpdatableObject
         uri.set_scheme ("dvd");
         uri.set_query ("title=%d".printf (track + 1));
         item.add_uri (uri.to_string (false));
-                var media_engine = MediaEngine.get_default ( );
-                media_engine.get_resources_for_item.begin ( item,
-                                                            (obj, res) => {
-                    var added_resources = media_engine
-                                          .get_resources_for_item.end (res);
-                    debug ("Adding %d resources to item source %s",
-                           added_resources.size, item.get_primary_uri ());
-                    foreach (var resrc in added_resources) {
-                       debug ("Media-export item media resource %s",
-                              resrc.get_name ());
-                    }
-                    item.get_resource_list ().add_all (added_resources);
-                  });
+
+        item.dlna_profile = "MPEG_PS";
+        item.mime_type = "video/mpeg";
+
+        var it = node->children;
+        while (it != null) {
+            if (it->name == "length") {
+                item.duration = (int)double.parse (it->children->content);
+            } else if (it->name == "width") {
+                item.width = int.parse (it->children->content);
+            } else if (it->name == "height") {
+                item.height = int.parse (it->children->content);
+            }
+            it = it->next;
+        }
+
+        var media_engine = MediaEngine.get_default ( );
+        media_engine.get_resources_for_item.begin ( item,
+                                                    (obj, res) => {
+            var added_resources = media_engine
+                                  .get_resources_for_item.end (res);
+            debug ("Adding %d resources to item source %s",
+                   added_resources.size, item.get_primary_uri ());
+            foreach (var resrc in added_resources) {
+               debug ("Media-export item media resource %s",
+                      resrc.get_name ());
+            }
+            item.get_resource_list ().add_all (added_resources);
+          });
 
         return item;
     }


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