[rygel/wip/lms-tizen: 4/12] lms plugin: add missing fields to video object



commit 4b38950b791261a4dd7deb0cdd716fbf7958a23d
Author: Alexander Kanavin <alex kanavin gmail com>
Date:   Wed Mar 12 16:36:27 2014 +0200

    lms plugin: add missing fields to video object

 src/plugins/lms/rygel-lms-all-videos.vala |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/lms/rygel-lms-all-videos.vala b/src/plugins/lms/rygel-lms-all-videos.vala
index 33cb649..d28cb96 100644
--- a/src/plugins/lms/rygel-lms-all-videos.vala
+++ b/src/plugins/lms/rygel-lms-all-videos.vala
@@ -76,6 +76,23 @@ public class Rygel.LMS.AllVideos : Rygel.LMS.CategoryContainer {
         video.mime_type = mime_type;
         video.add_uri (file.get_uri ());
 
+        // Rygel does not support multiple video and audio tracks in a single file,
+        // so we just take the first one
+        var video_data = "select videos_videos.bitrate + videos_audios.bitrate, width, height, channels, 
sampling_rate " +
+            "from videos, videos_audios, videos_videos where videos.id = ? " +
+            "and videos.id = videos_audios.video_id and videos.id = videos_videos.video_id;";
+        try {
+            var stmt = this.lms_db.prepare(video_data);
+            Rygel.LMS.Database.find_object("%d".printf(id), stmt);
+            video.bitrate = stmt.column_int(0) / 8; //convert bits per second into bytes per second
+            video.width = stmt.column_int(1);
+            video.height = stmt.column_int(2);
+            video.channels = stmt.column_int(3);
+            video.sample_freq = stmt.column_int(4);
+        } catch (DatabaseError e) {
+            warning ("Query failed: %s", e.message);
+        }
+
         return video;
     }
 


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