path: root/player/video.c
diff options
authorwm4 <wm4@nowhere>2016-07-06 13:38:43 +0200
committerwm4 <wm4@nowhere>2016-07-06 13:38:43 +0200
commit0b1ef814986cac9b812a24fbf23252d6854f3c47 (patch)
tree94a5124ae1da19e036b581e73130e5d7f55b202c /player/video.c
parentfc76966d9ee5e5ed19f0cf1566a7b94c9e1ac45b (diff)
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.
Diffstat (limited to 'player/video.c')
1 files changed, 4 insertions, 7 deletions
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)
- if (vf_reconfig(vo_c->vf, &params) < 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, &params) < 0)
- return;
- }
+ if (vf_reconfig(vo_c->vf, &params) < 0)
+ return;
if (params.rotate && (params.rotate % 90 == 0)) {
if (!(vo_c->vo->driver->caps & VO_CAP_ROTATE90)) {
// Try to insert a rotation filter.