[prev in list] [next in list] [prev in thread] [next in thread]
List: gstreamer-cvs
Subject: gst-plugins-bad: gl/wayland: implement setting the render rectangle
From: ystreet () kemper ! freedesktop ! org (Matthew Waters)
Date: 2015-05-31 6:33:29
Message-ID: 20150531063329.CC89F76334 () kemper ! freedesktop ! org
[Download RAW message or body]
Module: gst-plugins-bad
Branch: master
Commit: e385adc241da19242574214d4129233098d277f8
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=e385adc241da19242574214d4129233098d277f8
Author: Matthew Waters <matthew@centricular.com>
Date: Fri May 29 18:06:27 2015 +1000
gl/wayland: implement setting the render rectangle
Places our subsurface at the rectangle provided position
---
gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | 77 +++++++++++++++++----
gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h | 1 +
2 files changed, 66 insertions(+), 12 deletions(-)
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c \
b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c index 519f9af..a8e3422 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
@@ -58,6 +58,8 @@ static void gst_gl_window_wayland_egl_close (GstGLWindow * window);
static gboolean gst_gl_window_wayland_egl_open (GstGLWindow * window,
GError ** error);
static guintptr gst_gl_window_wayland_egl_get_display (GstGLWindow * window);
+static gboolean gst_gl_window_wayland_egl_set_render_rectangle (GstGLWindow *
+ window, gint x, gint y, gint width, gint height);
#if 0
static void
@@ -282,12 +284,6 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
window_egl->window.queue);
}
- if (gst_gl_wl_display_roundtrip_queue (display->display,
- window_egl->window.queue) < 0) {
- GST_ERROR_OBJECT (window_egl,
- "Failed to perform a roundtrip on our wl_event_queue");
- }
-
if (window_egl->window.foreign_surface) {
/* (re)parent */
if (!display->subcompositor) {
@@ -316,8 +312,8 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
wl_shell_get_shell_surface (display->shell,
window_egl->window.surface);
if (window_egl->window.queue)
- wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.
- shell_surface, window_egl->window.queue);
+ wl_proxy_set_queue ((struct wl_proxy *) window_egl->
+ window.shell_surface, window_egl->window.queue);
wl_shell_surface_add_listener (window_egl->window.shell_surface,
&shell_surface_listener, window_egl);
@@ -371,6 +367,8 @@ gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass \
* klass) window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_open);
window_class->get_display =
GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_display);
+ window_class->set_render_rectangle =
+ GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_set_render_rectangle);
gobject_class->finalize = gst_gl_window_wayland_egl_finalize;
}
@@ -435,10 +433,6 @@ gst_gl_window_wayland_egl_open (GstGLWindow * window, GError ** \
error)
window_egl->window.queue = wl_display_create_queue (display->display);
- wl_display_roundtrip (display->display);
-
- create_surfaces (window_egl);
-
window_egl->wl_source = wayland_event_source_new (display->display,
window_egl->window.queue);
@@ -585,6 +579,9 @@ draw_cb (gpointer data)
create_surfaces (window_egl);
+ if (window_egl->window.subsurface)
+ wl_subsurface_set_desync (window_egl->window.subsurface);
+
if (window->draw)
window->draw (window->draw_data);
@@ -602,6 +599,62 @@ gst_gl_window_wayland_egl_draw (GstGLWindow * window)
gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
}
+struct SetRenderRectangle
+{
+ GstGLWindowWaylandEGL *window_egl;
+ GstVideoRectangle rect;
+};
+
+static void
+_free_set_render_rectangle (struct SetRenderRectangle *render)
+{
+ if (render) {
+ if (render->window_egl)
+ gst_object_unref (render->window_egl);
+ g_free (render);
+ }
+}
+
+static void
+_set_render_rectangle (gpointer data)
+{
+ struct SetRenderRectangle *render = data;
+
+ GST_LOG_OBJECT (render->window_egl, "setting render rectangle %i,%i+%ix%i",
+ render->rect.x, render->rect.y, render->rect.w, render->rect.h);
+
+ if (render->window_egl->window.subsurface) {
+ wl_subsurface_set_sync (render->window_egl->window.subsurface);
+ wl_subsurface_set_position (render->window_egl->window.subsurface,
+ render->rect.x, render->rect.y);
+ render->window_egl->window.window_x = render->rect.x;
+ render->window_egl->window.window_y = render->rect.y;
+ }
+
+ window_resize (render->window_egl, render->rect.w, render->rect.h);
+}
+
+static gboolean
+gst_gl_window_wayland_egl_set_render_rectangle (GstGLWindow * window,
+ gint x, gint y, gint width, gint height)
+{
+ GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
+ struct SetRenderRectangle *render;
+
+ render = g_new0 (struct SetRenderRectangle, 1);
+ render->window_egl = gst_object_ref (window_egl);
+ render->rect.x = x;
+ render->rect.y = y;
+ render->rect.w = width;
+ render->rect.h = height;
+
+ gst_gl_window_send_message_async (window,
+ (GstGLWindowCB) _set_render_rectangle, render,
+ (GDestroyNotify) _free_set_render_rectangle);
+
+ return TRUE;
+}
+
static guintptr
gst_gl_window_wayland_egl_get_display (GstGLWindow * window)
{
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h \
b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h index 3d08f6f..ee23ed8 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
@@ -72,6 +72,7 @@ struct window {
struct wl_callback *callback;
int fullscreen, configured;
int window_width, window_height;
+ int window_x, window_y;
};
struct _GstGLWindowWaylandEGL {
_______________________________________________
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