summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-06-19 20:32:44 +0200
committersfan5 <sfan5@live.de>2023-06-26 19:07:29 +0200
commit4dfc2c50c18de74e73e3283773c1792b8a4b5a77 (patch)
tree3a08dc939ca03575b09fecbcd20ed8f7541a4ab0 /video/out
parenta5b929026100b7508d8fee6dbbea42f3a5db05fc (diff)
downloadmpv-4dfc2c50c18de74e73e3283773c1792b8a4b5a77.tar.bz2
mpv-4dfc2c50c18de74e73e3283773c1792b8a4b5a77.tar.xz
hwdec: do not add hwdec device if it failed to create
Diffstat (limited to 'video/out')
-rw-r--r--video/out/d3d11/hwdec_d3d11va.c6
-rw-r--r--video/out/d3d11/hwdec_dxva2dxgi.c6
-rw-r--r--video/out/hwdec/hwdec_aimagereader.c6
-rw-r--r--video/out/hwdec/hwdec_drmprime_overlay.c14
-rw-r--r--video/out/opengl/hwdec_d3d11egl.c6
-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.m8
-rw-r--r--video/out/opengl/hwdec_osx.c8
-rw-r--r--video/out/vo_mediacodec_embed.c6
10 files changed, 64 insertions, 8 deletions
diff --git a/video/out/d3d11/hwdec_d3d11va.c b/video/out/d3d11/hwdec_d3d11va.c
index 0242c8fedf..6aaa12bc66 100644
--- a/video/out/d3d11/hwdec_d3d11va.c
+++ b/video/out/d3d11/hwdec_d3d11va.c
@@ -108,6 +108,12 @@ static int init(struct ra_hwdec *hw)
.supported_formats = subfmts,
.hw_imgfmt = IMGFMT_D3D11,
};
+
+ if (!p->hwctx.av_device_ref) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx\n");
+ return -1;
+ }
+
hwdec_devices_add(hw->devs, &p->hwctx);
return 0;
}
diff --git a/video/out/d3d11/hwdec_dxva2dxgi.c b/video/out/d3d11/hwdec_dxva2dxgi.c
index f68e0e3065..62158d467b 100644
--- a/video/out/d3d11/hwdec_dxva2dxgi.c
+++ b/video/out/d3d11/hwdec_dxva2dxgi.c
@@ -136,6 +136,12 @@ static int init(struct ra_hwdec *hw)
.av_device_ref = d3d9_wrap_device_ref((IDirect3DDevice9 *)p->dev9),
.hw_imgfmt = IMGFMT_DXVA2,
};
+
+ if (!p->hwctx.av_device_ref) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx\n");
+ goto done;
+ }
+
hwdec_devices_add(hw->devs, &p->hwctx);
ret = 0;
diff --git a/video/out/hwdec/hwdec_aimagereader.c b/video/out/hwdec/hwdec_aimagereader.c
index 173fe0a2b3..93ced50548 100644
--- a/video/out/hwdec/hwdec_aimagereader.c
+++ b/video/out/hwdec/hwdec_aimagereader.c
@@ -178,6 +178,12 @@ static int init(struct ra_hwdec *hw)
.av_device_ref = create_mediacodec_device_ref(p->surface),
.hw_imgfmt = IMGFMT_MEDIACODEC,
};
+
+ if (!p->hwctx.av_device_ref) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx\n");
+ return -1;
+ }
+
hwdec_devices_add(hw->devs, &p->hwctx);
return 0;
diff --git a/video/out/hwdec/hwdec_drmprime_overlay.c b/video/out/hwdec/hwdec_drmprime_overlay.c
index 75d2a0740c..6b6aae60f0 100644
--- a/video/out/hwdec/hwdec_drmprime_overlay.c
+++ b/video/out/hwdec/hwdec_drmprime_overlay.c
@@ -304,13 +304,19 @@ static int init(struct ra_hwdec *hw)
};
char *device = drmGetDeviceNameFromFd2(p->ctx->fd);
- if (!av_hwdevice_ctx_create(&p->hwctx.av_device_ref, AV_HWDEVICE_TYPE_DRM,
- device, NULL, 0)) {
- hwdec_devices_add(hw->devs, &p->hwctx);
- }
+ int ret = av_hwdevice_ctx_create(&p->hwctx.av_device_ref,
+ AV_HWDEVICE_TYPE_DRM, device, NULL, 0);
+
if (device)
free(device);
+ if (ret != 0) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx: %s\n", av_err2str(ret));
+ goto err;
+ }
+
+ hwdec_devices_add(hw->devs, &p->hwctx);
+
return 0;
err:
diff --git a/video/out/opengl/hwdec_d3d11egl.c b/video/out/opengl/hwdec_d3d11egl.c
index 84b985906c..c3120914ea 100644
--- a/video/out/opengl/hwdec_d3d11egl.c
+++ b/video/out/opengl/hwdec_d3d11egl.c
@@ -185,6 +185,12 @@ static int init(struct ra_hwdec *hw)
.supported_formats = subfmts,
.hw_imgfmt = IMGFMT_D3D11,
};
+
+ if (!p->hwctx.av_device_ref) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx\n");
+ return -1;
+ }
+
hwdec_devices_add(hw->devs, &p->hwctx);
return 0;
diff --git a/video/out/opengl/hwdec_dxva2egl.c b/video/out/opengl/hwdec_dxva2egl.c
index 197d25b9b0..d870d982cd 100644
--- a/video/out/opengl/hwdec_dxva2egl.c
+++ b/video/out/opengl/hwdec_dxva2egl.c
@@ -183,6 +183,12 @@ static int init(struct ra_hwdec *hw)
.av_device_ref = d3d9_wrap_device_ref((IDirect3DDevice9 *)p->device9ex),
.hw_imgfmt = IMGFMT_DXVA2,
};
+
+ if (!p->hwctx.av_device_ref) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx\n");
+ goto fail;
+ }
+
hwdec_devices_add(hw->devs, &p->hwctx);
return 0;
diff --git a/video/out/opengl/hwdec_dxva2gldx.c b/video/out/opengl/hwdec_dxva2gldx.c
index 0a0784af4c..01728130d7 100644
--- a/video/out/opengl/hwdec_dxva2gldx.c
+++ b/video/out/opengl/hwdec_dxva2gldx.c
@@ -83,6 +83,12 @@ static int init(struct ra_hwdec *hw)
.av_device_ref = d3d9_wrap_device_ref((IDirect3DDevice9 *)p->device),
.hw_imgfmt = IMGFMT_DXVA2,
};
+
+ if (!p->hwctx.av_device_ref) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx\n");
+ return -1;
+ }
+
hwdec_devices_add(hw->devs, &p->hwctx);
return 0;
}
diff --git a/video/out/opengl/hwdec_ios.m b/video/out/opengl/hwdec_ios.m
index 480c9d9fe6..380c107ec1 100644
--- a/video/out/opengl/hwdec_ios.m
+++ b/video/out/opengl/hwdec_ios.m
@@ -71,8 +71,12 @@ static int init(struct ra_hwdec *hw)
.hw_imgfmt = IMGFMT_VIDEOTOOLBOX,
};
- av_hwdevice_ctx_create(&p->hwctx.av_device_ref, AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
- NULL, NULL, 0);
+ int ret = av_hwdevice_ctx_create(&p->hwctx.av_device_ref,
+ AV_HWDEVICE_TYPE_VIDEOTOOLBOX, NULL, NULL, 0);
+ if (ret != 0) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx: %s\n", av_err2str(ret));
+ return -1;
+ }
hwdec_devices_add(hw->devs, &p->hwctx);
diff --git a/video/out/opengl/hwdec_osx.c b/video/out/opengl/hwdec_osx.c
index 69e8ca9d09..8bbe54bd4c 100644
--- a/video/out/opengl/hwdec_osx.c
+++ b/video/out/opengl/hwdec_osx.c
@@ -72,8 +72,12 @@ static int init(struct ra_hwdec *hw)
.hw_imgfmt = IMGFMT_VIDEOTOOLBOX,
};
- av_hwdevice_ctx_create(&p->hwctx.av_device_ref, AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
- NULL, NULL, 0);
+ int ret = av_hwdevice_ctx_create(&p->hwctx.av_device_ref,
+ AV_HWDEVICE_TYPE_VIDEOTOOLBOX, NULL, NULL, 0);
+ if (ret != 0) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx: %s\n", av_err2str(ret));
+ return -1;
+ }
hwdec_devices_add(hw->devs, &p->hwctx);
diff --git a/video/out/vo_mediacodec_embed.c b/video/out/vo_mediacodec_embed.c
index 3a1df2fd2c..bf12c49ceb 100644
--- a/video/out/vo_mediacodec_embed.c
+++ b/video/out/vo_mediacodec_embed.c
@@ -55,6 +55,12 @@ static int preinit(struct vo *vo)
.av_device_ref = create_mediacodec_device_ref(vo),
.hw_imgfmt = IMGFMT_MEDIACODEC,
};
+
+ if (!p->hwctx.av_device_ref) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx\n");
+ return -1;
+ }
+
hwdec_devices_add(vo->hwdec_devs, &p->hwctx);
return 0;
}