summaryrefslogtreecommitdiffstats
path: root/video/out/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl')
-rw-r--r--video/out/opengl/hwdec_cuda.c7
-rw-r--r--video/out/opengl/hwdec_dxva2egl.c6
-rw-r--r--video/out/opengl/hwdec_dxva2gldx.c6
-rw-r--r--video/out/opengl/hwdec_ios.m6
-rw-r--r--video/out/opengl/hwdec_osx.c6
5 files changed, 10 insertions, 21 deletions
diff --git a/video/out/opengl/hwdec_cuda.c b/video/out/opengl/hwdec_cuda.c
index b74f02f707..1a7df2020a 100644
--- a/video/out/opengl/hwdec_cuda.c
+++ b/video/out/opengl/hwdec_cuda.c
@@ -160,11 +160,9 @@ static int cuda_init(struct ra_hwdec *hw)
goto error;
p->hwctx = (struct mp_hwdec_ctx) {
- .type = HWDEC_CUDA,
- .ctx = p->decode_ctx,
+ .driver_name = hw->driver->name,
.av_device_ref = hw_device_ctx,
};
- p->hwctx.driver_name = hw->driver->name;
hwdec_devices_add(hw->devs, &p->hwctx);
return 0;
@@ -179,8 +177,7 @@ static void cuda_uninit(struct ra_hwdec *hw)
{
struct priv_owner *p = hw->priv;
- if (p->hwctx.ctx)
- hwdec_devices_remove(hw->devs, &p->hwctx);
+ hwdec_devices_remove(hw->devs, &p->hwctx);
av_buffer_unref(&p->hwctx.av_device_ref);
if (p->decode_ctx && p->decode_ctx != p->display_ctx)
diff --git a/video/out/opengl/hwdec_dxva2egl.c b/video/out/opengl/hwdec_dxva2egl.c
index 838cc80c8d..0f8a4adbb1 100644
--- a/video/out/opengl/hwdec_dxva2egl.c
+++ b/video/out/opengl/hwdec_dxva2egl.c
@@ -58,8 +58,8 @@ static void uninit(struct ra_hwdec *hw)
{
struct priv_owner *p = hw->priv;
- if (p->hwctx.ctx)
- hwdec_devices_remove(hw->devs, &p->hwctx);
+ hwdec_devices_remove(hw->devs, &p->hwctx);
+ av_buffer_unref(&p->hwctx.av_device_ref);
if (p->device9ex)
IDirect3DDevice9Ex_Release(p->device9ex);
@@ -180,9 +180,7 @@ static int init(struct ra_hwdec *hw)
ra_hwdec_mapper_free(&mapper);
p->hwctx = (struct mp_hwdec_ctx){
- .type = HWDEC_DXVA2,
.driver_name = hw->driver->name,
- .ctx = (IDirect3DDevice9 *)p->device9ex,
.av_device_ref = d3d9_wrap_device_ref((IDirect3DDevice9 *)p->device9ex),
};
hwdec_devices_add(hw->devs, &p->hwctx);
diff --git a/video/out/opengl/hwdec_dxva2gldx.c b/video/out/opengl/hwdec_dxva2gldx.c
index 895a7c4af1..984fd7f098 100644
--- a/video/out/opengl/hwdec_dxva2gldx.c
+++ b/video/out/opengl/hwdec_dxva2gldx.c
@@ -48,8 +48,8 @@ static void uninit(struct ra_hwdec *hw)
{
struct priv_owner *p = hw->priv;
- if (p->hwctx.ctx)
- hwdec_devices_remove(hw->devs, &p->hwctx);
+ hwdec_devices_remove(hw->devs, &p->hwctx);
+ av_buffer_unref(&p->hwctx.av_device_ref);
if (p->device)
IDirect3DDevice9Ex_Release(p->device);
@@ -78,9 +78,7 @@ static int init(struct ra_hwdec *hw)
IDirect3DDevice9Ex_AddRef(p->device);
p->hwctx = (struct mp_hwdec_ctx){
- .type = HWDEC_DXVA2,
.driver_name = hw->driver->name,
- .ctx = (IDirect3DDevice9 *)p->device,
.av_device_ref = d3d9_wrap_device_ref((IDirect3DDevice9 *)p->device),
};
hwdec_devices_add(hw->devs, &p->hwctx);
diff --git a/video/out/opengl/hwdec_ios.m b/video/out/opengl/hwdec_ios.m
index 4d41827e03..b8d4876c80 100644
--- a/video/out/opengl/hwdec_ios.m
+++ b/video/out/opengl/hwdec_ios.m
@@ -69,8 +69,7 @@ static int init(struct ra_hwdec *hw)
return -1;
p->hwctx = (struct mp_hwdec_ctx){
- .type = HWDEC_VIDEOTOOLBOX,
- .ctx = &p->hwctx,
+ .driver_name = hw->driver->name,
};
av_hwdevice_ctx_create(&p->hwctx.av_device_ref, AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
@@ -85,8 +84,7 @@ static void uninit(struct ra_hwdec *hw)
{
struct priv_owner *p = hw->priv;
- if (p->hwctx.ctx)
- hwdec_devices_remove(hw->devs, &p->hwctx);
+ hwdec_devices_remove(hw->devs, &p->hwctx);
av_buffer_unref(&p->hwctx.av_device_ref);
}
diff --git a/video/out/opengl/hwdec_osx.c b/video/out/opengl/hwdec_osx.c
index 9980e8483b..ca7a0049c2 100644
--- a/video/out/opengl/hwdec_osx.c
+++ b/video/out/opengl/hwdec_osx.c
@@ -70,8 +70,7 @@ static int init(struct ra_hwdec *hw)
return -1;
p->hwctx = (struct mp_hwdec_ctx){
- .type = HWDEC_VIDEOTOOLBOX,
- .ctx = &p->hwctx,
+ .driver_name = hw->driver->name,
};
av_hwdevice_ctx_create(&p->hwctx.av_device_ref, AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
@@ -86,8 +85,7 @@ static void uninit(struct ra_hwdec *hw)
{
struct priv_owner *p = hw->priv;
- if (p->hwctx.ctx)
- hwdec_devices_remove(hw->devs, &p->hwctx);
+ hwdec_devices_remove(hw->devs, &p->hwctx);
av_buffer_unref(&p->hwctx.av_device_ref);
}