summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-19 20:00:54 +0100
committerwm4 <wm4@nowhere>2016-02-19 20:02:09 +0100
commitf04cb7bf483616f8942b27e1237ea51ecc99e08b (patch)
tree321244a15a07c4e6ad6a7d08acf731ededaedf1d
parent6640b22a8c0384972c2782efe4092968e09161c1 (diff)
downloadmpv-f04cb7bf483616f8942b27e1237ea51ecc99e08b.tar.bz2
mpv-f04cb7bf483616f8942b27e1237ea51ecc99e08b.tar.xz
dxva2: fix autoprobing
Doing --hwdec=auto ends up picking dxva2, creating a decoder, and then sending D3D frames down the video chain, which immediately fails and falls back to software. Consider dxva2 only if the VO provides a context. If this fails, autoprobing will proceed to try dxva2-copy as usual. Fixes #2844.
-rw-r--r--video/decode/dxva2.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/video/decode/dxva2.c b/video/decode/dxva2.c
index 4cc1dcf630..d4ce0c72b3 100644
--- a/video/decode/dxva2.c
+++ b/video/decode/dxva2.c
@@ -626,7 +626,12 @@ static int dxva2_init_decoder(struct lavc_ctx *s, int w, int h)
static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
const char *decoder)
{
- hwdec_request_api(info, "dxva2"); // we can do without too
+ hwdec_request_api(info, "dxva2");
+ // dxva2-copy can do without external context; dxva2 requires it.
+ if (hwdec->type != HWDEC_DXVA2_COPY) {
+ if (!info || !info->hwctx || !info->hwctx->d3d_ctx)
+ return HWDEC_ERR_NO_CTX;
+ }
for (int i = 0; dxva2_modes[i].guid; i++) {
const dxva2_mode *mode = &dxva2_modes[i];
if (mp_codec_to_av_codec_id(decoder) == mode->codec)