summaryrefslogtreecommitdiffstats
path: root/video/out/gl_hwdec_vda.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-03 21:02:33 +0100
committerwm4 <wm4@nowhere>2014-12-03 21:02:33 +0100
commitbfa7893fe9601f969aedd26f7cfdba92d919a8b3 (patch)
treeb4da31b5d5d2d4ecbb47aece72bd0df4de25808a /video/out/gl_hwdec_vda.c
parent82afc0f343e9b5d561051ebee51d0feffbde0377 (diff)
downloadmpv-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/out/gl_hwdec_vda.c')
-rw-r--r--video/out/gl_hwdec_vda.c13
1 files changed, 5 insertions, 8 deletions
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);