diff options
author | Philip Langdale <philipl@overt.org> | 2022-03-12 11:24:51 -0800 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2022-09-21 09:39:34 -0700 |
commit | 989d873d6ec57171a55f432d6f87a9e5a61a706c (patch) | |
tree | 0077fcefc7be591eea5d6ad2e4e2373c8d59b49d /video/filter/vf_vdpaupp.c | |
parent | 5629ed81eed90f95a04bb3d8ff64f135bd186651 (diff) | |
download | mpv-989d873d6ec57171a55f432d6f87a9e5a61a706c.tar.bz2 mpv-989d873d6ec57171a55f432d6f87a9e5a61a706c.tar.xz |
filters: lavfi: allow hwdec_interop selection for filters
Today, lavfi filters are provided a hw_device from the first
hwdec_interop that was loaded, regardless of whether it's the right one
or not. In most situations where a hardware based filter is used, we
need more control over the device.
In this change, a `hwdec_interop` option is added to the lavfi wrapper
filter configuration and this is used to pick the correct hw_device to
inject into the filter or graph (in the case of a graph, all filters
get the same device).
Note that this requires the use of the explicit lavfi syntax to allow
for the extra configuration.
eg:
```
mpv --vf=hwupload
```
becomes
```
mpv --vf=lavfi=[hwupload]:hwdec_interop=cuda-nvdec
```
or
```
mpv --vf=lavfi-bridge=[hwupload]:hwdec_interop=cuda-nvdec
```
Diffstat (limited to 'video/filter/vf_vdpaupp.c')
-rw-r--r-- | video/filter/vf_vdpaupp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/video/filter/vf_vdpaupp.c b/video/filter/vf_vdpaupp.c index 6de8671e39..de5caa3534 100644 --- a/video/filter/vf_vdpaupp.c +++ b/video/filter/vf_vdpaupp.c @@ -136,11 +136,11 @@ static struct mp_filter *vf_vdpaupp_create(struct mp_filter *parent, void *optio p->queue = mp_refqueue_alloc(f); - AVBufferRef *ref = mp_filter_load_hwdec_device(f, IMGFMT_VDPAU); - if (!ref) + struct mp_hwdec_ctx *hwdec_ctx = + mp_filter_load_hwdec_device(f, IMGFMT_VDPAU); + if (!hwdec_ctx || !hwdec_ctx->av_device_ref) goto error; - p->ctx = mp_vdpau_get_ctx_from_av(ref); - av_buffer_unref(&ref); + p->ctx = mp_vdpau_get_ctx_from_av(hwdec_ctx->av_device_ref); if (!p->ctx) goto error; |