summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2017-12-25 16:04:09 +0100
committerKevin Mitchell <kevmitch@gmail.com>2017-12-27 14:29:15 -0700
commit451fc931b0f4924801b9a27d25a5c0339b2fcace (patch)
treec96683a962052059e1ab9c02c6ee1c8476c929c0 /video
parent8a2db0c4b1a4e11b37541ac1eff90d4085fcb608 (diff)
downloadmpv-451fc931b0f4924801b9a27d25a5c0339b2fcace.tar.bz2
mpv-451fc931b0f4924801b9a27d25a5c0339b2fcace.tar.xz
vo_gpu/context: Let embedding application handle surface resizes
The callbacks for this are Java-only and EGL does not reliably return the correct values.
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/context_android.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/video/out/opengl/context_android.c b/video/out/opengl/context_android.c
index a2acce2223..dec420a120 100644
--- a/video/out/opengl/context_android.c
+++ b/video/out/opengl/context_android.c
@@ -26,6 +26,20 @@
#include "options/m_config.h"
#include "context.h"
+struct android_opts {
+ int w, h;
+};
+
+#define OPT_BASE_STRUCT struct android_opts
+const struct m_sub_options android_conf = {
+ .opts = (const struct m_option[]) {
+ OPT_INT("android-surface-width", w, 0),
+ OPT_INT("android-surface-height", h, 0),
+ {0}
+ },
+ .size = sizeof(struct android_opts),
+};
+
struct priv {
struct GL gl;
EGLDisplay egl_display;
@@ -122,18 +136,14 @@ fail:
static bool android_reconfig(struct ra_ctx *ctx)
{
- struct priv *p = ctx->priv;
- int w, h;
+ void *tmp = talloc_new(NULL);
+ struct android_opts *opts = mp_get_config_group(tmp, ctx->global, &android_conf);
- if (!eglQuerySurface(p->egl_display, p->egl_surface, EGL_WIDTH, &w) ||
- !eglQuerySurface(p->egl_display, p->egl_surface, EGL_HEIGHT, &h)) {
- MP_FATAL(ctx, "Failed to get height and width!\n");
- return false;
- }
+ ctx->vo->dwidth = opts->w;
+ ctx->vo->dheight = opts->h;
+ ra_gl_ctx_resize(ctx->swapchain, opts->w, opts->h, 0);
- ctx->vo->dwidth = w;
- ctx->vo->dheight = h;
- ra_gl_ctx_resize(ctx->swapchain, w, h, 0);
+ talloc_free(tmp);
return true;
}