summaryrefslogtreecommitdiffstats
path: root/video/filter
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-02 04:33:43 +0100
committerwm4 <wm4@nowhere>2017-12-02 04:53:55 +0100
commit292724538cfbe2a6c713420f8b5be0abf75ad46c (patch)
treee1bb9a2a16e347f0de3075792d18492b3dd4852c /video/filter
parent23a9efd124042e7c97f8317bcd8ae5903d039ef7 (diff)
downloadmpv-292724538cfbe2a6c713420f8b5be0abf75ad46c.tar.bz2
mpv-292724538cfbe2a6c713420f8b5be0abf75ad46c.tar.xz
video: remove some more hwdec legacy stuff
Finally get rid of all the HWDEC_* things, and instead rely on the libavutil equivalents. vdpau still uses a shitty hack, but fuck the vdpau code. Remove all the now unneeded remains. The vdpau preemption thing was not unused anymore; if someone cares this could probably be restored.
Diffstat (limited to 'video/filter')
-rw-r--r--video/filter/vf_d3d11vpp.c22
-rw-r--r--video/filter/vf_vavpp.c21
-rw-r--r--video/filter/vf_vdpaupp.c15
3 files changed, 47 insertions, 11 deletions
diff --git a/video/filter/vf_d3d11vpp.c b/video/filter/vf_d3d11vpp.c
index cafa5df122..f49af06424 100644
--- a/video/filter/vf_d3d11vpp.c
+++ b/video/filter/vf_d3d11vpp.c
@@ -19,6 +19,9 @@
#include <windows.h>
#include <d3d11.h>
+#include <libavutil/hwcontext.h>
+#include <libavutil/hwcontext_d3d11va.h>
+
#include "common/common.h"
#include "osdep/timer.h"
#include "osdep/windows_utils.h"
@@ -477,6 +480,9 @@ static int vf_open(vf_instance_t *vf)
{
struct vf_priv_s *p = vf->priv;
+ if (!vf->hwdec_devs)
+ return 0;
+
vf->reconfig = reconfig;
vf->filter_ext = filter_ext;
vf->filter_out = filter_out;
@@ -484,14 +490,22 @@ static int vf_open(vf_instance_t *vf)
vf->uninit = uninit;
vf->control = control;
- p->queue = mp_refqueue_alloc();
-
- p->vo_dev = hwdec_devices_load(vf->hwdec_devs, HWDEC_D3D11VA);
- if (!p->vo_dev)
+ hwdec_devices_request_all(vf->hwdec_devs);
+ AVBufferRef *ref =
+ hwdec_devices_get_lavc(vf->hwdec_devs, AV_HWDEVICE_TYPE_D3D11VA);
+ if (!ref)
return 0;
+ AVHWDeviceContext *hwctx = (void *)ref->data;
+ AVD3D11VADeviceContext *d3dctx = hwctx->hwctx;
+
+ p->vo_dev = d3dctx->device;
ID3D11Device_AddRef(p->vo_dev);
+ av_buffer_unref(&ref);
+
+ p->queue = mp_refqueue_alloc();
+
HRESULT hr;
hr = ID3D11Device_QueryInterface(p->vo_dev, &IID_ID3D11VideoDevice,
diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c
index 4d2cc0981f..edee556232 100644
--- a/video/filter/vf_vavpp.c
+++ b/video/filter/vf_vavpp.c
@@ -21,6 +21,7 @@
#include <va/va_vpp.h>
#include <libavutil/hwcontext.h>
+#include <libavutil/hwcontext_vaapi.h>
#include "config.h"
#include "options/options.h"
@@ -57,7 +58,7 @@ struct vf_priv_s {
VAContextID context;
struct mp_image_params params;
VADisplay display;
- struct mp_vaapi_ctx *va;
+ AVBufferRef *av_device_ref;
struct pipeline pipe;
AVBufferRef *hw_pool;
@@ -358,7 +359,7 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in,
out->hw_subfmt = IMGFMT_NV12;
}
- p->hw_pool = av_hwframe_ctx_alloc(p->va->av_device_ref);
+ p->hw_pool = av_hwframe_ctx_alloc(p->av_device_ref);
if (!p->hw_pool)
return -1;
AVHWFramesContext *hw_frames = (void *)p->hw_pool->data;
@@ -387,6 +388,7 @@ static void uninit(struct vf_instance *vf)
av_buffer_unref(&p->hw_pool);
flush_frames(vf);
mp_refqueue_free(p->queue);
+ av_buffer_unref(&p->av_device_ref);
}
static int query_format(struct vf_instance *vf, unsigned int imgfmt)
@@ -489,6 +491,9 @@ static int vf_open(vf_instance_t *vf)
{
struct vf_priv_s *p = vf->priv;
+ if (!vf->hwdec_devs)
+ return 0;
+
vf->reconfig = reconfig;
vf->filter_ext = filter_ext;
vf->filter_out = filter_out;
@@ -498,12 +503,18 @@ static int vf_open(vf_instance_t *vf)
p->queue = mp_refqueue_alloc();
- p->va = hwdec_devices_load(vf->hwdec_devs, HWDEC_VAAPI);
- if (!p->va || !p->va->av_device_ref) {
+ hwdec_devices_request_all(vf->hwdec_devs);
+ p->av_device_ref =
+ hwdec_devices_get_lavc(vf->hwdec_devs, AV_HWDEVICE_TYPE_VAAPI);
+ if (!p->av_device_ref) {
uninit(vf);
return 0;
}
- p->display = p->va->display;
+
+ AVHWDeviceContext *hwctx = (void *)p->av_device_ref->data;
+ AVVAAPIDeviceContext *vactx = hwctx->hwctx;
+
+ p->display = vactx->display;
if (initialize(vf))
return true;
diff --git a/video/filter/vf_vdpaupp.c b/video/filter/vf_vdpaupp.c
index a583e386f2..de1979cf05 100644
--- a/video/filter/vf_vdpaupp.c
+++ b/video/filter/vf_vdpaupp.c
@@ -21,6 +21,8 @@
#include <inttypes.h>
#include <assert.h>
+#include <libavutil/hwcontext.h>
+
#include "common/common.h"
#include "common/msg.h"
#include "options/m_option.h"
@@ -166,6 +168,9 @@ static int vf_open(vf_instance_t *vf)
{
struct vf_priv_s *p = vf->priv;
+ if (!vf->hwdec_devs)
+ return 0;
+
vf->reconfig = reconfig;
vf->filter_ext = filter_ext;
vf->filter_out = filter_out;
@@ -175,9 +180,15 @@ static int vf_open(vf_instance_t *vf)
p->queue = mp_refqueue_alloc();
- p->ctx = hwdec_devices_load(vf->hwdec_devs, HWDEC_VDPAU);
- if (!p->ctx)
+ hwdec_devices_request_all(vf->hwdec_devs);
+ AVBufferRef *ref =
+ hwdec_devices_get_lavc(vf->hwdec_devs, AV_HWDEVICE_TYPE_VDPAU);
+ struct mp_vdpau_ctx *ctx = mp_vdpau_get_ctx_from_av(ref);
+ av_buffer_unref(&ref);
+ if (!ctx) {
+ uninit(vf);
return 0;
+ }
p->def_deintmode = p->opts.deint;
if (!p->deint_enabled)