summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-29 22:46:46 +0100
committerwm4 <wm4@nowhere>2016-01-29 22:46:46 +0100
commit942a6729fa92c1b4ac4ab7b3feeb19eb3c17e7e9 (patch)
treea9f893e119f0b3a45028594fa965d942afd91652 /video/decode/vd_lavc.c
parent526d578beee0fb6dc61e189bf2e185f688c9bef2 (diff)
downloadmpv-942a6729fa92c1b4ac4ab7b3feeb19eb3c17e7e9.tar.bz2
mpv-942a6729fa92c1b4ac4ab7b3feeb19eb3c17e7e9.tar.xz
vd_lavc: simplify an aspect of hwdec fallback
Don't give the "software_fallback_decoder" field special meaning. Alwass set it, and rename it to "decoder". Whether hw decoding is used is determined by the "hwdec" field already.
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 29e7d1108f..4b013d4ec7 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -277,15 +277,13 @@ static void uninit(struct dec_video *vd)
static bool force_fallback(struct dec_video *vd)
{
vd_ffmpeg_ctx *ctx = vd->priv;
- if (!ctx->software_fallback_decoder)
+ if (!ctx->hwdec)
return false;
uninit_avctx(vd);
int lev = ctx->hwdec_notified ? MSGL_WARN : MSGL_V;
mp_msg(vd->log, lev, "Falling back to software decoding.\n");
- const char *decoder = ctx->software_fallback_decoder;
- ctx->software_fallback_decoder = NULL;
- init_avctx(vd, decoder, NULL);
+ init_avctx(vd, ctx->decoder, NULL);
return true;
}
@@ -295,6 +293,7 @@ static int init(struct dec_video *vd, const char *decoder)
ctx = vd->priv = talloc_zero(NULL, vd_ffmpeg_ctx);
ctx->log = vd->log;
ctx->opts = vd->opts;
+ ctx->decoder = talloc_strdup(ctx, decoder);
if (bstr_endswith0(bstr0(decoder), "_vdpau")) {
MP_WARN(vd, "VDPAU decoder '%s' was requested. "
@@ -326,7 +325,6 @@ static int init(struct dec_video *vd, const char *decoder)
}
if (hwdec) {
- ctx->software_fallback_decoder = talloc_strdup(ctx, decoder);
if (hwdec->get_codec)
decoder = hwdec->get_codec(ctx, decoder);
MP_VERBOSE(vd, "Trying hardware decoding.\n");
@@ -791,10 +789,7 @@ static int control(struct dec_video *vd, int cmd, void *arg)
return CONTROL_TRUE;
}
case VDCTRL_GET_HWDEC: {
- int hwdec = ctx->hwdec ? ctx->hwdec->type : 0;
- if (!ctx->software_fallback_decoder)
- hwdec = 0;
- *(int *)arg = hwdec;
+ *(int *)arg = ctx->hwdec ? ctx->hwdec->type : 0;
return CONTROL_TRUE;
}
case VDCTRL_FORCE_HWDEC_FALLBACK: