From d73d5327b38f2a5ac46af25a3709fbd50776d5b7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 28 Mar 2016 19:39:33 +0200 Subject: [PATCH] player: fix breakage when combining 3D and rotate auto-filters This would get stuck in reconfiguring the filter chain forever, because params was mutated ("params.rotate = 0;"). This was used as input for vf_reconfig(), but the filter chain input must always be equivalent to the decoder output, or filter chain reconfiguration will be triggered. The line of code to reset the rotation is from a time when this used to work differently. Also remove the unnecessary try_filter() parameter. --- player/video.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/player/video.c b/player/video.c index c398c05890..0af0b9065a 100644 --- a/player/video.c +++ b/player/video.c @@ -136,8 +136,7 @@ static void set_allowed_vo_formats(struct vo_chain *vo_c) vo_query_formats(vo_c->vo, vo_c->vf->allowed_output_formats); } -static int try_filter(struct vo_chain *vo_c, struct mp_image_params params, - char *name, char *label, char **args) +static int try_filter(struct vo_chain *vo_c, char *name, char *label, char **args) { struct vf_instance *vf = vf_append_filter(vo_c->vf, name, args); if (!vf) @@ -145,10 +144,10 @@ static int try_filter(struct vo_chain *vo_c, struct mp_image_params params, vf->label = talloc_strdup(vf, label); - if (vf_reconfig(vo_c->vf, ¶ms) < 0) { + if (vf_reconfig(vo_c->vf, &vo_c->input_format) < 0) { vf_remove_filter(vo_c->vf, vf); // restore - vf_reconfig(vo_c->vf, ¶ms); + vf_reconfig(vo_c->vf, &vo_c->input_format); return -1; } return 0; @@ -180,11 +179,8 @@ static void filter_reconfig(struct vo_chain *vo_c) if (!(vo_c->vo->driver->caps & VO_CAP_ROTATE90)) { // Try to insert a rotation filter. char *args[] = {"angle", "auto", NULL}; - if (try_filter(vo_c, params, "rotate", "autorotate", args) >= 0) { - params.rotate = 0; - } else { + if (try_filter(vo_c, "rotate", "autorotate", args) < 0) MP_ERR(vo_c, "Can't insert rotation filter.\n"); - } } } @@ -194,7 +190,7 @@ static void filter_reconfig(struct vo_chain *vo_c) char *to = (char *)MP_STEREO3D_NAME(params.stereo_out); if (to) { char *args[] = {"in", "auto", "out", to, NULL, NULL}; - if (try_filter(vo_c, params, "stereo3d", "autostereo3d", args) < 0) + if (try_filter(vo_c, "stereo3d", "autostereo3d", args) < 0) MP_ERR(vo_c, "Can't insert 3D conversion filter.\n"); } }