diff options
Diffstat (limited to 'video/out/hwdec/hwdec_drmprime_overlay.c')
-rw-r--r-- | video/out/hwdec/hwdec_drmprime_overlay.c | 14 |
1 files changed, 10 insertions, 4 deletions
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: |