summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
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/vd_lavc.c
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/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c12
1 files changed, 9 insertions, 3 deletions
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 "