diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2013-02-28 11:27:44 +0100 |
---|---|---|
committer | Josep Torra <n770galaxy@gmail.com> | 2013-03-01 17:24:36 +0100 |
commit | 9fec24fd4cf7257a2e806439e84e3f279836dbc7 (patch) | |
tree | 54f0dc0265d6ac61899df1fb2606b8914a02b6f9 | |
parent | bbcea7117458c2a21f542f3e8e6d8cf16bd0af6a (diff) |
eglglessink: Fix aspect-ratio issues caused by scaling on RPi
Conflicts:
ext/eglgles/video_platform_wrapper.c
-rw-r--r-- | 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 2f5115b47..4c8a2fd35 100644 --- a/ext/eglgles/video_platform_wrapper.c +++ b/ext/eglgles/video_platform_wrapper.c @@ -165,6 +165,7 @@ platform_destroy_native_window (EGLNativeDisplayType display, #ifdef USE_EGL_RPI #include <bcm_host.h> +#include <gst/video/gstvideosink.h> typedef struct { @@ -181,6 +182,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; @@ -195,10 +197,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; |