summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--options/m_option.h4
-rw-r--r--options/options.c76
-rw-r--r--player/command.c60
-rw-r--r--sub/osd.c2
4 files changed, 56 insertions, 86 deletions
diff --git a/options/m_option.h b/options/m_option.h
index a47bbaa7d7..74af6b732e 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -383,7 +383,9 @@ struct m_option {
#define UPDATE_OPT_FIRST (1 << 14)
#define UPDATE_TERM (1 << 14) // terminal options
#define UPDATE_RENDERER (1 << 15) // mainly vo_opengl options
-#define UPDATE_OPT_LAST (1 << 15)
+#define UPDATE_VIDEOPOS (1 << 16) // video position (panscan etc.)
+#define UPDATE_OSD (1 << 17) // related to OSD rendering
+#define UPDATE_OPT_LAST (1 << 17)
// All bits between _FIRST and _LAST (inclusive)
#define UPDATE_OPTS_MASK \
diff --git a/options/options.c b/options/options.c
index 5c1cf59919..df2888f5f9 100644
--- a/options/options.c
+++ b/options/options.c
@@ -164,13 +164,13 @@ static const m_option_t mp_vo_opt_list[] = {
OPT_FLAG("fullscreen", fullscreen, 0),
OPT_ALIAS("fs", "fullscreen"),
OPT_FLAG("native-keyrepeat", native_keyrepeat, 0),
- OPT_FLOATRANGE("panscan", panscan, 0, 0.0, 1.0),
- OPT_FLOATRANGE("video-zoom", zoom, 0, -20.0, 20.0),
- OPT_FLOATRANGE("video-pan-x", pan_x, 0, -3.0, 3.0),
- OPT_FLOATRANGE("video-pan-y", pan_y, 0, -3.0, 3.0),
- OPT_FLOATRANGE("video-align-x", align_x, 0, -1.0, 1.0),
- OPT_FLOATRANGE("video-align-y", align_y, 0, -1.0, 1.0),
- OPT_CHOICE("video-unscaled", unscaled, 0,
+ OPT_FLOATRANGE("panscan", panscan, UPDATE_VIDEOPOS, 0.0, 1.0),
+ OPT_FLOATRANGE("video-zoom", zoom, UPDATE_VIDEOPOS, -20.0, 20.0),
+ OPT_FLOATRANGE("video-pan-x", pan_x, UPDATE_VIDEOPOS, -3.0, 3.0),
+ OPT_FLOATRANGE("video-pan-y", pan_y, UPDATE_VIDEOPOS, -3.0, 3.0),
+ OPT_FLOATRANGE("video-align-x", align_x, UPDATE_VIDEOPOS, -1.0, 1.0),
+ OPT_FLOATRANGE("video-align-y", align_y, UPDATE_VIDEOPOS, -1.0, 1.0),
+ OPT_CHOICE("video-unscaled", unscaled, UPDATE_VIDEOPOS,
({"no", 0}, {"yes", 1}, {"downscale-big", 2})),
OPT_INT64("wid", WinID, 0),
OPT_CHOICE_OR_INT("screen", screen_id, 0, 0, 32,
@@ -178,7 +178,7 @@ static const m_option_t mp_vo_opt_list[] = {
OPT_CHOICE_OR_INT("fs-screen", fsscreen_id, 0, 0, 32,
({"all", -2}, {"current", -1})),
OPT_FLAG("fs-black-out-screens", fs_black_out_screens, 0),
- OPT_FLAG("keepaspect", keepaspect, 0),
+ OPT_FLAG("keepaspect", keepaspect, UPDATE_VIDEOPOS),
OPT_FLAG("keepaspect-window", keepaspect_window, 0),
#if HAVE_X11
OPT_CHOICE("x11-netwm", x11_netwm, 0,
@@ -446,47 +446,47 @@ const m_option_t mp_opts[] = {
OPT_PATHLIST("audio-file-paths", audiofile_paths, 0),
OPT_STRING_APPEND_LIST("external-file", external_files, M_OPT_FILE),
OPT_FLAG("autoload-files", autoload_files, 0),
- OPT_FLOAT("sub-delay", sub_delay, 0),
- OPT_FLOAT("sub-fps", sub_fps, 0),
- OPT_FLOAT("sub-speed", sub_speed, 0),
- OPT_FLAG("sub-visibility", sub_visibility, 0),
- OPT_FLAG("sub-forced-only", forced_subs_only, 0),
- OPT_FLAG("stretch-dvd-subs", stretch_dvd_subs, 0),
- OPT_FLAG("stretch-image-subs-to-screen", stretch_image_subs, 0),
+ OPT_FLOAT("sub-delay", sub_delay, UPDATE_OSD),
+ OPT_FLOAT("sub-fps", sub_fps, UPDATE_OSD),
+ OPT_FLOAT("sub-speed", sub_speed, UPDATE_OSD),
+ OPT_FLAG("sub-visibility", sub_visibility, UPDATE_OSD),
+ OPT_FLAG("sub-forced-only", forced_subs_only, UPDATE_OSD),
+ OPT_FLAG("stretch-dvd-subs", stretch_dvd_subs, UPDATE_OSD),
+ OPT_FLAG("stretch-image-subs-to-screen", stretch_image_subs, UPDATE_OSD),
OPT_FLAG("sub-fix-timing", sub_fix_timing, 0),
OPT_CHOICE("sub-auto", sub_auto, 0,
({"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})),
OPT_CHOICE("audio-file-auto", audiofile_auto, 0,
({"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})),
- OPT_INTRANGE("sub-pos", sub_pos, 0, 0, 100),
- OPT_FLOATRANGE("sub-gauss", sub_gauss, 0, 0.0, 3.0),
- OPT_FLAG("sub-gray", sub_gray, 0),
+ OPT_INTRANGE("sub-pos", sub_pos, UPDATE_OSD, 0, 100),
+ OPT_FLOATRANGE("sub-gauss", sub_gauss, UPDATE_OSD, 0.0, 3.0),
+ OPT_FLAG("sub-gray", sub_gray, UPDATE_OSD),
OPT_FLAG("sub-ass", ass_enabled, 0),
- OPT_FLOATRANGE("sub-scale", sub_scale, 0, 0, 100),
- OPT_FLOATRANGE("ass-line-spacing", ass_line_spacing, 0, -1000, 1000),
- OPT_FLAG("sub-use-margins", sub_use_margins, 0),
- OPT_FLAG("ass-force-margins", ass_use_margins, 0),
- OPT_FLAG("ass-vsfilter-aspect-compat", ass_vsfilter_aspect_compat, 0),
- OPT_CHOICE("ass-vsfilter-color-compat", ass_vsfilter_color_compat, 0,
+ OPT_FLOATRANGE("sub-scale", sub_scale, UPDATE_OSD, 0, 100),
+ OPT_FLOATRANGE("ass-line-spacing", ass_line_spacing, UPDATE_OSD, -1000, 1000),
+ OPT_FLAG("sub-use-margins", sub_use_margins, UPDATE_OSD),
+ OPT_FLAG("ass-force-margins", ass_use_margins, UPDATE_OSD),
+ OPT_FLAG("ass-vsfilter-aspect-compat", ass_vsfilter_aspect_compat, UPDATE_OSD),
+ OPT_CHOICE("ass-vsfilter-color-compat", ass_vsfilter_color_compat, UPDATE_OSD,
({"no", 0}, {"basic", 1}, {"full", 2}, {"force-601", 3})),
- OPT_FLAG("ass-vsfilter-blur-compat", ass_vsfilter_blur_compat, 0),
+ OPT_FLAG("ass-vsfilter-blur-compat", ass_vsfilter_blur_compat, UPDATE_OSD),
OPT_FLAG("embeddedfonts", use_embedded_fonts, 0),
- OPT_STRINGLIST("ass-force-style", ass_force_style_list, 0),
+ OPT_STRINGLIST("ass-force-style", ass_force_style_list, UPDATE_OSD),
OPT_STRING("ass-styles", ass_styles_file, M_OPT_FILE),
- OPT_CHOICE("ass-hinting", ass_hinting, 0,
+ OPT_CHOICE("ass-hinting", ass_hinting, UPDATE_OSD,
({"none", 0}, {"light", 1}, {"normal", 2}, {"native", 3})),
- OPT_CHOICE("ass-shaper", ass_shaper, 0,
+ OPT_CHOICE("ass-shaper", ass_shaper, UPDATE_OSD,
({"simple", 0}, {"complex", 1})),
- OPT_CHOICE("ass-style-override", ass_style_override, 0,
+ OPT_CHOICE("ass-style-override", ass_style_override, UPDATE_OSD,
({"no", 0}, {"yes", 1}, {"force", 3}, {"signfs", 4}, {"strip", 5})),
- OPT_FLAG("sub-scale-by-window", sub_scale_by_window, 0),
- OPT_FLAG("sub-scale-with-window", sub_scale_with_window, 0),
- OPT_FLAG("ass-scale-with-window", ass_scale_with_window, 0),
- OPT_FLAG("osd-bar", osd_bar_visible, 0),
- OPT_FLOATRANGE("osd-bar-align-x", osd_bar_align_x, 0, -1.0, +1.0),
- OPT_FLOATRANGE("osd-bar-align-y", osd_bar_align_y, 0, -1.0, +1.0),
- OPT_FLOATRANGE("osd-bar-w", osd_bar_w, 0, 1, 100),
- OPT_FLOATRANGE("osd-bar-h", osd_bar_h, 0, 0.1, 50),
+ OPT_FLAG("sub-scale-by-window", sub_scale_by_window, UPDATE_OSD),
+ OPT_FLAG("sub-scale-with-window", sub_scale_with_window, UPDATE_OSD),
+ OPT_FLAG("ass-scale-with-window", ass_scale_with_window, UPDATE_OSD),
+ OPT_FLAG("osd-bar", osd_bar_visible, UPDATE_OSD),
+ OPT_FLOATRANGE("osd-bar-align-x", osd_bar_align_x, UPDATE_OSD, -1.0, +1.0),
+ OPT_FLOATRANGE("osd-bar-align-y", osd_bar_align_y, UPDATE_OSD, -1.0, +1.0),
+ OPT_FLOATRANGE("osd-bar-w", osd_bar_w, UPDATE_OSD, 1, 100),
+ OPT_FLOATRANGE("osd-bar-h", osd_bar_h, UPDATE_OSD, 0.1, 50),
OPT_SUBSTRUCT("osd", osd_style, osd_style_conf, 0),
OPT_SUBSTRUCT("sub-text", sub_text_style, sub_style_conf, 0),
OPT_FLAG("sub-clear-on-seek", sub_clear_on_seek, 0),
@@ -557,7 +557,7 @@ const m_option_t mp_opts[] = {
({"0", 0}, {"1", 1}, {"2", 2}, {"3", 3})),
OPT_INTRANGE("osd-duration", osd_duration, 0, 0, 3600000),
OPT_FLAG("osd-fractions", osd_fractions, 0),
- OPT_FLOATRANGE("osd-scale", osd_scale, 0, 0, 100),
+ OPT_FLOATRANGE("osd-scale", osd_scale, UPDATE_OSD, 0, 100),
OPT_FLAG("osd-scale-by-window", osd_scale_by_window, 0),
OPT_DOUBLE("sstep", step_sec, CONF_MIN, 0),
diff --git a/player/command.c b/player/command.c
index bd7380cbec..d6c0f9cf08 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2407,18 +2407,6 @@ static int video_simple_refresh_property(void *ctx, struct m_property *prop,
return r;
}
-// Update options which are managed through VOCTRL_GET/SET_PANSCAN.
-static int panscan_property_helper(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
-
- int r = mp_property_generic_option(mpctx, prop, action, arg);
- if (mpctx->video_out && action == M_PROPERTY_SET)
- vo_control(mpctx->video_out, VOCTRL_SET_PANSCAN, NULL);
- return r;
-}
-
/// Helper to set vo flags.
/** \ingroup PropertyImplHelper
*/
@@ -2985,20 +2973,6 @@ static int mp_property_aspect(void *ctx, struct m_property *prop,
return M_PROPERTY_NOT_IMPLEMENTED;
}
-// For OSD and subtitle related properties using the generic option bridge.
-// - Fail as unavailable if no video is active
-// - Trigger OSD state update when property is set
-static int property_osd_helper(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- if (action == M_PROPERTY_SET) {
- osd_changed(mpctx->osd);
- mp_wakeup_core(mpctx);
- }
- return mp_property_generic_option(mpctx, prop, action, arg);
-}
-
/// Selected subtitles (RW)
static int mp_property_sub(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -3023,7 +2997,7 @@ static int mp_property_sub_delay(void *ctx, struct m_property *prop,
*(char **)arg = format_delay(opts->sub_delay);
return M_PROPERTY_OK;
}
- return property_osd_helper(mpctx, prop, action, arg);
+ return mp_property_generic_option(mpctx, prop, action, arg);
}
/// Subtitle speed (RW)
@@ -3046,7 +3020,7 @@ static int mp_property_sub_speed(void *ctx, struct m_property *prop,
*(char **)arg = talloc_asprintf(NULL, "%4.1f%%", 100 * opts->sub_speed);
return M_PROPERTY_OK;
}
- return property_osd_helper(mpctx, prop, action, arg);
+ return mp_property_generic_option(mpctx, prop, action, arg);
}
static int mp_property_sub_pos(void *ctx, struct m_property *prop,
@@ -3058,7 +3032,7 @@ static int mp_property_sub_pos(void *ctx, struct m_property *prop,
*(char **)arg = talloc_asprintf(NULL, "%d/100", opts->sub_pos);
return M_PROPERTY_OK;
}
- return property_osd_helper(mpctx, prop, action, arg);
+ return mp_property_generic_option(mpctx, prop, action, arg);
}
static int mp_property_sub_text(void *ctx, struct m_property *prop,
@@ -3787,7 +3761,6 @@ static int mp_profile_list(void *ctx, struct m_property *prop,
// Base list of properties. This does not include option-mapped properties.
static const struct m_property mp_properties_base[] = {
// General
- {"osd-scale", property_osd_helper},
{"speed", mp_property_playback_speed},
{"audio-speed-correction", mp_property_av_speed_correction, .priv = "a"},
{"video-speed-correction", mp_property_av_speed_correction, .priv = "v"},
@@ -3901,14 +3874,6 @@ static const struct m_property mp_properties_base[] = {
{"hue", mp_property_video_color},
{"video-output-levels", mp_property_video_color,
.priv = (void *)"output-levels"},
- {"panscan", panscan_property_helper},
- {"keepaspect", panscan_property_helper},
- {"video-zoom", panscan_property_helper},
- {"video-align-x", panscan_property_helper},
- {"video-align-y", panscan_property_helper},
- {"video-pan-x", panscan_property_helper},
- {"video-pan-y", panscan_property_helper},
- {"video-unscaled", panscan_property_helper},
{"video-out-params", mp_property_vo_imgparams},
{"video-params", mp_property_vd_imgparams},
{"video-format", mp_property_video_format},
@@ -3949,13 +3914,6 @@ static const struct m_property mp_properties_base[] = {
{"sub-speed", mp_property_sub_speed},
{"sub-pos", mp_property_sub_pos},
{"sub-text", mp_property_sub_text},
- {"sub-visibility", property_osd_helper},
- {"sub-forced-only", property_osd_helper},
- {"sub-scale", property_osd_helper},
- {"sub-use-margins", property_osd_helper},
- {"ass-force-margins", property_osd_helper},
- {"ass-vsfilter-aspect-compat", property_osd_helper},
- {"ass-style-override", property_osd_helper},
{"vf", mp_property_vf},
{"af", mp_property_af},
@@ -5633,10 +5591,18 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags)
if (flags & UPDATE_TERM)
mp_update_logging(mpctx);
- if (flags & UPDATE_RENDERER) {
- if (mpctx->video_out)
+ if (mpctx->video_out) {
+ if (flags & UPDATE_VIDEOPOS)
+ vo_control(mpctx->video_out, VOCTRL_SET_PANSCAN, NULL);
+
+ if (flags & UPDATE_RENDERER)
vo_control(mpctx->video_out, VOCTRL_UPDATE_RENDER_OPTS, NULL);
}
+
+ if (flags & UPDATE_OSD) {
+ osd_changed(mpctx->osd);
+ mp_wakeup_core(mpctx);
+ }
}
void mp_notify_property(struct MPContext *mpctx, const char *property)
diff --git a/sub/osd.c b/sub/osd.c
index caefd648ce..dfe75b7698 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -81,6 +81,7 @@ const struct m_sub_options osd_style_conf = {
.align_x = -1,
.align_y = -1,
},
+ .change_flags = UPDATE_OSD,
};
const struct m_sub_options sub_style_conf = {
@@ -99,6 +100,7 @@ const struct m_sub_options sub_style_conf = {
.align_x = 0,
.align_y = 1,
},
+ .change_flags = UPDATE_OSD,
};
static bool osd_res_equals(struct mp_osd_res a, struct mp_osd_res b)