summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/hwdec_osx.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/hwdec_osx.c')
-rw-r--r--video/out/opengl/hwdec_osx.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/video/out/opengl/hwdec_osx.c b/video/out/opengl/hwdec_osx.c
index 463f9c3f14..d4594e2dcc 100644
--- a/video/out/opengl/hwdec_osx.c
+++ b/video/out/opengl/hwdec_osx.c
@@ -24,6 +24,10 @@
#include <OpenGL/OpenGL.h>
#include <OpenGL/CGLIOSurface.h>
+#include <libavutil/hwcontext.h>
+
+#include "config.h"
+
#include "video/mp_image_pool.h"
#include "video/vt.h"
#include "formats.h"
@@ -68,6 +72,12 @@ static int create(struct gl_hwdec *hw)
.download_image = mp_vt_download_image,
.ctx = &p->hwctx,
};
+
+#if HAVE_VIDEOTOOLBOX_HWACCEL_NEW
+ av_hwdevice_ctx_create(&p->hwctx.av_device_ref, AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
+ NULL, NULL, 0);
+#endif
+
hwdec_devices_add(hw->devs, &p->hwctx);
return 0;
@@ -155,6 +165,8 @@ static void destroy(struct gl_hwdec *hw)
CVPixelBufferRelease(p->pbuf);
gl->DeleteTextures(MP_MAX_PLANES, p->gl_planes);
+ av_buffer_unref(&p->hwctx.av_device_ref);
+
hwdec_devices_remove(hw->devs, &p->hwctx);
}