[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    gst-plugins-bad: eglglessink: Fix aspect-ratio issues caused by scaling on RPi
From:       slomo () kemper ! freedesktop ! org (Sebastian Dröge)
Date:       2013-02-28 10:29:28
Message-ID: 20130228102928.5A9AA76A2C () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-bad
Branch: master
Commit: 31bed4c27d6b6212ea870533f95d7591ea7104d6
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=31bed4c27d6b6212ea870533f95d7591ea7104d6


Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Thu Feb 28 11:27:44 2013 +0100

eglglessink: Fix aspect-ratio issues caused by scaling on RPi

---

 ext/eglgles/video_platform_wrapper.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/ext/eglgles/video_platform_wrapper.c \
b/ext/eglgles/video_platform_wrapper.c index d9e799f..085b818 100644
--- a/ext/eglgles/video_platform_wrapper.c
+++ b/ext/eglgles/video_platform_wrapper.c
@@ -669,6 +669,7 @@ platform_free_eglimage (EGLDisplay display, EGLContext context, \
GLuint tex_id,  #ifdef USE_EGL_RPI
 #include <bcm_host.h>
 #include <gst/video/gstvideopool.h>
+#include <gst/video/gstvideosink.h>
 
 typedef struct
 {
@@ -685,6 +686,7 @@ platform_create_native_window (gint width, gint height, gpointer \
* window_data)  RPIWindowData *data;
   VC_RECT_T dst_rect;
   VC_RECT_T src_rect;
+  GstVideoRectangle src, dst, res;
 
   uint32_t dp_height;
   uint32_t dp_width;
@@ -699,10 +701,19 @@ platform_create_native_window (gint width, gint height, \
gpointer * window_data)  GST_DEBUG ("Got display size: %dx%d\n", dp_width, \
dp_height);  GST_DEBUG ("Source size: %dx%d\n", width, height);
 
-  dst_rect.x = 0;
-  dst_rect.y = 0;
-  dst_rect.width = dp_width;
-  dst_rect.height = dp_height;
+  /* Center width*height frame inside dp_width*dp_height */
+  src.w = width;
+  src.h = height;
+  src.x = src.y = 0;
+  dst.w = dp_width;
+  dst.h = dp_height;
+  dst.x = dst.y = 0;
+  gst_video_sink_center_rect (&src, &dst, &res, TRUE);
+
+  dst_rect.x = res.x;
+  dst_rect.y = res.y;
+  dst_rect.width = res.w;
+  dst_rect.height = res.h;
 
   src_rect.x = 0;
   src_rect.y = 0;



_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic