summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-23 01:17:28 +0200
committerwm4 <wm4@nowhere>2014-04-23 01:58:12 +0200
commit8a74638dc743007f6d5d6bb3a672167fce353480 (patch)
treeebfe93c575a3d801cb21cd565da29e6f1d5bd41f /video/decode/vd_lavc.c
parentc7ab0019a388ceabda38e0d7ba5eb289f30e24af (diff)
downloadmpv-8a74638dc743007f6d5d6bb3a672167fce353480.tar.bz2
mpv-8a74638dc743007f6d5d6bb3a672167fce353480.tar.xz
video: add a "hwdec" property to enable or disable hw decoding at runtime
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 4935913d73..57b391a6a2 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -225,6 +225,8 @@ static int init(struct dec_video *vd, const char *decoder)
ctx->log = vd->log;
ctx->opts = vd->opts;
+ ctx->selected_hwdec = vd->opts->hwdec_api;
+
if (bstr_endswith0(bstr0(decoder), "_vdpau")) {
MP_WARN(vd, "VDPAU decoder '%s' was requested. "
"This way of enabling hardware\ndecoding is not supported "
@@ -646,6 +648,13 @@ static int control(struct dec_video *vd, int cmd, void *arg)
delay += avctx->thread_count - 1;
*(int *)arg = delay;
return CONTROL_TRUE;
+ case VDCTRL_GET_HWDEC: {
+ int hwdec = ctx->selected_hwdec;
+ if (!ctx->software_fallback_decoder)
+ hwdec = 0;
+ *(int *)arg = hwdec;
+ return CONTROL_TRUE;
+ }
case VDCTRL_FORCE_HWDEC_FALLBACK:
return force_fallback(vd);
}