1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-21 02:41:13 +00:00

vo_gpu/vo_gpu_next: fix setting an empty dscale

The manual currently says that if dscale is unset, --scale will be
applied. However, this only works at init time. If you change the dscale
filter to be empty later, vo_gpu will segfault and vo_gpu_next will
throw an error and refuse the changes. That's because when the option is
unset at runtime, the value becomes "" not NULL and the vo's never
accounted for this. Fixes .
This commit is contained in:
Dudemanguy 2023-08-02 18:27:28 -05:00
parent 65a95a721e
commit 59ac302dff
2 changed files with 7 additions and 1 deletions

View File

@ -1729,6 +1729,12 @@ static void reinit_scaler(struct gl_video *p, struct scaler *scaler,
uninit_scaler(p, scaler);
if (conf && scaler->index == SCALER_DSCALE && (!conf->kernel.name ||
!conf->kernel.name[0]))
{
conf = &p->opts.scaler[SCALER_SCALE];
}
struct filter_kernel bare_window;
const struct filter_kernel *t_kernel = mp_find_filter_kernel(conf->kernel.name);
const struct filter_window *t_window = mp_find_filter_window(conf->window.name);

View File

@ -1542,7 +1542,7 @@ static const struct pl_filter_config *map_scaler(struct priv *p,
const struct gl_video_opts *opts = p->opts_cache->opts;
const struct scaler_config *cfg = &opts->scaler[unit];
if (unit == SCALER_DSCALE && !cfg->kernel.name)
if (unit == SCALER_DSCALE && (!cfg->kernel.name || !strcmp(cfg->kernel.name, "")))
cfg = &opts->scaler[SCALER_SCALE];
for (int i = 0; fixed_presets[i].name; i++) {