summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2022-03-24 14:18:59 -0700
committerPhilip Langdale <github.philipl@overt.org>2022-09-21 09:39:34 -0700
commite50db4292795de511531e764d7e609c1a37a204f (patch)
tree86215376579b077db945452b40042abca54081d6 /video/decode
parent7f2bc43a686ef59d2e6ea1a7a5cf95b55ee10d71 (diff)
downloadmpv-e50db4292795de511531e764d7e609c1a37a204f.tar.bz2
mpv-e50db4292795de511531e764d7e609c1a37a204f.tar.xz
vo: hwdec: do hwdec interop lookup by image format
It turns out that it's generally more useful to look up hwdecs by image format, rather than device type. In the situations where we need to find one, we generally know the image format we're dealing with. Doing this avoids us having to create mappings from image format to device type. The most significant part of this change is filling in the image format for the various hw interops. There is a hw_imgfmt field today today, but only a couple of the interops fill it in, and that seems to be because we've never actually used this piece of metadata before. Well, now we have a good use for it.
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/vd_lavc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index ce067d0ff4..4f38b669ec 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -435,12 +435,16 @@ static AVBufferRef *hwdec_create_dev(struct mp_filter *vd,
return ref;
}
} else if (ctx->hwdec_devs) {
+ int imgfmt = pixfmt2imgfmt(hwdec->pix_fmt);
struct hwdec_imgfmt_request params = {
- .imgfmt = pixfmt2imgfmt(hwdec->pix_fmt),
+ .imgfmt = imgfmt,
.probing = autoprobe,
};
hwdec_devices_request_for_img_fmt(ctx->hwdec_devs, &params);
- return hwdec_devices_get_lavc(ctx->hwdec_devs, hwdec->lavc_device);
+
+ const struct mp_hwdec_ctx *hw_ctx =
+ hwdec_devices_get_by_imgfmt(ctx->hwdec_devs, imgfmt);
+ return hw_ctx ? av_buffer_ref(hw_ctx->av_device_ref) : NULL;
}
return NULL;