summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/hwdec_ios.m
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/hwdec_ios.m')
-rw-r--r--video/out/opengl/hwdec_ios.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/video/out/opengl/hwdec_ios.m b/video/out/opengl/hwdec_ios.m
index 3ab532ed02..6cf1b803bd 100644
--- a/video/out/opengl/hwdec_ios.m
+++ b/video/out/opengl/hwdec_ios.m
@@ -23,6 +23,10 @@
#include <CoreVideo/CoreVideo.h>
#include <OpenGLES/EAGL.h>
+#include <libavutil/hwcontext.h>
+
+#include "config.h"
+
#include "video/mp_image_pool.h"
#include "video/vt.h"
#include "formats.h"
@@ -77,6 +81,12 @@ static int create_hwdec(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;
@@ -200,6 +210,8 @@ static void destroy(struct gl_hwdec *hw)
CFRelease(p->gl_texture_cache);
p->gl_texture_cache = NULL;
+ av_buffer_unref(&p->hwctx.av_device_ref);
+
hwdec_devices_remove(hw->devs, &p->hwctx);
}