diff options
author | wm4 <wm4@nowhere> | 2016-09-19 20:16:44 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-09-19 20:16:44 +0200 |
commit | bf5c97a6c38352d492020cd5d6c7563c709bca9d (patch) | |
tree | 2fc1e558ad3c5fbfa02c119c9ef347330a6e4f77 /options | |
parent | df85c76b7f8711b15e36973518578e0064657b8e (diff) | |
download | mpv-bf5c97a6c38352d492020cd5d6c7563c709bca9d.tar.bz2 mpv-bf5c97a6c38352d492020cd5d6c7563c709bca9d.tar.xz |
options, command: simplify some option updates
Remove wrapper properties for OSD and video position updates, use the
new mechanism for them. We can mark the options directly. Update
behavior will work for more options (since I've casually marked more
affected options than the old less direct mechanism covered).
Diffstat (limited to 'options')
-rw-r--r-- | options/m_option.h | 4 | ||||
-rw-r--r-- | options/options.c | 76 |
2 files changed, 41 insertions, 39 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), |