aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPooja Prajod2016-06-07 05:10:10 -0500
committerPooja Prajod2016-07-05 09:35:59 -0500
commit7dc3878cbba81c1f724e587b810b5c9db021ccaa (patch)
treed6afac1eacdd95d392851c82975972db7a5ef4cd
parent914e40f12995656fff9dfb4546edd4e91d3e48b9 (diff)
downloadgstreamer1-0-plugins-bad-7dc3878cbba81c1f724e587b810b5c9db021ccaa.tar.gz
gstreamer1-0-plugins-bad-7dc3878cbba81c1f724e587b810b5c9db021ccaa.tar.xz
gstreamer1-0-plugins-bad-7dc3878cbba81c1f724e587b810b5c9db021ccaa.zip
gst-waylandsink: add crop support
Weston has the support of cropping buffers by using wl_scaler and wl_viewport interface. Using this approach, video cropping can be achieved using openGL and no additional H/W is required. Author: Subhajit Paul <a0132170@ti.com> Signed-off-by: Pooja Prajod <a0132412@ti.com>
-rw-r--r--ext/wayland/gstwaylandsink.c4
-rw-r--r--ext/wayland/wldisplay-wlwindow.h3
-rw-r--r--ext/wayland/wlwindow.c15
3 files changed, 22 insertions, 0 deletions
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 6b6061b..d38712a 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -636,6 +636,10 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
636 636
637 GST_LOG_OBJECT (sink, "render buffer %p", buffer); 637 GST_LOG_OBJECT (sink, "render buffer %p", buffer);
638 638
639 if (sink->display) {
640 sink->display->crop = gst_buffer_get_video_crop_meta (buffer);
641 }
642
639 if (G_UNLIKELY (!sink->window)) { 643 if (G_UNLIKELY (!sink->window)) {
640 /* ask for window handle. Unlock render_lock while doing that because 644 /* ask for window handle. Unlock render_lock while doing that because
641 * set_window_handle & friends will lock it in this context */ 645 * set_window_handle & friends will lock it in this context */
diff --git a/ext/wayland/wldisplay-wlwindow.h b/ext/wayland/wldisplay-wlwindow.h
index 83179e3..3d8bf2c 100644
--- a/ext/wayland/wldisplay-wlwindow.h
+++ b/ext/wayland/wldisplay-wlwindow.h
@@ -28,6 +28,7 @@
28#include "scaler-client-protocol.h" 28#include "scaler-client-protocol.h"
29#include "wlbuffer.h" 29#include "wlbuffer.h"
30#include <gst/video/video.h> 30#include <gst/video/video.h>
31#include <gst/video/gstvideometa.h>
31 32
32G_BEGIN_DECLS 33G_BEGIN_DECLS
33 34
@@ -154,6 +155,8 @@ struct _GstWlDisplay
154 struct wl_list input_list; 155 struct wl_list input_list;
155 int seat_version; 156 int seat_version;
156 uint32_t serial; 157 uint32_t serial;
158
159 GstVideoCropMeta *crop;
157}; 160};
158 161
159struct _GstWlDisplayClass 162struct _GstWlDisplayClass
diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c
index 63e341c..8cb6381 100644
--- a/ext/wayland/wlwindow.c
+++ b/ext/wayland/wlwindow.c
@@ -130,6 +130,21 @@ gst_wl_window_new_internal (GstWlDisplay * display)
130 window->area_surface); 130 window->area_surface);
131 window->video_viewport = wl_scaler_get_viewport (display->scaler, 131 window->video_viewport = wl_scaler_get_viewport (display->scaler,
132 window->video_surface); 132 window->video_surface);
133 if (display->crop) {
134 GST_DEBUG ("Setting source crop : %d %d %d %d",display->crop->x, display->crop->y,
135 display->crop->width, display->crop->height);
136 wl_viewport_set_source (window->area_viewport,
137 wl_fixed_from_int(display->crop->x),
138 wl_fixed_from_int(display->crop->y),
139 wl_fixed_from_int(display->crop->width),
140 wl_fixed_from_int(display->crop->height));
141 wl_viewport_set_source (window->video_viewport,
142 wl_fixed_from_int(display->crop->x),
143 wl_fixed_from_int(display->crop->y),
144 wl_fixed_from_int(display->crop->width),
145 wl_fixed_from_int(display->crop->height));
146
147 }
133 148
134 /* draw the area_subsurface */ 149 /* draw the area_subsurface */
135 gst_video_info_set_format (&info, 150 gst_video_info_set_format (&info,