1
mirror of https://github.com/mpv-player/mpv synced 2024-10-02 16:25:33 +02:00

dxva2: add interop (non-copyback) hwdec_type

This always falls back to software decoding right now. VO support will be added
in future commits.
This commit is contained in:
Kevin Mitchell 2016-01-30 01:04:34 -08:00
parent 941885b62c
commit 084162d6fe
4 changed files with 20 additions and 4 deletions

View File

@ -86,6 +86,7 @@ const struct m_opt_choice_alternatives mp_hwdec_names[] = {
{"videotoolbox",HWDEC_VIDEOTOOLBOX},
{"vaapi", HWDEC_VAAPI},
{"vaapi-copy", HWDEC_VAAPI_COPY},
{"dxva2", HWDEC_DXVA2},
{"dxva2-copy", HWDEC_DXVA2_COPY},
{"rpi", HWDEC_RPI},
{0}

View File

@ -296,9 +296,11 @@ static int dxva2_init(struct lavc_ctx *s)
s->hwdec_priv = ctx;
ctx->log = mp_log_new(s, s->log, "dxva2");
ctx->sw_pool = talloc_steal(ctx, mp_image_pool_new(17));
mp_check_gpu_memcpy(ctx->log, NULL);
if (s->hwdec->type == HWDEC_DXVA2_COPY) {
mp_check_gpu_memcpy(ctx->log, NULL);
ctx->sw_pool = talloc_steal(ctx, mp_image_pool_new(17));
}
ctx->deviceHandle = INVALID_HANDLE_VALUE;
@ -633,6 +635,16 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
return HWDEC_ERR_NO_CODEC;
}
const struct vd_lavc_hwdec mp_vd_lavc_dxva2 = {
.type = HWDEC_DXVA2,
.image_format = IMGFMT_DXVA2,
.probe = probe,
.init = dxva2_init,
.uninit = dxva2_uninit,
.init_decoder = dxva2_init_decoder,
.allocate_image = dxva2_allocate_image,
};
const struct vd_lavc_hwdec mp_vd_lavc_dxva2_copy = {
.type = HWDEC_DXVA2_COPY,
.image_format = IMGFMT_DXVA2,

View File

@ -124,6 +124,7 @@ extern const struct vd_lavc_hwdec mp_vd_lavc_vdpau;
extern const struct vd_lavc_hwdec mp_vd_lavc_videotoolbox;
extern const struct vd_lavc_hwdec mp_vd_lavc_vaapi;
extern const struct vd_lavc_hwdec mp_vd_lavc_vaapi_copy;
extern const struct vd_lavc_hwdec mp_vd_lavc_dxva2;
extern const struct vd_lavc_hwdec mp_vd_lavc_dxva2_copy;
extern const struct vd_lavc_hwdec mp_vd_lavc_rpi;
@ -142,6 +143,7 @@ static const struct vd_lavc_hwdec *const hwdec_list[] = {
&mp_vd_lavc_vaapi_copy,
#endif
#if HAVE_DXVA2_HWACCEL
&mp_vd_lavc_dxva2,
&mp_vd_lavc_dxva2_copy,
#endif
NULL

View File

@ -13,8 +13,9 @@ enum hwdec_type {
HWDEC_VIDEOTOOLBOX = 3,
HWDEC_VAAPI = 4,
HWDEC_VAAPI_COPY = 5,
HWDEC_DXVA2_COPY = 6,
HWDEC_RPI = 7,
HWDEC_DXVA2 = 6,
HWDEC_DXVA2_COPY = 7,
HWDEC_RPI = 8,
};
// hwdec_type names (options.c)