summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-10-30 18:31:20 +0100
committerwm4 <wm4@nowhere>2017-10-30 18:31:20 +0100
commitb7ce3ac44575d82b5b23f10477b1158b84394b8f (patch)
tree612bae68b23a427a34fa5700fc309e819b3410bb
parent694157e024e52e6fcb01cfd2e9c6d50b85f9621f (diff)
downloadmpv-b7ce3ac44575d82b5b23f10477b1158b84394b8f.tar.bz2
mpv-b7ce3ac44575d82b5b23f10477b1158b84394b8f.tar.xz
vd_lavc: remove need for duplicated cuda GL interop backend
This is just a dumb consequence of HWDEC_ types somehow being part of both decoder and VO. Obviously, the VO should only care about supporting specific hardware surface types or providing specific device types, but until they are separated, stupid unintuitive mismatches will occur.
-rw-r--r--video/decode/lavc.h2
-rw-r--r--video/decode/vd_lavc.c6
-rw-r--r--video/out/gpu/hwdec.c1
-rw-r--r--video/out/opengl/hwdec_cuda.c18
4 files changed, 7 insertions, 20 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;
}
diff --git a/video/out/gpu/hwdec.c b/video/out/gpu/hwdec.c
index d88dc5e779..48ed4db58e 100644
--- a/video/out/gpu/hwdec.c
+++ b/video/out/gpu/hwdec.c
@@ -66,7 +66,6 @@ static const struct ra_hwdec_driver *const mpgl_hwdec_drivers[] = {
#endif
#if HAVE_CUDA_HWACCEL
&ra_hwdec_cuda,
- &ra_hwdec_cuda_nvdec,
#endif
#if HAVE_RPI
&ra_hwdec_rpi_overlay,
diff --git a/video/out/opengl/hwdec_cuda.c b/video/out/opengl/hwdec_cuda.c
index 5aefed106d..321826eb49 100644
--- a/video/out/opengl/hwdec_cuda.c
+++ b/video/out/opengl/hwdec_cuda.c
@@ -326,24 +326,8 @@ static int mapper_map(struct ra_hwdec_mapper *mapper)
}
const struct ra_hwdec_driver ra_hwdec_cuda = {
- .name = "cuda",
- .api = HWDEC_CUDA,
- .imgfmts = {IMGFMT_CUDA, 0},
- .priv_size = sizeof(struct priv_owner),
- .init = cuda_init,
- .uninit = cuda_uninit,
- .mapper = &(const struct ra_hwdec_mapper_driver){
- .priv_size = sizeof(struct priv),
- .init = mapper_init,
- .uninit = mapper_uninit,
- .map = mapper_map,
- .unmap = mapper_unmap,
- },
-};
-
-const struct ra_hwdec_driver ra_hwdec_cuda_nvdec = {
.name = "cuda-nvdec",
- .api = HWDEC_NVDEC,
+ .api = HWDEC_CUDA,
.imgfmts = {IMGFMT_CUDA, 0},
.priv_size = sizeof(struct priv_owner),
.init = cuda_init,