mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
glwindow: add API to request a resize event on the next draw
- glimagesink needs to be able to resize the viewport on aspect ratio changes resulting from either caps changes or 3d output mode changes. - Performing a glViewport outside the GstGLWindow::resize callback will not have the winsys' stack of viewports required to correctly place the output frame. Provide a function to request a resize on the next draw event from the winsys. Also track size changes inside the base GstGLWindow class rather than in each subclass. https://bugzilla.gnome.org/show_bug.cgi?id=755111
This commit is contained in:
parent
817f05cd70
commit
63bbe9406a
12 changed files with 119 additions and 69 deletions
|
@ -108,18 +108,17 @@ draw_cb (gpointer data)
|
||||||
|
|
||||||
if (context_egl->egl_surface) {
|
if (context_egl->egl_surface) {
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
gint window_width, window_height;
|
||||||
|
|
||||||
if (eglQuerySurface (context_egl->egl_display,
|
gst_gl_window_get_surface_dimensions (window, &window_width,
|
||||||
context_egl->egl_surface, EGL_WIDTH, &width) &&
|
&window_height);
|
||||||
eglQuerySurface (context_egl->egl_display,
|
if (eglQuerySurface (context_egl->egl_display, context_egl->egl_surface,
|
||||||
context_egl->egl_surface, EGL_HEIGHT, &height)
|
EGL_WIDTH, &width)
|
||||||
&& (width != window_egl->window_width
|
&& eglQuerySurface (context_egl->egl_display, context_egl->egl_surface,
|
||||||
|
EGL_HEIGHT, &height)
|
||||||
|
&& (window->queue_resize || width != window_egl->window_width
|
||||||
|| height != window_egl->window_height)) {
|
|| height != window_egl->window_height)) {
|
||||||
window_egl->window_width = width;
|
gst_gl_window_resize (window, width, height);
|
||||||
window_egl->window_height = height;
|
|
||||||
|
|
||||||
if (window->resize)
|
|
||||||
window->resize (window->resize_data, width, height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,11 @@ G_BEGIN_DECLS
|
||||||
GDestroyNotify resize_notify;
|
GDestroyNotify resize_notify;
|
||||||
|
|
||||||
gint can_draw;
|
gint can_draw;
|
||||||
|
gboolean queue_resize;
|
||||||
}
|
}
|
||||||
- (void) setDrawCallback:(GstGLWindowCB)cb data:(gpointer)a notify:(GDestroyNotify)notify;
|
- (void) setDrawCallback:(GstGLWindowCB)cb data:(gpointer)a notify:(GDestroyNotify)notify;
|
||||||
- (void) setResizeCallback:(GstGLWindowResizeCB)cb data:(gpointer)a notify:(GDestroyNotify)notify;
|
- (void) setResizeCallback:(GstGLWindowResizeCB)cb data:(gpointer)a notify:(GDestroyNotify)notify;
|
||||||
|
- (void) queueResize;
|
||||||
- (id) initWithGstGLContext: (GstGLContextCocoa *)context;
|
- (id) initWithGstGLContext: (GstGLContextCocoa *)context;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ _context_ready (gpointer data)
|
||||||
gl->GetIntegerv (GL_VIEWPORT, ca_viewport);
|
gl->GetIntegerv (GL_VIEWPORT, ca_viewport);
|
||||||
|
|
||||||
gst_gl_context_activate (self->draw_context, TRUE);
|
gst_gl_context_activate (self->draw_context, TRUE);
|
||||||
if (self->last_bounds.size.width != self.bounds.size.width
|
if (self->queue_resize || self->last_bounds.size.width != self.bounds.size.width
|
||||||
|| self->last_bounds.size.height != self.bounds.size.height) {
|
|| self->last_bounds.size.height != self.bounds.size.height) {
|
||||||
if (self->resize_cb) {
|
if (self->resize_cb) {
|
||||||
self->resize_cb (self->resize_data, self.bounds.size.width,
|
self->resize_cb (self->resize_data, self.bounds.size.width,
|
||||||
|
@ -200,6 +200,7 @@ _context_ready (gpointer data)
|
||||||
}
|
}
|
||||||
|
|
||||||
self->last_bounds = self.bounds;
|
self->last_bounds = self.bounds;
|
||||||
|
self->queue_resize = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
src.x = self->expected_dims[0];
|
src.x = self->expected_dims[0];
|
||||||
|
|
|
@ -76,6 +76,7 @@ static void gst_gl_window_cocoa_draw (GstGLWindow * window);
|
||||||
static void gst_gl_window_cocoa_set_preferred_size (GstGLWindow * window,
|
static void gst_gl_window_cocoa_set_preferred_size (GstGLWindow * window,
|
||||||
gint width, gint height);
|
gint width, gint height);
|
||||||
static void gst_gl_window_cocoa_show (GstGLWindow * window);
|
static void gst_gl_window_cocoa_show (GstGLWindow * window);
|
||||||
|
static void gst_gl_window_cocoa_queue_resize (GstGLWindow * window);
|
||||||
|
|
||||||
struct _GstGLWindowCocoaPrivate
|
struct _GstGLWindowCocoaPrivate
|
||||||
{
|
{
|
||||||
|
@ -110,6 +111,7 @@ gst_gl_window_cocoa_class_init (GstGLWindowCocoaClass * klass)
|
||||||
window_class->set_preferred_size =
|
window_class->set_preferred_size =
|
||||||
GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_set_preferred_size);
|
GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_set_preferred_size);
|
||||||
window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_show);
|
window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_show);
|
||||||
|
window_class->queue_resize = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_queue_resize);
|
||||||
|
|
||||||
gobject_class->finalize = gst_gl_window_cocoa_finalize;
|
gobject_class->finalize = gst_gl_window_cocoa_finalize;
|
||||||
}
|
}
|
||||||
|
@ -266,6 +268,20 @@ gst_gl_window_cocoa_show (GstGLWindow * window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_gl_window_cocoa_queue_resize (GstGLWindow * window)
|
||||||
|
{
|
||||||
|
GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
|
||||||
|
GstGLNSView *view;
|
||||||
|
|
||||||
|
if (!g_atomic_int_get (&window_cocoa->priv->view_ready))
|
||||||
|
return;
|
||||||
|
|
||||||
|
view = (GstGLNSView *)[window_cocoa->priv->internal_win_id contentView];
|
||||||
|
|
||||||
|
[view->layer queueResize];
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_window_cocoa_draw (GstGLWindow * window)
|
gst_gl_window_cocoa_draw (GstGLWindow * window)
|
||||||
{
|
{
|
||||||
|
@ -343,10 +359,8 @@ gst_gl_cocoa_resize_cb (GstGLNSView * view, guint width, guint height)
|
||||||
visibleRect.origin.x, visibleRect.origin.y,
|
visibleRect.origin.x, visibleRect.origin.y,
|
||||||
visibleRect.size.width, visibleRect.size.height);
|
visibleRect.size.width, visibleRect.size.height);
|
||||||
|
|
||||||
if (window->resize) {
|
gst_gl_window_resize (window, width, height);
|
||||||
window->resize (window->resize_data, width, height);
|
gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
|
||||||
gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl->Viewport (viewport_dim[0] - visibleRect.origin.x,
|
gl->Viewport (viewport_dim[0] - visibleRect.origin.x,
|
||||||
viewport_dim[1] - visibleRect.origin.y,
|
viewport_dim[1] - visibleRect.origin.y,
|
||||||
|
|
|
@ -185,6 +185,8 @@ static void
|
||||||
window_resize (GstGLWindowDispmanxEGL * window_egl, guint width, guint height,
|
window_resize (GstGLWindowDispmanxEGL * window_egl, guint width, guint height,
|
||||||
gboolean visible)
|
gboolean visible)
|
||||||
{
|
{
|
||||||
|
GstGLWindow *window = GST_GL_WINDOW (window_egl);
|
||||||
|
|
||||||
GST_DEBUG ("resizing %s window from %ux%u to %ux%u",
|
GST_DEBUG ("resizing %s window from %ux%u to %ux%u",
|
||||||
visible ? "visible" : "invisible", window_egl->native.width,
|
visible ? "visible" : "invisible", window_egl->native.width,
|
||||||
window_egl->native.height, width, height);
|
window_egl->native.height, width, height);
|
||||||
|
@ -234,9 +236,8 @@ window_resize (GstGLWindowDispmanxEGL * window_egl, guint width, guint height,
|
||||||
|
|
||||||
vc_dispmanx_update_submit_sync (dispman_update);
|
vc_dispmanx_update_submit_sync (dispman_update);
|
||||||
|
|
||||||
if (GST_GL_WINDOW (window_egl)->resize)
|
if (window->resize)
|
||||||
GST_GL_WINDOW (window_egl)->
|
window->resize (window->resize_data, width, height);
|
||||||
resize (GST_GL_WINDOW (window_egl)->resize_data, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window_egl->native.width = width;
|
window_egl->native.width = width;
|
||||||
|
|
|
@ -143,7 +143,7 @@ draw_cb (gpointer data)
|
||||||
eagl_layer = (CAEAGLLayer *)[window_eagl->priv->view layer];
|
eagl_layer = (CAEAGLLayer *)[window_eagl->priv->view layer];
|
||||||
size = eagl_layer.frame.size;
|
size = eagl_layer.frame.size;
|
||||||
|
|
||||||
if (window_eagl->priv->window_width != size.width ||
|
if (window->queue_resize || window_eagl->priv->window_width != size.width ||
|
||||||
window_eagl->priv->window_height != size.height) {
|
window_eagl->priv->window_height != size.height) {
|
||||||
|
|
||||||
window_eagl->priv->window_width = size.width;
|
window_eagl->priv->window_width = size.width;
|
||||||
|
@ -151,8 +151,7 @@ draw_cb (gpointer data)
|
||||||
|
|
||||||
gst_gl_context_eagl_resize (eagl_context);
|
gst_gl_context_eagl_resize (eagl_context);
|
||||||
|
|
||||||
if (window->resize)
|
gst_gl_window_resize (window, window_eagl->priv->window_width,
|
||||||
window->resize (window->resize_data, window_eagl->priv->window_width,
|
|
||||||
window_eagl->priv->window_height);
|
window_eagl->priv->window_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,9 @@ struct _GstGLWindowPrivate
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GThread *navigation_thread;
|
GThread *navigation_thread;
|
||||||
|
|
||||||
|
guint surface_width;
|
||||||
|
guint surface_height;
|
||||||
|
|
||||||
gboolean alive;
|
gboolean alive;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -437,6 +440,13 @@ draw_cb (gpointer data)
|
||||||
GstGLContext *context = gst_gl_window_get_context (window);
|
GstGLContext *context = gst_gl_window_get_context (window);
|
||||||
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
|
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
|
||||||
|
|
||||||
|
if (window->queue_resize) {
|
||||||
|
guint width, height;
|
||||||
|
|
||||||
|
gst_gl_window_get_surface_dimensions (window, &width, &height);
|
||||||
|
gst_gl_window_resize (window, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
if (window->draw)
|
if (window->draw)
|
||||||
window->draw (window->draw_data);
|
window->draw (window->draw_data);
|
||||||
|
|
||||||
|
@ -471,6 +481,8 @@ gst_gl_window_draw_unlocked (GstGLWindow * window)
|
||||||
g_return_if_fail (window_class->draw_unlocked != NULL);
|
g_return_if_fail (window_class->draw_unlocked != NULL);
|
||||||
|
|
||||||
window_class->draw_unlocked (window);
|
window_class->draw_unlocked (window);
|
||||||
|
|
||||||
|
window->queue_resize = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -496,6 +508,8 @@ gst_gl_window_draw (GstGLWindow * window)
|
||||||
}
|
}
|
||||||
|
|
||||||
window_class->draw (window);
|
window_class->draw (window);
|
||||||
|
|
||||||
|
window->queue_resize = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -926,11 +940,10 @@ void
|
||||||
gst_gl_window_get_surface_dimensions (GstGLWindow * window, guint * width,
|
gst_gl_window_get_surface_dimensions (GstGLWindow * window, guint * width,
|
||||||
guint * height)
|
guint * height)
|
||||||
{
|
{
|
||||||
GstGLWindowClass *window_class;
|
if (width)
|
||||||
g_return_if_fail (GST_GL_IS_WINDOW (window));
|
*width = window->priv->surface_width;
|
||||||
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
if (height)
|
||||||
g_return_if_fail (window_class->get_surface_dimensions != NULL);
|
*height = window->priv->surface_height;
|
||||||
window_class->get_surface_dimensions (window, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GType gst_gl_dummy_window_get_type (void);
|
GType gst_gl_dummy_window_get_type (void);
|
||||||
|
@ -1007,12 +1020,6 @@ gst_gl_dummy_window_get_display (GstGLWindow * window)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_gl_dummy_window_get_surface_dimensions (GstGLWindow * window, guint * width,
|
|
||||||
guint * height)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_dummy_window_class_init (GstGLDummyWindowClass * klass)
|
gst_gl_dummy_window_class_init (GstGLDummyWindowClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -1024,8 +1031,6 @@ gst_gl_dummy_window_class_init (GstGLDummyWindowClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_get_window_handle);
|
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_get_window_handle);
|
||||||
window_class->set_window_handle =
|
window_class->set_window_handle =
|
||||||
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_set_window_handle);
|
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_set_window_handle);
|
||||||
window_class->get_surface_dimensions =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_gl_dummy_window_get_surface_dimensions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1138,3 +1143,28 @@ gst_gl_window_set_render_rectangle (GstGLWindow * window, gint x, gint y,
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_gl_window_queue_resize (GstGLWindow * window)
|
||||||
|
{
|
||||||
|
GstGLWindowClass *window_class;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_GL_IS_WINDOW (window), FALSE);
|
||||||
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
||||||
|
|
||||||
|
window->queue_resize = TRUE;
|
||||||
|
if (window_class->queue_resize)
|
||||||
|
window_class->queue_resize (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_gl_window_resize (GstGLWindow * window, guint width, guint height)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GST_GL_IS_WINDOW (window));
|
||||||
|
|
||||||
|
if (window->resize)
|
||||||
|
window->resize (window->resize_data, width, height);
|
||||||
|
|
||||||
|
window->priv->surface_width = width;
|
||||||
|
window->priv->surface_height = height;
|
||||||
|
}
|
||||||
|
|
|
@ -90,6 +90,8 @@ struct _GstGLWindow {
|
||||||
gpointer resize_data;
|
gpointer resize_data;
|
||||||
GDestroyNotify resize_notify;
|
GDestroyNotify resize_notify;
|
||||||
|
|
||||||
|
gboolean queue_resize;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GMainContext *navigation_context;
|
GMainContext *navigation_context;
|
||||||
GMainLoop *navigation_loop;
|
GMainLoop *navigation_loop;
|
||||||
|
@ -138,11 +140,11 @@ struct _GstGLWindowClass {
|
||||||
|
|
||||||
gboolean (*open) (GstGLWindow *window, GError **error);
|
gboolean (*open) (GstGLWindow *window, GError **error);
|
||||||
void (*close) (GstGLWindow *window);
|
void (*close) (GstGLWindow *window);
|
||||||
void (*get_surface_dimensions) (GstGLWindow *window, guint *width, guint *height);
|
|
||||||
void (*handle_events) (GstGLWindow *window, gboolean handle_events);
|
void (*handle_events) (GstGLWindow *window, gboolean handle_events);
|
||||||
void (*set_preferred_size) (GstGLWindow *window, gint width, gint height);
|
void (*set_preferred_size) (GstGLWindow *window, gint width, gint height);
|
||||||
void (*show) (GstGLWindow *window);
|
void (*show) (GstGLWindow *window);
|
||||||
gboolean (*set_render_rectangle)(GstGLWindow *window, gint x, gint y, gint width, gint height);
|
gboolean (*set_render_rectangle)(GstGLWindow *window, gint x, gint y, gint width, gint height);
|
||||||
|
void (*queue_resize) (GstGLWindow *window);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gpointer _reserved[GST_PADDING];
|
gpointer _reserved[GST_PADDING];
|
||||||
|
@ -213,6 +215,7 @@ void gst_gl_window_send_mouse_event (GstGLWindow * window,
|
||||||
double posy);
|
double posy);
|
||||||
|
|
||||||
/* surfaces/rendering */
|
/* surfaces/rendering */
|
||||||
|
void gst_gl_window_queue_resize (GstGLWindow *window);
|
||||||
void gst_gl_window_draw_unlocked (GstGLWindow *window);
|
void gst_gl_window_draw_unlocked (GstGLWindow *window);
|
||||||
void gst_gl_window_draw (GstGLWindow *window);
|
void gst_gl_window_draw (GstGLWindow *window);
|
||||||
void gst_gl_window_show (GstGLWindow *window);
|
void gst_gl_window_show (GstGLWindow *window);
|
||||||
|
@ -228,6 +231,9 @@ gboolean gst_gl_window_set_render_rectangle (GstGLWindow * window,
|
||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
|
||||||
|
/* subclass usage only */
|
||||||
|
void gst_gl_window_resize (GstGLWindow *window, guint width, guint height);
|
||||||
|
|
||||||
GstGLContext * gst_gl_window_get_context (GstGLWindow *window);
|
GstGLContext * gst_gl_window_get_context (GstGLWindow *window);
|
||||||
guintptr gst_gl_window_get_display (GstGLWindow *window);
|
guintptr gst_gl_window_get_display (GstGLWindow *window);
|
||||||
|
|
||||||
|
|
|
@ -315,6 +315,8 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
|
||||||
window_egl->window.window_height = height;
|
window_egl->window.window_height = height;
|
||||||
|
|
||||||
if (!window_egl->window.native) {
|
if (!window_egl->window.native) {
|
||||||
|
gst_gl_window_resize (GST_GL_WINDOW (window_egl), width, height);
|
||||||
|
|
||||||
window_egl->window.native =
|
window_egl->window.native =
|
||||||
wl_egl_window_create (window_egl->window.surface, width, height);
|
wl_egl_window_create (window_egl->window.surface, width, height);
|
||||||
if (window_egl->window.queue)
|
if (window_egl->window.queue)
|
||||||
|
@ -469,8 +471,7 @@ window_resize (GstGLWindowWaylandEGL * window_egl, guint width, guint height)
|
||||||
wl_egl_window_resize (window_egl->window.native, width, height, 0, 0);
|
wl_egl_window_resize (window_egl->window.native, width, height, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->resize)
|
gst_gl_window_resize (window, width, height);
|
||||||
window->resize (window->resize_data, width, height);
|
|
||||||
|
|
||||||
window_egl->window.window_width = width;
|
window_egl->window.window_width = width;
|
||||||
window_egl->window.window_height = height;
|
window_egl->window.window_height = height;
|
||||||
|
@ -489,6 +490,13 @@ draw_cb (gpointer data)
|
||||||
if (window_egl->window.subsurface)
|
if (window_egl->window.subsurface)
|
||||||
wl_subsurface_set_desync (window_egl->window.subsurface);
|
wl_subsurface_set_desync (window_egl->window.subsurface);
|
||||||
|
|
||||||
|
if (window->queue_resize) {
|
||||||
|
guint width, height;
|
||||||
|
|
||||||
|
gst_gl_window_get_surface_dimensions (window, &width, &height);
|
||||||
|
gst_gl_window_resize (window, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
if (window->draw)
|
if (window->draw)
|
||||||
window->draw (window->draw_data);
|
window->draw (window->draw_data);
|
||||||
|
|
||||||
|
|
|
@ -409,15 +409,16 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
gst_gl_window_resize (window, LOWORD (lParam), HIWORD (lParam));
|
||||||
if (window->resize) {
|
|
||||||
window->resize (window->resize_data, LOWORD (lParam),
|
|
||||||
HIWORD (lParam));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
{
|
{
|
||||||
|
if (window->queue_resize) {
|
||||||
|
guint width, height;
|
||||||
|
|
||||||
|
gst_gl_window_get_surface_dimensions (window, &width, &height);
|
||||||
|
gst_gl_window_resize (window, width, height);
|
||||||
|
}
|
||||||
if (window->draw) {
|
if (window->draw) {
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
BeginPaint (hWnd, &ps);
|
BeginPaint (hWnd, &ps);
|
||||||
|
@ -440,6 +441,12 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_CAPTURECHANGED:
|
case WM_CAPTURECHANGED:
|
||||||
{
|
{
|
||||||
GST_DEBUG ("WM_CAPTURECHANGED");
|
GST_DEBUG ("WM_CAPTURECHANGED");
|
||||||
|
if (window->queue_resize) {
|
||||||
|
guint width, height;
|
||||||
|
|
||||||
|
gst_gl_window_get_surface_dimensions (window, &width, &height);
|
||||||
|
gst_gl_window_resize (window, width, height);
|
||||||
|
}
|
||||||
if (window->draw)
|
if (window->draw)
|
||||||
window->draw (window->draw_data);
|
window->draw (window->draw_data);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -80,8 +80,6 @@ gboolean gst_gl_window_x11_create_context (GstGLWindow * window,
|
||||||
GstGLAPI gl_api, guintptr external_gl_context, GError ** error);
|
GstGLAPI gl_api, guintptr external_gl_context, GError ** error);
|
||||||
gboolean gst_gl_window_x11_open (GstGLWindow * window, GError ** error);
|
gboolean gst_gl_window_x11_open (GstGLWindow * window, GError ** error);
|
||||||
void gst_gl_window_x11_close (GstGLWindow * window);
|
void gst_gl_window_x11_close (GstGLWindow * window);
|
||||||
static void gst_gl_window_x11_get_surface_dimensions (GstGLWindow * window,
|
|
||||||
guint * width, guint * height);
|
|
||||||
void gst_gl_window_x11_handle_events (GstGLWindow * window,
|
void gst_gl_window_x11_handle_events (GstGLWindow * window,
|
||||||
gboolean handle_events);
|
gboolean handle_events);
|
||||||
|
|
||||||
|
@ -111,8 +109,6 @@ gst_gl_window_x11_class_init (GstGLWindowX11Class * klass)
|
||||||
window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_x11_draw);
|
window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_x11_draw);
|
||||||
window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_x11_open);
|
window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_x11_open);
|
||||||
window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_x11_close);
|
window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_x11_close);
|
||||||
window_class->get_surface_dimensions =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_gl_window_x11_get_surface_dimensions);
|
|
||||||
window_class->handle_events =
|
window_class->handle_events =
|
||||||
GST_DEBUG_FUNCPTR (gst_gl_window_x11_handle_events);
|
GST_DEBUG_FUNCPTR (gst_gl_window_x11_handle_events);
|
||||||
window_class->set_preferred_size =
|
window_class->set_preferred_size =
|
||||||
|
@ -399,6 +395,13 @@ gst_gl_window_x11_draw_unlocked (GstGLWindow * window)
|
||||||
|
|
||||||
if (gst_gl_window_is_running (GST_GL_WINDOW (window_x11))
|
if (gst_gl_window_is_running (GST_GL_WINDOW (window_x11))
|
||||||
&& window_x11->allow_extra_expose_events) {
|
&& window_x11->allow_extra_expose_events) {
|
||||||
|
if (window->queue_resize) {
|
||||||
|
guint width, height;
|
||||||
|
|
||||||
|
gst_gl_window_get_surface_dimensions (window, &width, &height);
|
||||||
|
gst_gl_window_resize (window, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
if (window->draw) {
|
if (window->draw) {
|
||||||
GstGLContext *context = gst_gl_window_get_context (window);
|
GstGLContext *context = gst_gl_window_get_context (window);
|
||||||
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
|
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
|
||||||
|
@ -566,12 +569,8 @@ gst_gl_window_x11_handle_event (GstGLWindowX11 * window_x11)
|
||||||
case CreateNotify:
|
case CreateNotify:
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
{
|
{
|
||||||
if (window->resize)
|
gst_gl_window_resize (window, event.xconfigure.width,
|
||||||
window->resize (window->resize_data, event.xconfigure.width,
|
event.xconfigure.height);
|
||||||
event.xconfigure.height);
|
|
||||||
|
|
||||||
window_x11->current_width = event.xconfigure.width;
|
|
||||||
window_x11->current_height = event.xconfigure.height;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,9 +596,6 @@ gst_gl_window_x11_handle_event (GstGLWindowX11 * window_x11)
|
||||||
|
|
||||||
gst_object_unref (context);
|
gst_object_unref (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
window_x11->current_width = event.xexpose.width;
|
|
||||||
window_x11->current_height = event.xexpose.height;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VisibilityNotify:
|
case VisibilityNotify:
|
||||||
|
@ -699,14 +695,3 @@ gst_gl_window_x11_get_display (GstGLWindow * window)
|
||||||
|
|
||||||
return (guintptr) window_x11->device;
|
return (guintptr) window_x11->device;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_gl_window_x11_get_surface_dimensions (GstGLWindow * window, guint * width,
|
|
||||||
guint * height)
|
|
||||||
{
|
|
||||||
GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
|
|
||||||
if (width != NULL)
|
|
||||||
*width = window_x11->current_width;
|
|
||||||
if (height != NULL)
|
|
||||||
*height = window_x11->current_height;
|
|
||||||
}
|
|
||||||
|
|
|
@ -64,8 +64,6 @@ struct _GstGLWindowX11
|
||||||
gint depth;
|
gint depth;
|
||||||
gint device_width;
|
gint device_width;
|
||||||
gint device_height;
|
gint device_height;
|
||||||
gint current_width;
|
|
||||||
gint current_height;
|
|
||||||
gint connection;
|
gint connection;
|
||||||
XVisualInfo *visual_info;
|
XVisualInfo *visual_info;
|
||||||
Window parent_win;
|
Window parent_win;
|
||||||
|
|
Loading…
Reference in a new issue