[rygel] core: Use the correct pixel-aspect-ratio



commit 45d10050e1b3b5a18fc5796302245ee835299f3c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sun Jul 5 18:15:02 2009 +0300

    core: Use the correct pixel-aspect-ratio
    
    Use the correct pixel-aspect-ratio for transcoded videos.

 src/rygel/rygel-mp2ts-transcoder.vala |   34 +++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/src/rygel/rygel-mp2ts-transcoder.vala b/src/rygel/rygel-mp2ts-transcoder.vala
index 9069246..e42bc98 100644
--- a/src/rygel/rygel-mp2ts-transcoder.vala
+++ b/src/rygel/rygel-mp2ts-transcoder.vala
@@ -93,12 +93,34 @@ internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
         bin.add_many (videorate, videoscale, convert, encoder);
 
         convert.link_many (videoscale, videorate);
-        var caps = new Caps.simple (
-                                "video/x-raw-yuv",
-                                "width", typeof (int), WIDTH[this.profile],
-                                "height", typeof (int), HEIGHT[this.profile],
-                                "framerate", typeof (Fraction), 30, 1,
-                                "pixel-aspect-ratio", typeof (Fraction), 1, 1);
+
+        int pixel_w;
+        int pixel_h;
+
+        if (item.pixel_width > 0 && item.pixel_height > 0) {
+            pixel_w = item.width * HEIGHT[this.profile] * item.pixel_width;
+            pixel_h = item.height * WIDTH[this.profile] * item.pixel_height;
+        } else {
+            // Original pixel-ratio not provided, lets just use 1:1
+            pixel_w = 1;
+            pixel_h = 1;
+        }
+
+        var caps = new Caps.simple ("video/x-raw-yuv",
+                                    "width",
+                                        typeof (int),
+                                        WIDTH[this.profile],
+                                    "height",
+                                        typeof (int),
+                                        HEIGHT[this.profile],
+                                    "framerate",
+                                        typeof (Fraction),
+                                        30,
+                                        1,
+                                    "pixel-aspect-ratio",
+                                        typeof (Fraction),
+                                        pixel_w,
+                                        pixel_h);
         videorate.link_filtered (encoder, caps);
 
         var pad = convert.get_static_pad ("sink");



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