diff options
author | wm4 <wm4@nowhere> | 2014-12-03 21:02:33 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-12-03 21:02:33 +0100 |
commit | bfa7893fe9601f969aedd26f7cfdba92d919a8b3 (patch) | |
tree | b4da31b5d5d2d4ecbb47aece72bd0df4de25808a /video | |
parent | 82afc0f343e9b5d561051ebee51d0feffbde0377 (diff) | |
download | mpv-bfa7893fe9601f969aedd26f7cfdba92d919a8b3.tar.bz2 mpv-bfa7893fe9601f969aedd26f7cfdba92d919a8b3.tar.xz |
vda: make independent from cocoa backend
Basically, don't access the vo field.
There's also no reason anymore to access MPGLContext. We still need to
access loaded GL functions though, so add a field for that to gl_hwdec.
Untested.
Diffstat (limited to 'video')
-rw-r--r-- | video/out/gl_common.h | 1 | ||||
-rw-r--r-- | video/out/gl_hwdec_vda.c | 13 | ||||
-rw-r--r-- | video/out/vo_opengl.c | 1 |
3 files changed, 7 insertions, 8 deletions
diff --git a/video/out/gl_common.h b/video/out/gl_common.h index eb54ca41d2..d7ba888a93 100644 --- a/video/out/gl_common.h +++ b/video/out/gl_common.h @@ -171,6 +171,7 @@ struct mp_hwdec_info; struct gl_hwdec { const struct gl_hwdec_driver *driver; struct mp_log *log; + GL *gl; struct MPGLContext *mpgl; struct mp_hwdec_info *info; // For free use by hwdec driver diff --git a/video/out/gl_hwdec_vda.c b/video/out/gl_hwdec_vda.c index b85b4665e8..193204d6de 100644 --- a/video/out/gl_hwdec_vda.c +++ b/video/out/gl_hwdec_vda.c @@ -32,14 +32,12 @@ struct priv { static bool check_hwdec(struct gl_hwdec *hw) { - struct vo *vo = hw->mpgl->vo; - if (hw->gl_texture_target != GL_TEXTURE_RECTANGLE) { MP_ERR(hw, "must use rectangle video textures with VDA\n"); return false; } - if (!vo->cocoa) { + if (!CGLGetCurrentContext()) { MP_ERR(hw, "need cocoa opengl backend to be active"); return false; } @@ -57,7 +55,7 @@ static int create(struct gl_hwdec *hw) if (!check_hwdec(hw)) return -1; - GL *gl = hw->mpgl->gl; + GL *gl = hw->gl; gl->GenTextures(1, &p->gl_texture); return 0; @@ -75,8 +73,7 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image, return -1; struct priv *p = hw->priv; - struct vo *vo = hw->mpgl->vo; - GL *gl = hw->mpgl->gl; + GL *gl = hw->gl; CVPixelBufferRelease(p->pbuf); p->pbuf = (CVPixelBufferRef)hw_image->planes[3]; @@ -91,7 +88,7 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image, GL_RGB_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, surface, 0); if (err != kCGLNoError) - MP_ERR(vo, "error creating IOSurface texture: %s (%x)\n", + MP_ERR(hw, "error creating IOSurface texture: %s (%x)\n", CGLErrorString(err), gl->GetError()); gl->BindTexture(hw->gl_texture_target, 0); @@ -127,7 +124,7 @@ static struct mp_image *download_image(struct gl_hwdec *hw, static void destroy(struct gl_hwdec *hw) { struct priv *p = hw->priv; - GL *gl = hw->mpgl->gl; + GL *gl = hw->gl; CVPixelBufferRelease(p->pbuf); gl->DeleteTextures(1, &p->gl_texture); diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index d3fdf88372..482eed1b79 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -228,6 +228,7 @@ static void load_hwdec_driver(struct gl_priv *p, .driver = drv, .log = mp_log_new(hwdec, p->vo->log, drv->api_name), .mpgl = p->glctx, + .gl = p->glctx->gl, .info = &p->hwdec_info, .gl_texture_target = GL_TEXTURE_2D, }; |