summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl.c
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-03-04 14:23:06 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-12 15:27:54 +0200
commit134f3e97bf482b75c0eccbe5ac943a2a1d5a4ad6 (patch)
tree98bac431df2697072238864e48a0380d3b1745ff /video/out/vo_opengl.c
parentafdc9c4ae2e69a9ced6c3c6580df19edfedea36a (diff)
downloadmpv-134f3e97bf482b75c0eccbe5ac943a2a1d5a4ad6.tar.bz2
mpv-134f3e97bf482b75c0eccbe5ac943a2a1d5a4ad6.tar.xz
OSX: run native event loop in a separate thread
This commit is a followup on the previous one and uses a solution I like more since it totally decouples the Cocoa code from mpv's core and tries to emulate a generic Cocoa application's lifecycle as much as possible without fighting the framework. mpv's main is executed in a pthread while the main thread runs the native cocoa event loop. All of the thread safety is mainly accomplished with additional logic in cocoa_common as to not increase complexity on the crossplatform parts of the code.
Diffstat (limited to 'video/out/vo_opengl.c')
-rw-r--r--video/out/vo_opengl.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 5d59912856..b5cdca7a82 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -156,6 +156,13 @@ static bool config_window(struct gl_priv *p, uint32_t d_width,
return mpgl_config_window(p->glctx, mpgl_caps, d_width, d_height, flags);
}
+static void video_resize_redraw_callback(struct vo *vo, int w, int h)
+{
+ struct gl_priv *p = vo->priv;
+ gl_video_resize_redraw(p->renderer, w, h);
+
+}
+
static int config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
uint32_t format)
@@ -169,6 +176,10 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
return -1;
}
+ if (p->glctx->register_resize_callback) {
+ p->glctx->register_resize_callback(vo, video_resize_redraw_callback);
+ }
+
gl_video_config(p->renderer, format, width, height,
p->vo->aspdat.prew, p->vo->aspdat.preh);
@@ -353,6 +364,8 @@ static int preinit(struct vo *vo, const char *arg)
if (!config_window(p, 320, 200, VOFLAG_HIDDEN))
goto err_out;
+ mpgl_set_context(p->glctx);
+
if (p->gl->SwapInterval)
p->gl->SwapInterval(p->swap_interval);