mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 12:41:05 +00:00
gl/android: Notify the window's resize callback about surface dimension changes
https://bugzilla.gnome.org/show_bug.cgi?id=728107
This commit is contained in:
parent
9eb5001e02
commit
6fb0f1d1c7
2 changed files with 22 additions and 1 deletions
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <gst/gl/egl/gstglcontext_egl.h>
|
||||
#include "gstglwindow_android_egl.h"
|
||||
|
||||
#define GST_CAT_DEFAULT gst_gl_window_debug
|
||||
|
@ -212,8 +213,26 @@ draw_cb (gpointer data)
|
|||
GstGLWindowAndroidEGL *window_egl = draw_data->window;
|
||||
GstGLWindow *window = GST_GL_WINDOW (window_egl);
|
||||
GstGLContext *context = gst_gl_window_get_context (window);
|
||||
GstGLContextEGL *context_egl = GST_GL_CONTEXT_EGL (context);
|
||||
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
|
||||
|
||||
if (context_egl->egl_surface) {
|
||||
gint width, height;
|
||||
|
||||
if (eglQuerySurface (context_egl->egl_display,
|
||||
context_egl->egl_surface, EGL_WIDTH, &width) &&
|
||||
eglQuerySurface (context_egl->egl_display,
|
||||
context_egl->egl_surface, EGL_HEIGHT, &height)
|
||||
&& (width != window_egl->window_width
|
||||
|| height != window_egl->window_height)) {
|
||||
window_egl->window_width = width;
|
||||
window_egl->window_height = height;
|
||||
|
||||
if (window->resize)
|
||||
window->resize (window->resize_data, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
if (window->draw)
|
||||
window->draw (window->draw_data);
|
||||
|
||||
|
@ -226,8 +245,9 @@ static void
|
|||
gst_gl_window_android_egl_draw (GstGLWindow * window, guint width, guint height)
|
||||
{
|
||||
struct draw draw_data;
|
||||
GstGLWindowAndroidEGL *window_egl = GST_GL_WINDOW_ANDROID_EGL (window);
|
||||
|
||||
draw_data.window = GST_GL_WINDOW_ANDROID_EGL (window);
|
||||
draw_data.window = window_egl;
|
||||
draw_data.width = width;
|
||||
draw_data.height = height;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ struct _GstGLWindowAndroidEGL {
|
|||
|
||||
/* This is actually an ANativeWindow */
|
||||
EGLNativeWindowType native_window;
|
||||
gint window_width, window_height;
|
||||
|
||||
GMainContext *main_context;
|
||||
GMainLoop *loop;
|
||||
|
|
Loading…
Reference in a new issue