summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-05-11 16:18:58 +0200
committerwm4 <wm4@nowhere>2016-05-11 16:20:13 +0200
commit70b35612704a992dac45856e069608216f41ea89 (patch)
tree6ed76d1cfc9f4dad857b0c8d56c7fd6db1bb24fc /video/decode
parent2ec26b8396c8d44def148351ee370fde4b950cbf (diff)
downloadmpv-70b35612704a992dac45856e069608216f41ea89.tar.bz2
mpv-70b35612704a992dac45856e069608216f41ea89.tar.xz
video: add --hwdec=auto-copy mode
This uses the normal autoprobing rules like "auto", but rejects anything that isn't flagged as copying data back to system memory. The chunk in command.c was dead code, so remove it instead of updating it.
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/d3d11va.c1
-rw-r--r--video/decode/dxva2.c1
-rw-r--r--video/decode/lavc.h2
-rw-r--r--video/decode/vaapi.c1
-rw-r--r--video/decode/vd_lavc.c12
5 files changed, 14 insertions, 3 deletions
diff --git a/video/decode/d3d11va.c b/video/decode/d3d11va.c
index 9e300b1620..d631fff479 100644
--- a/video/decode/d3d11va.c
+++ b/video/decode/d3d11va.c
@@ -583,6 +583,7 @@ const struct vd_lavc_hwdec mp_vd_lavc_d3d11va = {
const struct vd_lavc_hwdec mp_vd_lavc_d3d11va_copy = {
.type = HWDEC_D3D11VA_COPY,
+ .copying = true,
.image_format = IMGFMT_D3D11VA,
.probe = d3d11va_probe,
.init = d3d11va_init,
diff --git a/video/decode/dxva2.c b/video/decode/dxva2.c
index 5d3afda86c..fe78a52e8c 100644
--- a/video/decode/dxva2.c
+++ b/video/decode/dxva2.c
@@ -499,6 +499,7 @@ const struct vd_lavc_hwdec mp_vd_lavc_dxva2 = {
const struct vd_lavc_hwdec mp_vd_lavc_dxva2_copy = {
.type = HWDEC_DXVA2_COPY,
+ .copying = true,
.image_format = IMGFMT_DXVA2,
.probe = dxva2_probe,
.init = dxva2_init,
diff --git a/video/decode/lavc.h b/video/decode/lavc.h
index dbefe79ad9..689222d872 100644
--- a/video/decode/lavc.h
+++ b/video/decode/lavc.h
@@ -49,6 +49,8 @@ struct vd_lavc_hwdec {
// If not-0: the IMGFMT_ format that should be accepted in the libavcodec
// get_format callback.
int image_format;
+ // Always returns a non-hwaccel image format.
+ bool copying;
// Setting this will queue the given number of frames before calling
// process_image() or returning them to the renderer. This can increase
// efficiency by not blocking on the hardware pipeline by reading back
diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c
index 4b098a8804..d108d50a8b 100644
--- a/video/decode/vaapi.c
+++ b/video/decode/vaapi.c
@@ -507,6 +507,7 @@ const struct vd_lavc_hwdec mp_vd_lavc_vaapi = {
const struct vd_lavc_hwdec mp_vd_lavc_vaapi_copy = {
.type = HWDEC_VAAPI_COPY,
+ .copying = true,
.image_format = IMGFMT_VAAPI,
.probe = probe_copy,
.init = init_copy,
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 75ca1f0229..fbb04d1abd 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -138,6 +138,7 @@ static const struct vd_lavc_hwdec mp_vd_lavc_rpi = {
static const struct vd_lavc_hwdec mp_vd_lavc_mediacodec = {
.type = HWDEC_MEDIACODEC,
.lavc_suffix = "_mediacodec",
+ .copying = true,
};
static const struct vd_lavc_hwdec *const hwdec_list[] = {
@@ -347,7 +348,8 @@ static void reinit(struct dec_video *vd)
struct vd_lavc_hwdec *hwdec = NULL;
if (hwdec_codec_allowed(vd, codec)) {
- if (vd->opts->hwdec_api == HWDEC_AUTO) {
+ int api = vd->opts->hwdec_api;
+ if (HWDEC_IS_AUTO(api)) {
// If a specific decoder is forced, we should try a hwdec method
// that works with it, instead of simply failing later at runtime.
// This is good for avoiding trying "normal" hwaccels on wrapper
@@ -369,11 +371,15 @@ static void reinit(struct dec_video *vd)
MP_VERBOSE(vd, "This hwaccel is not compatible.\n");
continue;
}
+ if (api == HWDEC_AUTO_COPY && !hwdec->copying) {
+ MP_VERBOSE(vd, "Not using this for auto-copy mode.\n");
+ continue;
+ }
break;
}
}
- } else if (vd->opts->hwdec_api != HWDEC_NONE) {
- hwdec = probe_hwdec(vd, false, vd->opts->hwdec_api, codec);
+ } else if (api != HWDEC_NONE) {
+ hwdec = probe_hwdec(vd, false, api, codec);
}
} else {
MP_VERBOSE(vd, "Not trying to use hardware decoding: codec %s is not "