From 83a9b0bc4840c1bb203c23194c5f07f898999034 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 24 May 2017 15:07:45 +0200 Subject: videotoolbox: support new libavcodec API The new API has literally no advantages (other than that we can drop mp_vt_download_image and other things later), but it's sort-of uniform with the other hwaccels. "--videotoolbox-format=no" is not supported with the new API, because it doesn't "fit in". Probably could be added later again. The iOS code change is untested (no way to test). --- video/out/opengl/hwdec_osx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'video/out/opengl/hwdec_osx.c') 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 #include +#include + +#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); } -- cgit v1.2.3