From 0b1ef814986cac9b812a24fbf23252d6854f3c47 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 6 Jul 2016 13:38:43 +0200 Subject: video: fix deinterlace filter handling on pixel format changes The test scenario at hand was hardware decoding a file with d3d11 and with deinterlacing enabled. The file switches to a non-hardware dedocdeable format mid-stream. This failed, because it tried to call vf_reconfig() with the old filters inserted, with was fatal due to vf_d3d11vpp accepting only hardware input formats. Fix this by always strictly removing all auto-inserted filters (including the deinterlacing one), and reconfiguring only after that. Note that this change is good for other situations too, because we generally don't want to use a hardware deinterlacer for software decoding by default. They're not necessarily optimal, and VAAPI VPP even has incomprehensible deinterlacer bugs specifically with software frames not coming from a hardware decoder. --- player/video.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'player') diff --git a/player/video.c b/player/video.c index d0d0b60ed5..dab604bb01 100644 --- a/player/video.c +++ b/player/video.c @@ -193,19 +193,16 @@ static void filter_reconfig(struct MPContext *mpctx, struct vo_chain *vo_c) set_allowed_vo_formats(vo_c); - if (vf_reconfig(vo_c->vf, ¶ms) < 0) - return; - char *filters[] = {"autorotate", "autostereo3d", "deinterlace", NULL}; for (int n = 0; filters[n]; n++) { struct vf_instance *vf = vf_find_by_label(vo_c->vf, filters[n]); - if (vf) { + if (vf) vf_remove_filter(vo_c->vf, vf); - if (vf_reconfig(vo_c->vf, ¶ms) < 0) - return; - } } + if (vf_reconfig(vo_c->vf, ¶ms) < 0) + return; + if (params.rotate && (params.rotate % 90 == 0)) { if (!(vo_c->vo->driver->caps & VO_CAP_ROTATE90)) { // Try to insert a rotation filter. -- cgit v1.2.3