diff options
Diffstat (limited to 'video/decode')
-rw-r--r-- | video/decode/lavc.h | 2 | ||||
-rw-r--r-- | video/decode/vd_lavc.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/video/decode/lavc.h b/video/decode/lavc.h index 8383c0a67f..6287dc8577 100644 --- a/video/decode/lavc.h +++ b/video/decode/lavc.h @@ -85,6 +85,8 @@ typedef struct lavc_ctx { struct vd_lavc_hwdec { enum hwdec_type type; + // If non-0, get this hwdec type from the VO (for the AVHWDeviceContext). + enum hwdec_type interop_type; // If not-0: the IMGFMT_ format that should be accepted in the libavcodec // get_format callback. int image_format; diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index ecc9e89962..6422346d31 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -160,6 +160,7 @@ static const struct vd_lavc_hwdec mp_vd_lavc_rkmpp = { #if HAVE_CUDA_HWACCEL static const struct vd_lavc_hwdec mp_vd_lavc_nvdec = { .type = HWDEC_NVDEC, + .interop_type = HWDEC_CUDA, .image_format = IMGFMT_CUDA, .generic_hwaccel = true, .set_hwframes = true, @@ -369,8 +370,9 @@ static struct mp_hwdec_ctx *hwdec_create_dev(struct dec_video *vd, if (hwdec->create_dev) return hwdec->create_dev(vd->global, vd->log, autoprobe); if (vd->hwdec_devs) { - hwdec_devices_request(vd->hwdec_devs, hwdec->type); - return hwdec_devices_get(vd->hwdec_devs, hwdec->type); + int type = hwdec->interop_type ? hwdec->interop_type : hwdec->type; + hwdec_devices_request(vd->hwdec_devs, type); + return hwdec_devices_get(vd->hwdec_devs, type); } return NULL; } |