summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/lavc.h1
-rw-r--r--video/decode/vaapi.c5
-rw-r--r--video/decode/vd_lavc.c13
-rw-r--r--video/decode/vdpau.c2
4 files changed, 17 insertions, 4 deletions
diff --git a/video/decode/lavc.h b/video/decode/lavc.h
index d67292c4fd..14dc6dda4e 100644
--- a/video/decode/lavc.h
+++ b/video/decode/lavc.h
@@ -65,6 +65,7 @@ struct vd_lavc_hwdec {
enum {
HWDEC_ERR_NO_CTX = -2,
HWDEC_ERR_NO_CODEC = -3,
+ HWDEC_ERR_EMULATED = -4, // probing successful, but emulated API detected
};
struct hwdec_profile_entry {
diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c
index d9267936d0..2b951fd1bb 100644
--- a/video/decode/vaapi.c
+++ b/video/decode/vaapi.c
@@ -409,6 +409,8 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
return HWDEC_ERR_NO_CTX;
if (!hwdec_check_codec_support(decoder, profiles))
return HWDEC_ERR_NO_CODEC;
+ if (va_guess_if_emulated(info->vaapi_ctx))
+ return HWDEC_ERR_EMULATED;
return 0;
}
@@ -418,9 +420,12 @@ static int probe_copy(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
struct priv dummy = {mp_null_log};
if (!create_va_dummy_ctx(&dummy))
return HWDEC_ERR_NO_CTX;
+ bool emulated = va_guess_if_emulated(dummy.ctx);
destroy_va_dummy_ctx(&dummy);
if (!hwdec_check_codec_support(decoder, profiles))
return HWDEC_ERR_NO_CODEC;
+ if (emulated)
+ return HWDEC_ERR_EMULATED;
return 0;
}
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 2593e50285..9ef49c25e1 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -200,19 +200,24 @@ static struct vd_lavc_hwdec *probe_hwdec(struct dec_video *vd, bool autoprobe,
{
struct vd_lavc_hwdec *hwdec = find_hwcodec(api);
if (!hwdec) {
- MP_VERBOSE(vd, "Requested hardware decoder not "
- "compiled.\n");
+ MP_VERBOSE(vd, "Requested hardware decoder not compiled.\n");
return NULL;
}
int r = hwdec_probe(hwdec, &vd->hwdec_info, decoder);
+ if (r == HWDEC_ERR_EMULATED) {
+ if (autoprobe)
+ return NULL;
+ // User requested this explicitly.
+ MP_WARN(vd, "Using emulated hardware decoding API.\n");
+ r = 0;
+ }
if (r >= 0) {
return hwdec;
} else if (r == HWDEC_ERR_NO_CODEC) {
MP_VERBOSE(vd, "Hardware decoder '%s' not found in "
"libavcodec.\n", decoder);
} else if (r == HWDEC_ERR_NO_CTX && !autoprobe) {
- MP_WARN(vd, "VO does not support requested "
- "hardware decoder.\n");
+ MP_WARN(vd, "VO does not support requested hardware decoder.\n");
}
return NULL;
}
diff --git a/video/decode/vdpau.c b/video/decode/vdpau.c
index 4cd1eee531..44850dfaec 100644
--- a/video/decode/vdpau.c
+++ b/video/decode/vdpau.c
@@ -175,6 +175,8 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
return HWDEC_ERR_NO_CTX;
if (!hwdec_check_codec_support(decoder, profiles))
return HWDEC_ERR_NO_CODEC;
+ if (mp_vdpau_guess_if_emulated(info->vdpau_ctx))
+ return HWDEC_ERR_EMULATED;
return 0;
}