From cda8f1613ff307a9e0b5528743f3e941b05dcee7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 12 Aug 2020 17:28:08 +0200 Subject: sd_ass: force full reinit if certain options change at runtime Options like --sub-ass-force-style and others could not be changed at runtime (the changes didn't take any effect). Fix this by using the brutal approach, and completely reinit the subtitle state when this happens. Maybe a bit clunky, but for now I'd rather not put more effort into this. Fixes: #7689 --- options/m_option.h | 3 ++- options/options.c | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'options') diff --git a/options/m_option.h b/options/m_option.h index 25dc212482..bfaaef8d07 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -420,7 +420,8 @@ char *format_file_size(int64_t size); #define UPDATE_VO_RESIZE (1 << 19) // --android-surface-size #define UPDATE_HWDEC (1 << 20) // --hwdec #define UPDATE_DVB_PROG (1 << 21) // some --dvbin-... -#define UPDATE_OPT_LAST (1 << 21) +#define UPDATE_SUB_HARD (1 << 22) // subtitle opts. that need full reinit +#define UPDATE_OPT_LAST (1 << 22) // All bits between _FIRST and _LAST (inclusive) #define UPDATE_OPTS_MASK \ diff --git a/options/options.c b/options/options.c index 63c99053a8..efde6fad4b 100644 --- a/options/options.c +++ b/options/options.c @@ -235,7 +235,7 @@ const struct m_sub_options mp_subtitle_sub_opts = { {"sub-pos", OPT_INT(sub_pos), M_RANGE(0, 100)}, {"sub-gauss", OPT_FLOAT(sub_gauss), M_RANGE(0.0, 3.0)}, {"sub-gray", OPT_FLAG(sub_gray)}, - {"sub-ass", OPT_FLAG(ass_enabled)}, + {"sub-ass", OPT_FLAG(ass_enabled), .flags = UPDATE_SUB_HARD}, {"sub-scale", OPT_FLOAT(sub_scale), M_RANGE(0, 100)}, {"sub-ass-line-spacing", OPT_FLOAT(ass_line_spacing), M_RANGE(-1000, 1000)}, @@ -245,9 +245,11 @@ const struct m_sub_options mp_subtitle_sub_opts = { {"sub-ass-vsfilter-color-compat", OPT_CHOICE(ass_vsfilter_color_compat, {"no", 0}, {"basic", 1}, {"full", 2}, {"force-601", 3})}, {"sub-ass-vsfilter-blur-compat", OPT_FLAG(ass_vsfilter_blur_compat)}, - {"embeddedfonts", OPT_FLAG(use_embedded_fonts)}, - {"sub-ass-force-style", OPT_STRINGLIST(ass_force_style_list)}, - {"sub-ass-styles", OPT_STRING(ass_styles_file), .flags = M_OPT_FILE}, + {"embeddedfonts", OPT_FLAG(use_embedded_fonts), .flags = UPDATE_SUB_HARD}, + {"sub-ass-force-style", OPT_STRINGLIST(ass_force_style_list), + .flags = UPDATE_SUB_HARD}, + {"sub-ass-styles", OPT_STRING(ass_styles_file), .flags = M_OPT_FILE, + .flags = UPDATE_SUB_HARD}, {"sub-ass-hinting", OPT_CHOICE(ass_hinting, {"none", 0}, {"light", 1}, {"normal", 2}, {"native", 3})}, {"sub-ass-shaper", OPT_CHOICE(ass_shaper, -- cgit v1.2.3