mirror of
https://github.com/mpv-player/mpv
synced 2025-02-01 12:42:04 +00:00
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.
This commit is contained in:
parent
cdd30fd0ab
commit
d73d5327b3
@ -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);
|
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,
|
static int try_filter(struct vo_chain *vo_c, char *name, char *label, char **args)
|
||||||
char *name, char *label, char **args)
|
|
||||||
{
|
{
|
||||||
struct vf_instance *vf = vf_append_filter(vo_c->vf, name, args);
|
struct vf_instance *vf = vf_append_filter(vo_c->vf, name, args);
|
||||||
if (!vf)
|
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);
|
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);
|
vf_remove_filter(vo_c->vf, vf);
|
||||||
// restore
|
// restore
|
||||||
vf_reconfig(vo_c->vf, ¶ms);
|
vf_reconfig(vo_c->vf, &vo_c->input_format);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -180,11 +179,8 @@ static void filter_reconfig(struct vo_chain *vo_c)
|
|||||||
if (!(vo_c->vo->driver->caps & VO_CAP_ROTATE90)) {
|
if (!(vo_c->vo->driver->caps & VO_CAP_ROTATE90)) {
|
||||||
// Try to insert a rotation filter.
|
// Try to insert a rotation filter.
|
||||||
char *args[] = {"angle", "auto", NULL};
|
char *args[] = {"angle", "auto", NULL};
|
||||||
if (try_filter(vo_c, params, "rotate", "autorotate", args) >= 0) {
|
if (try_filter(vo_c, "rotate", "autorotate", args) < 0)
|
||||||
params.rotate = 0;
|
|
||||||
} else {
|
|
||||||
MP_ERR(vo_c, "Can't insert rotation filter.\n");
|
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);
|
char *to = (char *)MP_STEREO3D_NAME(params.stereo_out);
|
||||||
if (to) {
|
if (to) {
|
||||||
char *args[] = {"in", "auto", "out", to, NULL, NULL};
|
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");
|
MP_ERR(vo_c, "Can't insert 3D conversion filter.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user