summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorChristoph Heinrich <christoph.heinrich@student.tugraz.at>2023-02-20 04:32:50 +0100
committerDudemanguy <random342@airmail.cc>2023-02-21 17:15:17 +0000
commit91cc0d8cf6a2cf264c243ca3b3e99b5fd4044c29 (patch)
tree448b141d92c9ea7636954213b587aaf380fc21db /options
parentb9850a6e8c45f95563a703af7f21dfe1c1ee40b6 (diff)
downloadmpv-91cc0d8cf6a2cf264c243ca3b3e99b5fd4044c29.tar.bz2
mpv-91cc0d8cf6a2cf264c243ca3b3e99b5fd4044c29.tar.xz
options: transition options from OPT_FLAG to OPT_BOOL
c78482045444c488bb7948305d583a55d17cd236 introduced a bool option type as a replacement for the flag type, but didn't actually transition and remove the flag type because it would have been too much mundane work.
Diffstat (limited to 'options')
-rw-r--r--options/options.c267
-rw-r--r--options/options.h182
2 files changed, 223 insertions, 226 deletions
diff --git a/options/options.c b/options/options.c
index 7a4cad5756..41643111f1 100644
--- a/options/options.c
+++ b/options/options.c
@@ -105,25 +105,25 @@ static const struct m_sub_options screenshot_conf = {
static const m_option_t mp_vo_opt_list[] = {
{"vo", OPT_SETTINGSLIST(video_driver_list, &vo_obj_list)},
- {"taskbar-progress", OPT_FLAG(taskbar_progress)},
- {"snap-window", OPT_FLAG(snap_window)},
- {"ontop", OPT_FLAG(ontop)},
+ {"taskbar-progress", OPT_BOOL(taskbar_progress)},
+ {"snap-window", OPT_BOOL(snap_window)},
+ {"ontop", OPT_BOOL(ontop)},
{"ontop-level", OPT_CHOICE(ontop_level, {"window", -1}, {"system", -2},
{"desktop", -3}), M_RANGE(0, INT_MAX)},
- {"border", OPT_FLAG(border)},
- {"fit-border", OPT_FLAG(fit_border),
+ {"border", OPT_BOOL(border)},
+ {"fit-border", OPT_BOOL(fit_border),
.deprecation_message = "the option is ignored and no longer needed"},
- {"on-all-workspaces", OPT_FLAG(all_workspaces)},
+ {"on-all-workspaces", OPT_BOOL(all_workspaces)},
{"geometry", OPT_GEOMETRY(geometry)},
{"autofit", OPT_SIZE_BOX(autofit)},
{"autofit-larger", OPT_SIZE_BOX(autofit_larger)},
{"autofit-smaller", OPT_SIZE_BOX(autofit_smaller)},
{"window-scale", OPT_DOUBLE(window_scale), M_RANGE(0.001, 100)},
- {"window-minimized", OPT_FLAG(window_minimized)},
- {"window-maximized", OPT_FLAG(window_maximized)},
+ {"window-minimized", OPT_BOOL(window_minimized)},
+ {"window-maximized", OPT_BOOL(window_maximized)},
{"focus-on-open", OPT_BOOL(focus_on_open)},
- {"force-render", OPT_FLAG(force_render)},
- {"force-window-position", OPT_FLAG(force_window_position)},
+ {"force-render", OPT_BOOL(force_render)},
+ {"force-window-position", OPT_BOOL(force_window_position)},
{"x11-name", OPT_STRING(winname)},
{"wayland-app-id", OPT_STRING(appid)},
{"monitoraspect", OPT_FLOAT(force_monitor_aspect), M_RANGE(0.0, 9.0)},
@@ -131,7 +131,7 @@ static const m_option_t mp_vo_opt_list[] = {
M_RANGE(1.0/32.0, 32.0)},
{"fullscreen", OPT_BOOL(fullscreen)},
{"fs", OPT_ALIAS("fullscreen")},
- {"native-keyrepeat", OPT_FLAG(native_keyrepeat)},
+ {"native-keyrepeat", OPT_BOOL(native_keyrepeat)},
{"panscan", OPT_FLOAT(panscan), M_RANGE(0.0, 1.0)},
{"video-zoom", OPT_FLOAT(zoom), M_RANGE(-20.0, 20.0)},
{"video-pan-x", OPT_FLOAT(pan_x), M_RANGE(-3.0, 3.0)},
@@ -152,10 +152,10 @@ static const m_option_t mp_vo_opt_list[] = {
{"fs-screen", OPT_CHOICE(fsscreen_id, {"all", -2}, {"current", -1}),
M_RANGE(0, 32)},
{"fs-screen-name", OPT_STRING(fsscreen_name)},
- {"keepaspect", OPT_FLAG(keepaspect)},
- {"keepaspect-window", OPT_FLAG(keepaspect_window)},
- {"hidpi-window-scale", OPT_FLAG(hidpi_window_scale)},
- {"native-fs", OPT_FLAG(native_fs)},
+ {"keepaspect", OPT_BOOL(keepaspect)},
+ {"keepaspect-window", OPT_BOOL(keepaspect_window)},
+ {"hidpi-window-scale", OPT_BOOL(hidpi_window_scale)},
+ {"native-fs", OPT_BOOL(native_fs)},
{"override-display-fps", OPT_DOUBLE(override_display_fps),
M_RANGE(0, DBL_MAX)},
{"video-timing-offset", OPT_DOUBLE(timing_offset), M_RANGE(0.0, 1.0)},
@@ -201,14 +201,13 @@ const struct m_sub_options vo_sub_opts = {
.panscan = 0.0f,
.scale_x = 1.0f,
.scale_y = 1.0f,
- .keepaspect = 1,
- .keepaspect_window = 1,
- .hidpi_window_scale = 1,
- .native_fs = 1,
- .taskbar_progress = 1,
- .snap_window = 0,
- .border = 1,
- .fit_border = 1,
+ .keepaspect = true,
+ .keepaspect_window = true,
+ .hidpi_window_scale = true,
+ .native_fs = true,
+ .taskbar_progress = true,
+ .border = true,
+ .fit_border = true,
.appid = "mpv",
.content_type = -1,
.WinID = -1,
@@ -228,18 +227,18 @@ const struct m_sub_options vo_sub_opts = {
const struct m_sub_options mp_sub_filter_opts = {
.opts = (const struct m_option[]){
- {"sub-filter-sdh", OPT_FLAG(sub_filter_SDH)},
- {"sub-filter-sdh-harder", OPT_FLAG(sub_filter_SDH_harder)},
- {"sub-filter-regex-enable", OPT_FLAG(rf_enable)},
- {"sub-filter-regex-plain", OPT_FLAG(rf_plain)},
+ {"sub-filter-sdh", OPT_BOOL(sub_filter_SDH)},
+ {"sub-filter-sdh-harder", OPT_BOOL(sub_filter_SDH_harder)},
+ {"sub-filter-regex-enable", OPT_BOOL(rf_enable)},
+ {"sub-filter-regex-plain", OPT_BOOL(rf_plain)},
{"sub-filter-regex", OPT_STRINGLIST(rf_items)},
{"sub-filter-jsre", OPT_STRINGLIST(jsre_items)},
- {"sub-filter-regex-warn", OPT_FLAG(rf_warn)},
+ {"sub-filter-regex-warn", OPT_BOOL(rf_warn)},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
.defaults = &(OPT_BASE_STRUCT){
- .rf_enable = 1,
+ .rf_enable = true,
},
.change_flags = UPDATE_SUB_FILT,
};
@@ -252,28 +251,28 @@ const struct m_sub_options mp_subtitle_sub_opts = {
{"sub-delay", OPT_FLOAT(sub_delay)},
{"sub-fps", OPT_FLOAT(sub_fps)},
{"sub-speed", OPT_FLOAT(sub_speed)},
- {"sub-visibility", OPT_FLAG(sub_visibility)},
- {"secondary-sub-visibility", OPT_FLAG(sec_sub_visibility)},
+ {"sub-visibility", OPT_BOOL(sub_visibility)},
+ {"secondary-sub-visibility", OPT_BOOL(sec_sub_visibility)},
{"sub-forced-only", OPT_CHOICE(forced_subs_only,
{"auto", -1}, {"no", 0}, {"yes", 1})},
- {"stretch-dvd-subs", OPT_FLAG(stretch_dvd_subs)},
- {"stretch-image-subs-to-screen", OPT_FLAG(stretch_image_subs)},
- {"image-subs-video-resolution", OPT_FLAG(image_subs_video_res)},
- {"sub-fix-timing", OPT_FLAG(sub_fix_timing)},
+ {"stretch-dvd-subs", OPT_BOOL(stretch_dvd_subs)},
+ {"stretch-image-subs-to-screen", OPT_BOOL(stretch_image_subs)},
+ {"image-subs-video-resolution", OPT_BOOL(image_subs_video_res)},
+ {"sub-fix-timing", OPT_BOOL(sub_fix_timing)},
{"sub-pos", OPT_INT(sub_pos), M_RANGE(0, 150)},
{"sub-gauss", OPT_FLOAT(sub_gauss), M_RANGE(0.0, 3.0)},
- {"sub-gray", OPT_FLAG(sub_gray)},
- {"sub-ass", OPT_FLAG(ass_enabled), .flags = UPDATE_SUB_HARD},
+ {"sub-gray", OPT_BOOL(sub_gray)},
+ {"sub-ass", OPT_BOOL(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)},
- {"sub-use-margins", OPT_FLAG(sub_use_margins)},
- {"sub-ass-force-margins", OPT_FLAG(ass_use_margins)},
- {"sub-ass-vsfilter-aspect-compat", OPT_FLAG(ass_vsfilter_aspect_compat)},
+ {"sub-use-margins", OPT_BOOL(sub_use_margins)},
+ {"sub-ass-force-margins", OPT_BOOL(ass_use_margins)},
+ {"sub-ass-vsfilter-aspect-compat", OPT_BOOL(ass_vsfilter_aspect_compat)},
{"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), .flags = UPDATE_SUB_HARD},
+ {"sub-ass-vsfilter-blur-compat", OPT_BOOL(ass_vsfilter_blur_compat)},
+ {"embeddedfonts", OPT_BOOL(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),
@@ -282,39 +281,37 @@ const struct m_sub_options mp_subtitle_sub_opts = {
{"none", 0}, {"light", 1}, {"normal", 2}, {"native", 3})},
{"sub-ass-shaper", OPT_CHOICE(ass_shaper,
{"simple", 0}, {"complex", 1})},
- {"sub-ass-justify", OPT_FLAG(ass_justify)},
+ {"sub-ass-justify", OPT_BOOL(ass_justify)},
{"sub-ass-override", OPT_CHOICE(ass_style_override,
{"no", 0}, {"yes", 1}, {"force", 3}, {"scale", 4}, {"strip", 5})},
- {"sub-scale-by-window", OPT_FLAG(sub_scale_by_window)},
- {"sub-scale-with-window", OPT_FLAG(sub_scale_with_window)},
- {"sub-ass-scale-with-window", OPT_FLAG(ass_scale_with_window)},
+ {"sub-scale-by-window", OPT_BOOL(sub_scale_by_window)},
+ {"sub-scale-with-window", OPT_BOOL(sub_scale_with_window)},
+ {"sub-ass-scale-with-window", OPT_BOOL(ass_scale_with_window)},
{"sub", OPT_SUBSTRUCT(sub_style, sub_style_conf)},
- {"sub-clear-on-seek", OPT_FLAG(sub_clear_on_seek)},
+ {"sub-clear-on-seek", OPT_BOOL(sub_clear_on_seek)},
{"teletext-page", OPT_INT(teletext_page), M_RANGE(1, 999)},
- {"sub-past-video-end", OPT_FLAG(sub_past_video_end)},
+ {"sub-past-video-end", OPT_BOOL(sub_past_video_end)},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
.defaults = &(OPT_BASE_STRUCT){
- .sub_visibility = 1,
- .sec_sub_visibility = 1,
+ .sub_visibility = true,
+ .sec_sub_visibility = true,
.forced_subs_only = -1,
.sub_pos = 100,
.sub_speed = 1.0,
- .ass_enabled = 1,
- .sub_scale_by_window = 1,
- .ass_use_margins = 0,
- .sub_use_margins = 1,
- .ass_scale_with_window = 0,
- .sub_scale_with_window = 1,
+ .ass_enabled = true,
+ .sub_scale_by_window = true,
+ .sub_use_margins = true,
+ .sub_scale_with_window = true,
.teletext_page = 100,
.sub_scale = 1,
- .ass_vsfilter_aspect_compat = 1,
+ .ass_vsfilter_aspect_compat = true,
.ass_vsfilter_color_compat = 1,
- .ass_vsfilter_blur_compat = 1,
+ .ass_vsfilter_blur_compat = true,
.ass_style_override = 1,
.ass_shaper = 1,
- .use_embedded_fonts = 1,
+ .use_embedded_fonts = true,
},
.change_flags = UPDATE_OSD,
};
@@ -330,8 +327,8 @@ const struct m_sub_options mp_osd_render_sub_opts = {
{"osd-bar-h", OPT_FLOAT(osd_bar_h), M_RANGE(0.1, 50)},
{"osd", OPT_SUBSTRUCT(osd_style, osd_style_conf)},
{"osd-scale", OPT_FLOAT(osd_scale), M_RANGE(0, 100)},
- {"osd-scale-by-window", OPT_FLAG(osd_scale_by_window)},
- {"force-rgba-osd-rendering", OPT_FLAG(force_rgba_osd)},
+ {"osd-scale-by-window", OPT_BOOL(osd_scale_by_window)},
+ {"force-rgba-osd-rendering", OPT_BOOL(force_rgba_osd)},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
@@ -340,7 +337,7 @@ const struct m_sub_options mp_osd_render_sub_opts = {
.osd_bar_w = 75.0,
.osd_bar_h = 3.125,
.osd_scale = 1,
- .osd_scale_by_window = 1,
+ .osd_scale_by_window = true,
},
.change_flags = UPDATE_OSD,
};
@@ -366,7 +363,7 @@ const struct m_sub_options dvd_conf = {
const struct m_sub_options filter_conf = {
.opts = (const struct m_option[]){
- {"deinterlace", OPT_FLAG(deinterlace)},
+ {"deinterlace", OPT_BOOL(deinterlace)},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
@@ -393,7 +390,7 @@ static const m_option_t mp_opts[] = {
M_OPT_OPTIONAL_PARAM, .offset = -1},
{ "list-options", &m_option_type_dummy_flag, CONF_NOCFG | M_OPT_NOPROP,
.offset = -1},
- {"list-properties", OPT_FLAG(property_print_help),
+ {"list-properties", OPT_BOOL(property_print_help),
.flags = CONF_NOCFG | M_OPT_NOPROP},
{ "help", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_NOPROP | M_OPT_OPTIONAL_PARAM,
.offset = -1},
@@ -412,22 +409,22 @@ static const m_option_t mp_opts[] = {
{"cplayer", 0}, {"pseudo-gui", 1}),
.flags = M_OPT_PRE_PARSE | M_OPT_NOPROP},
- {"shuffle", OPT_FLAG(shuffle)},
+ {"shuffle", OPT_BOOL(shuffle)},
// ------------------------- common options --------------------
- {"quiet", OPT_FLAG(quiet)},
- {"really-quiet", OPT_FLAG(msg_really_quiet),
+ {"quiet", OPT_BOOL(quiet)},
+ {"really-quiet", OPT_BOOL(msg_really_quiet),
.flags = CONF_PRE_PARSE | UPDATE_TERM},
- {"terminal", OPT_FLAG(use_terminal), .flags = CONF_PRE_PARSE | UPDATE_TERM},
+ {"terminal", OPT_BOOL(use_terminal), .flags = CONF_PRE_PARSE | UPDATE_TERM},
{"msg-level", OPT_MSGLEVELS(msg_levels),
.flags = CONF_PRE_PARSE | UPDATE_TERM},
{"dump-stats", OPT_STRING(dump_stats),
.flags = UPDATE_TERM | CONF_PRE_PARSE | M_OPT_FILE},
- {"msg-color", OPT_FLAG(msg_color), .flags = CONF_PRE_PARSE | UPDATE_TERM},
+ {"msg-color", OPT_BOOL(msg_color), .flags = CONF_PRE_PARSE | UPDATE_TERM},
{"log-file", OPT_STRING(log_file),
.flags = CONF_PRE_PARSE | M_OPT_FILE | UPDATE_TERM},
- {"msg-module", OPT_FLAG(msg_module), .flags = UPDATE_TERM},
- {"msg-time", OPT_FLAG(msg_time), .flags = UPDATE_TERM},
+ {"msg-module", OPT_BOOL(msg_module), .flags = UPDATE_TERM},
+ {"msg-time", OPT_BOOL(msg_time), .flags = UPDATE_TERM},
#if HAVE_WIN32_DESKTOP
{"priority", OPT_CHOICE(w32_priority,
{"no", 0},
@@ -439,7 +436,7 @@ static const m_option_t mp_opts[] = {
{"idle", IDLE_PRIORITY_CLASS}),
.flags = UPDATE_PRIORITY},
#endif
- {"config", OPT_FLAG(load_config), .flags = CONF_PRE_PARSE},
+ {"config", OPT_BOOL(load_config), .flags = CONF_PRE_PARSE},
{"config-dir", OPT_STRING(force_configdir),
.flags = CONF_NOCFG | CONF_PRE_PARSE | M_OPT_FILE},
{"reset-on-next-file", OPT_STRINGLIST(reset_options)},
@@ -448,16 +445,16 @@ static const m_option_t mp_opts[] = {
{"scripts", OPT_PATHLIST(script_files), .flags = M_OPT_FILE},
{"script", OPT_CLI_ALIAS("scripts-append")},
{"script-opts", OPT_KEYVALUELIST(script_opts)},
- {"load-scripts", OPT_FLAG(auto_load_scripts)},
+ {"load-scripts", OPT_BOOL(auto_load_scripts)},
#endif
#if HAVE_LUA
- {"osc", OPT_FLAG(lua_load_osc), .flags = UPDATE_BUILTIN_SCRIPTS},
- {"ytdl", OPT_FLAG(lua_load_ytdl), .flags = UPDATE_BUILTIN_SCRIPTS},
+ {"osc", OPT_BOOL(lua_load_osc), .flags = UPDATE_BUILTIN_SCRIPTS},
+ {"ytdl", OPT_BOOL(lua_load_ytdl), .flags = UPDATE_BUILTIN_SCRIPTS},
{"ytdl-format", OPT_STRING(lua_ytdl_format)},
{"ytdl-raw-options", OPT_KEYVALUELIST(lua_ytdl_raw_options)},
- {"load-stats-overlay", OPT_FLAG(lua_load_stats),
+ {"load-stats-overlay", OPT_BOOL(lua_load_stats),
.flags = UPDATE_BUILTIN_SCRIPTS},
- {"load-osd-console", OPT_FLAG(lua_load_console),
+ {"load-osd-console", OPT_BOOL(lua_load_console),
.flags = UPDATE_BUILTIN_SCRIPTS},
{"load-auto-profiles",
OPT_CHOICE(lua_load_auto_profiles, {"no", 0}, {"yes", 1}, {"auto", -1}),
@@ -485,7 +482,7 @@ static const m_option_t mp_opts[] = {
{"play-dir", OPT_CHOICE(play_dir,
{"forward", 1}, {"+", 1}, {"backward", -1}, {"-", -1})},
- {"rebase-start-time", OPT_FLAG(rebase_start_time)},
+ {"rebase-start-time", OPT_BOOL(rebase_start_time)},
{"ab-loop-a", OPT_TIME(ab_loop[0]), .flags = M_OPT_ALLOW_NO},
{"ab-loop-b", OPT_TIME(ab_loop[1]), .flags = M_OPT_ALLOW_NO},
@@ -495,12 +492,12 @@ static const m_option_t mp_opts[] = {
{"playlist-start", OPT_CHOICE(playlist_pos, {"auto", -1}, {"no", -1}),
M_RANGE(0, INT_MAX)},
- {"pause", OPT_FLAG(pause)},
+ {"pause", OPT_BOOL(pause)},
{"keep-open", OPT_CHOICE(keep_open,
{"no", 0},
{"yes", 1},
{"always", 2})},
- {"keep-open-pause", OPT_FLAG(keep_open_pause)},
+ {"keep-open-pause", OPT_BOOL(keep_open_pause)},
{"image-display-duration", OPT_DOUBLE(image_display_duration),
M_RANGE(0, INFINITY)},
@@ -518,8 +515,8 @@ static const m_option_t mp_opts[] = {
{"alang", OPT_STRINGLIST(stream_lang[STREAM_AUDIO])},
{"slang", OPT_STRINGLIST(stream_lang[STREAM_SUB])},
{"vlang", OPT_STRINGLIST(stream_lang[STREAM_VIDEO])},
- {"track-auto-selection", OPT_FLAG(stream_auto_sel)},
- {"subs-with-matching-audio", OPT_FLAG(subs_with_matching_audio)},
+ {"track-auto-selection", OPT_BOOL(stream_auto_sel)},
+ {"subs-with-matching-audio", OPT_BOOL(subs_with_matching_audio)},
{"lavfi-complex", OPT_STRING(lavfi_complex), .flags = UPDATE_LAVFI_COMPLEX},
@@ -540,12 +537,12 @@ static const m_option_t mp_opts[] = {
{"demuxer", OPT_STRING(demuxer_name), .help = demuxer_help},
{"audio-demuxer", OPT_STRING(audio_demuxer_name), .help = demuxer_help},
{"sub-demuxer", OPT_STRING(sub_demuxer_name), .help = demuxer_help},
- {"demuxer-thread", OPT_FLAG(demuxer_thread)},
+ {"demuxer-thread", OPT_BOOL(demuxer_thread)},
{"demuxer-termination-timeout", OPT_DOUBLE(demux_termination_timeout)},
- {"demuxer-cache-wait", OPT_FLAG(demuxer_cache_wait)},
- {"prefetch-playlist", OPT_FLAG(prefetch_open)},
- {"cache-pause", OPT_FLAG(cache_pause)},
- {"cache-pause-initial", OPT_FLAG(cache_pause_initial)},
+ {"demuxer-cache-wait", OPT_BOOL(demuxer_cache_wait)},
+ {"prefetch-playlist", OPT_BOOL(prefetch_open)},
+ {"cache-pause", OPT_BOOL(cache_pause)},
+ {"cache-pause-initial", OPT_BOOL(cache_pause_initial)},
{"cache-pause-wait", OPT_FLOAT(cache_pause_wait), M_RANGE(0, DBL_MAX)},
{"mf-fps", OPT_DOUBLE(mf_fps)},
@@ -566,7 +563,7 @@ static const m_option_t mp_opts[] = {
{"audio-format", OPT_AUDIOFORMAT(audio_output_format), .flags = UPDATE_AUDIO},
{"speed", OPT_DOUBLE(playback_speed), M_RANGE(0.01, 100.0)},
- {"audio-pitch-correction", OPT_FLAG(pitch_correction)},
+ {"audio-pitch-correction", OPT_BOOL(pitch_correction)},
// set a-v distance
{"audio-delay", OPT_FLOAT(audio_delay)},
@@ -606,7 +603,7 @@ static const m_option_t mp_opts[] = {
{"external-files", OPT_PATHLIST(external_files), .flags = M_OPT_FILE},
{"external-file", OPT_CLI_ALIAS("external-files-append")},
- {"autoload-files", OPT_FLAG(autoload_files)},
+ {"autoload-files", OPT_BOOL(autoload_files)},
{"sub-auto", OPT_CHOICE(sub_auto,
{"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})},
@@ -620,13 +617,13 @@ static const m_option_t mp_opts[] = {
{"", OPT_SUBSTRUCT(subs_filt, mp_sub_filter_opts)},
{"", OPT_SUBSTRUCT(osd_rend, mp_osd_render_sub_opts)},
- {"osd-bar", OPT_FLAG(osd_bar_visible), .flags = UPDATE_OSD},
+ {"osd-bar", OPT_BOOL(osd_bar_visible), .flags = UPDATE_OSD},
//---------------------- libao/libvo options ------------------------
{"", OPT_SUBSTRUCT(ao_opts, ao_conf)},
- {"audio-exclusive", OPT_FLAG(audio_exclusive), .flags = UPDATE_AUDIO},
- {"audio-fallback-to-null", OPT_FLAG(ao_null_fallback)},
- {"audio-stream-silence", OPT_FLAG(audio_stream_silence)},
+ {"audio-exclusive", OPT_BOOL(audio_exclusive), .flags = UPDATE_AUDIO},
+ {"audio-fallback-to-null", OPT_BOOL(ao_null_fallback)},
+ {"audio-stream-silence", OPT_BOOL(audio_stream_silence)},
{"audio-wait-open", OPT_FLOAT(audio_wait_open), M_RANGE(0, 60)},
{"force-window", OPT_CHOICE(force_vo,
{"no", 0}, {"yes", 1}, {"immediate", 2})},
@@ -647,7 +644,7 @@ static const m_option_t mp_opts[] = {
.flags = UPDATE_VOL},
{"replaygain-preamp", OPT_FLOAT(rgain_preamp), .flags = UPDATE_VOL,
M_RANGE(-150, 150)},
- {"replaygain-clip", OPT_FLAG(rgain_clip), .flags = UPDATE_VOL},
+ {"replaygain-clip", OPT_BOOL(rgain_clip), .flags = UPDATE_VOL},
{"replaygain-fallback", OPT_FLOAT(rgain_fallback), .flags = UPDATE_VOL,
M_RANGE(-200, 60)},
{"gapless-audio", OPT_CHOICE(gapless_audio,
@@ -660,7 +657,7 @@ static const m_option_t mp_opts[] = {
{"cursor-autohide", OPT_CHOICE(cursor_autohide_delay,
{"no", -1}, {"always", -2}), M_RANGE(0, 30000)},
- {"cursor-autohide-fs-only", OPT_FLAG(cursor_autohide_fs)},
+ {"cursor-autohide-fs-only", OPT_BOOL(cursor_autohide_fs)},
{"stop-screensaver", OPT_CHOICE(stop_screensaver,
{"no", 0},
{"yes", 1},
@@ -669,7 +666,7 @@ static const m_option_t mp_opts[] = {
{"", OPT_SUBSTRUCT(video_equalizer, mp_csp_equalizer_conf)},
- {"use-filedir-conf", OPT_FLAG(use_filedir_conf)},
+ {"use-filedir-conf", OPT_BOOL(use_filedir_conf)},
{"osd-level", OPT_CHOICE(osd_level,
{"0", 0}, {"1", 1}, {"2", 2}, {"3", 3})},
{"osd-on-seek", OPT_CHOICE(osd_on_seek,
@@ -678,7 +675,7 @@ static const m_option_t mp_opts[] = {
{"msg", 2},
{"msg-bar", 3})},
{"osd-duration", OPT_INT(osd_duration), M_RANGE(0, 3600000)},
- {"osd-fractions", OPT_FLAG(osd_fractions)},
+ {"osd-fractions", OPT_BOOL(osd_fractions)},
{"sstep", OPT_DOUBLE(step_sec), M_RANGE(0, DBL_MAX)},
@@ -687,13 +684,13 @@ static const m_option_t mp_opts[] = {
{"vo", 1},
{"decoder", 2},
{"decoder+vo", 3})},
- {"video-latency-hacks", OPT_FLAG(video_latency_hacks)},
+ {"video-latency-hacks", OPT_BOOL(video_latency_hacks)},
- {"untimed", OPT_FLAG(untimed)},
+ {"untimed", OPT_BOOL(untimed)},
{"stream-dump", OPT_STRING(stream_dump), .flags = M_OPT_FILE},
- {"stop-playback-on-init-failure", OPT_FLAG(stop_playback_on_init_failure)},
+ {"stop-playback-on-init-failure", OPT_BOOL(stop_playback_on_init_failure)},
{"loop-playlist", OPT_CHOICE(loop_times,
{"no", 1},
@@ -707,18 +704,18 @@ static const m_option_t mp_opts[] = {
M_RANGE(0, 10000)},
{"loop", OPT_ALIAS("loop-file")},
- {"resume-playback", OPT_FLAG(position_resume)},
- {"resume-playback-check-mtime", OPT_FLAG(position_check_mtime)},
- {"save-position-on-quit", OPT_FLAG(position_save_on_quit)},
+ {"resume-playback", OPT_BOOL(position_resume)},
+ {"resume-playback-check-mtime", OPT_BOOL(position_check_mtime)},
+ {"save-position-on-quit", OPT_BOOL(position_save_on_quit)},
{"write-filename-in-watch-later-config",
- OPT_FLAG(write_filename_in_watch_later_config)},
+ OPT_BOOL(write_filename_in_watch_later_config)},
{"ignore-path-in-watch-later-config",
- OPT_FLAG(ignore_path_in_watch_later_config)},
+ OPT_BOOL(ignore_path_in_watch_later_config)},
{"watch-later-directory", OPT_STRING(watch_later_directory),
.flags = M_OPT_FILE},
{"watch-later-options", OPT_STRINGLIST(watch_later_options)},
- {"ordered-chapters", OPT_FLAG(ordered_chapters)},
+ {"ordered-chapters", OPT_BOOL(ordered_chapters)},
{"ordered-chapters-files", OPT_STRING(ordered_chapters_files),
.flags = M_OPT_FILE},
{"chapter-merge-threshold", OPT_INT(chapter_merge_threshold),
@@ -728,10 +725,10 @@ static const m_option_t mp_opts[] = {
{"chapters-file", OPT_STRING(chapter_file), .flags = M_OPT_FILE},
- {"merge-files", OPT_FLAG(merge_files)},
+ {"merge-files", OPT_BOOL(merge_files)},
// a-v sync stuff:
- {"initial-audio-sync", OPT_FLAG(initial_audio_sync)},
+ {"initial-audio-sync", OPT_BOOL(initial_audio_sync)},
{"video-sync-max-video-change", OPT_DOUBLE(sync_max_video_change),
M_RANGE(0, DBL_MAX)},
{"video-sync-max-audio-change", OPT_DOUBLE(sync_max_audio_change),
@@ -740,13 +737,13 @@ static const m_option_t mp_opts[] = {
{"hr-seek", OPT_CHOICE(hr_seek,
{"no", -1}, {"absolute", 0}, {"yes", 1}, {"always", 1}, {"default", 2})},
{"hr-seek-demuxer-offset", OPT_FLOAT(hr_seek_demuxer_offset)},
- {"hr-seek-framedrop", OPT_FLAG(hr_seek_framedrop)},
+ {"hr-seek-framedrop", OPT_BOOL(hr_seek_framedrop)},
{"autosync", OPT_CHOICE(autosync, {"no", -1}), M_RANGE(0, 10000)},
{"term-osd", OPT_CHOICE(term_osd,
{"force", 1}, {"auto", 2}, {"no", 0}), .flags = UPDATE_OSD},
- {"term-osd-bar", OPT_FLAG(term_osd_bar), .flags = UPDATE_OSD},
+ {"term-osd-bar", OPT_BOOL(term_osd_bar), .flags = UPDATE_OSD},
{"term-osd-bar-chars", OPT_STRING(term_osd_bar_chars), .flags = UPDATE_OSD},
{"term-title", OPT_STRING(term_title), .flags = UPDATE_OSD},
@@ -760,12 +757,12 @@ static const m_option_t mp_opts[] = {
{"osd-msg2", OPT_STRING(osd_msg[1]), .flags = UPDATE_OSD},
{"osd-msg3", OPT_STRING(osd_msg[2]), .flags = UPDATE_OSD},
- {"video-osd", OPT_FLAG(video_osd), .flags = UPDATE_OSD},
+ {"video-osd", OPT_BOOL(video_osd), .flags = UPDATE_OSD},
{"idle", OPT_CHOICE(player_idle_mode,
{"no", 0}, {"once", 1}, {"yes", 2})},
- {"input-terminal", OPT_FLAG(consolecontrols), .flags = UPDATE_TERM},
+ {"input-terminal", OPT_BOOL(consolecontrols), .flags = UPDATE_TERM},
{"input-ipc-server", OPT_STRING(ipc_path), .flags = M_OPT_FILE},
#if HAVE_POSIX
@@ -973,8 +970,8 @@ static const m_option_t mp_opts[] = {
};
static const struct MPOpts mp_default_opts = {
- .use_terminal = 1,
- .msg_color = 1,
+ .use_terminal = true,
+ .msg_color = true,
.softvol_max = 130,
.softvol_volume = 100,
.softvol_mute = 0,
@@ -982,51 +979,51 @@ static const struct MPOpts mp_default_opts = {
.wintitle = "${?media-title:${media-title}}${!media-title:No file} - mpv",
.stop_screensaver = 1,
.cursor_autohide_delay = 1000,
- .video_osd = 1,
+ .video_osd = true,
.osd_level = 1,
.osd_on_seek = 1,
.osd_duration = 1000,
#if HAVE_LUA
- .lua_load_osc = 1,
- .lua_load_ytdl = 1,
+ .lua_load_osc = true,
+ .lua_load_ytdl = true,
.lua_ytdl_format = NULL,
.lua_ytdl_raw_options = NULL,
- .lua_load_stats = 1,
- .lua_load_console = 1,
+ .lua_load_stats = true,
+ .lua_load_console = true,
.lua_load_auto_profiles = -1,
#endif
- .auto_load_scripts = 1,
+ .auto_load_scripts = true,
.loop_times = 1,
- .ordered_chapters = 1,
+ .ordered_chapters = true,
.chapter_merge_threshold = 100,
.chapter_seek_threshold = 5.0,
.hr_seek = 2,
- .hr_seek_framedrop = 1,
+ .hr_seek_framedrop = true,
.sync_max_video_change = 1,
.sync_max_audio_change = 0.125,
.sync_max_factor = 5,
- .load_config = 1,
- .position_resume = 1,
- .autoload_files = 1,
- .demuxer_thread = 1,
+ .load_config = true,
+ .position_resume = true,
+ .autoload_files = true,
+ .demuxer_thread = true,
.demux_termination_timeout = 0.1,
.hls_bitrate = INT_MAX,
- .cache_pause = 1,
+ .cache_pause = true,
.cache_pause_wait = 1.0,
.ab_loop = {MP_NOPTS_VALUE, MP_NOPTS_VALUE},
.ab_loop_count = -1,
.edition_id = -1,
.default_max_pts_correction = -1,
- .initial_audio_sync = 1,
+ .initial_audio_sync = true,
.frame_dropping = 1,
.term_osd = 2,
.term_osd_bar_chars = "[-+-]",
- .consolecontrols = 1,
+ .consolecontrols = true,
.playlist_pos = -1,
.play_frames = -1,
- .rebase_start_time = 1,
+ .rebase_start_time = true,
.keep_open = 0,
- .keep_open_pause = 1,
+ .keep_open_pause = true,
.image_display_duration = 1.0,
.stream_id = { { [STREAM_AUDIO] = -1,
[STREAM_VIDEO] = -1,
@@ -1034,17 +1031,17 @@ static const struct MPOpts mp_default_opts = {
{ [STREAM_AUDIO] = -2,
[STREAM_VIDEO] = -2,
[STREAM_SUB] = -2, }, },
- .stream_auto_sel = 1,
- .subs_with_matching_audio = 1,
+ .stream_auto_sel = true,
+ .subs_with_matching_audio = true,
.audio_display = 1,
.audio_output_format = 0, // AF_FORMAT_UNKNOWN
.playback_speed = 1.,
- .pitch_correction = 1,
+ .pitch_correction = true,
.sub_auto = 0,
.audiofile_auto = -1,
.coverart_auto = 0,
.coverart_whitelist = true,
- .osd_bar_visible = 1,
+ .osd_bar_visible = true,
.screenshot_template = "mpv-shot%n",
.play_dir = 1,
diff --git a/options/options.h b/options/options.h
index 86e95dc826..2830a7a14d 100644
--- a/options/options.h
+++ b/options/options.h
@@ -9,16 +9,16 @@
typedef struct mp_vo_opts {
struct m_obj_settings *video_driver_list;
- int taskbar_progress;
- int snap_window;
- int ontop;
+ bool taskbar_progress;
+ bool snap_window;
+ bool ontop;
int ontop_level;
bool fullscreen;
- int border;
- int fit_border;
- int all_workspaces;
- int window_minimized;
- int window_maximized;
+ bool border;
+ bool fit_border;
+ bool all_workspaces;
+ bool window_minimized;
+ bool window_maximized;
bool focus_on_open;
int screen_id;
@@ -31,7 +31,7 @@ typedef struct mp_vo_opts {
int x11_netwm;
int x11_bypass_compositor;
int x11_present;
- int native_keyrepeat;
+ bool native_keyrepeat;
float panscan;
float zoom;
@@ -48,17 +48,17 @@ typedef struct mp_vo_opts {
struct m_geometry autofit_smaller;
double window_scale;
- int keepaspect;
- int keepaspect_window;
- int hidpi_window_scale;
- int native_fs;
+ bool keepaspect;
+ bool keepaspect_window;
+ bool hidpi_window_scale;
+ bool native_fs;
int64_t WinID;
float force_monitor_aspect;
float monitor_pixel_aspect;
- int force_render;
- int force_window_position;
+ bool force_render;
+ bool force_window_position;
char *mmcss_profile;
@@ -73,52 +73,52 @@ typedef struct mp_vo_opts {
// Subtitle options needed by the subtitle decoders/renderers.
struct mp_subtitle_opts {
- int sub_visibility;
- int sec_sub_visibility;
+ bool sub_visibility;
+ bool sec_sub_visibility;
int sub_pos;
float sub_delay;
float sub_fps;
float sub_speed;
int forced_subs_only;
int forced_subs_only_current;
- int stretch_dvd_subs;
- int stretch_image_subs;
- int image_subs_video_res;
- int sub_fix_timing;
- int sub_scale_by_window;
- int sub_scale_with_window;
- int ass_scale_with_window;
+ bool stretch_dvd_subs;
+ bool stretch_image_subs;
+ bool image_subs_video_res;
+ bool sub_fix_timing;
+ bool sub_scale_by_window;
+ bool sub_scale_with_window;
+ bool ass_scale_with_window;
struct osd_style_opts *sub_style;
float sub_scale;
float sub_gauss;
- int sub_gray;
- int ass_enabled;
+ bool sub_gray;
+ bool ass_enabled;
float ass_line_spacing;
- int ass_use_margins;
- int sub_use_margins;
- int ass_vsfilter_aspect_compat;
+ bool ass_use_margins;
+ bool sub_use_margins;
+ bool ass_vsfilter_aspect_compat;
int ass_vsfilter_color_compat;
- int ass_vsfilter_blur_compat;
- int use_embedded_fonts;
+ bool ass_vsfilter_blur_compat;
+ bool use_embedded_fonts;
char **ass_force_style_list;
char *ass_styles_file;
int ass_style_override;
int ass_hinting;
int ass_shaper;
- int ass_justify;
- int sub_clear_on_seek;
+ bool ass_justify;
+ bool sub_clear_on_seek;
int teletext_page;
- int sub_past_video_end;
+ bool sub_past_video_end;
};
struct mp_sub_filter_opts {
- int sub_filter_SDH;
- int sub_filter_SDH_harder;
- int rf_enable;
- int rf_plain;
+ bool sub_filter_SDH;
+ bool sub_filter_SDH_harder;
+ bool rf_enable;
+ bool rf_plain;
char **rf_items;
char **jsre_items;
- int rf_warn;
+ bool rf_warn;
};
struct mp_osd_render_opts {
@@ -127,21 +127,21 @@ struct mp_osd_render_opts {
float osd_bar_w;
float osd_bar_h;
float osd_scale;
- int osd_scale_by_window;
+ bool osd_scale_by_window;
struct osd_style_opts *osd_style;
- int force_rgba_osd;
+ bool force_rgba_osd;
};
typedef struct MPOpts {
- int property_print_help;
- int use_terminal;
+ bool property_print_help;
+ bool use_terminal;
char *dump_stats;
int verbose;
- int msg_really_quiet;
+ bool msg_really_quiet;
char **msg_levels;
- int msg_color;
- int msg_module;
- int msg_time;
+ bool msg_color;
+ bool msg_module;
+ bool msg_time;
char *log_file;
char *test_mode;
@@ -150,25 +150,25 @@ typedef struct MPOpts {
char **reset_options;
char **script_files;
char **script_opts;
- int lua_load_osc;
- int lua_load_ytdl;
+ bool lua_load_osc;
+ bool lua_load_ytdl;
char *lua_ytdl_format;
char **lua_ytdl_raw_options;
- int lua_load_stats;
- int lua_load_console;
+ bool lua_load_stats;
+ bool lua_load_console;
int lua_load_auto_profiles;
- int auto_load_scripts;
+ bool auto_load_scripts;
- int audio_exclusive;
- int ao_null_fallback;
- int audio_stream_silence;
+ bool audio_exclusive;
+ bool ao_null_fallback;
+ bool audio_stream_silence;
float audio_wait_open;
int force_vo;
float softvol_volume;
int rgain_mode;
float rgain_preamp; // Set replaygain pre-amplification
- int rgain_clip; // Enable/disable clipping prevention
+ bool rgain_clip; // Enable/disable clipping prevention
float rgain_fallback;
int softvol_mute;
float softvol_max;
@@ -184,7 +184,7 @@ typedef struct MPOpts {
int stop_screensaver;
int cursor_autohide_delay;
- int cursor_autohide_fs;
+ bool cursor_autohide_fs;
struct mp_subtitle_opts *subs_rend;
struct mp_sub_filter_opts *subs_filt;
@@ -192,43 +192,43 @@ typedef struct MPOpts {
int osd_level;
int osd_duration;
- int osd_fractions;
+ bool osd_fractions;
int osd_on_seek;
- int video_osd;
+ bool video_osd;
- int untimed;
+ bool untimed;
char *stream_dump;
char *record_file;
- int stop_playback_on_init_failure;
+ bool stop_playback_on_init_failure;
int loop_times;
int loop_file;
- int shuffle;
- int ordered_chapters;
+ bool shuffle;
+ bool ordered_chapters;
char *ordered_chapters_files;
int chapter_merge_threshold;
double chapter_seek_threshold;
char *chapter_file;
- int merge_files;
- int quiet;
- int load_config;
+ bool merge_files;
+ bool quiet;
+ bool load_config;
char *force_configdir;
- int use_filedir_conf;
+ bool use_filedir_conf;
int hls_bitrate;
int edition_id;
- int initial_audio_sync;
+ bool initial_audio_sync;
double sync_max_video_change;
double sync_max_audio_change;
int sync_max_factor;
int hr_seek;
float hr_seek_demuxer_offset;
- int hr_seek_framedrop;
+ bool hr_seek_framedrop;
float audio_delay;
float default_max_pts_correction;
int autosync;
int frame_dropping;
- int video_latency_hacks;
+ bool video_latency_hacks;
int term_osd;
- int term_osd_bar;
+ bool term_osd_bar;
char *term_osd_bar_chars;
char *term_title;
char *playing_msg;
@@ -238,47 +238,47 @@ typedef struct MPOpts {
char *osd_status_msg;
char *osd_msg[3];
int player_idle_mode;
- int consolecontrols;
+ bool consolecontrols;
int playlist_pos;
struct m_rel_time play_start;
struct m_rel_time play_end;
struct m_rel_time play_length;
int play_dir;
- int rebase_start_time;
+ bool rebase_start_time;
int play_frames;
double ab_loop[2];
int ab_loop_count;
double step_sec;
- int position_resume;
- int position_check_mtime;
- int position_save_on_quit;
- int write_filename_in_watch_later_config;
- int ignore_path_in_watch_later_config;
+ bool position_resume;
+ bool position_check_mtime;
+ bool position_save_on_quit;
+ bool write_filename_in_watch_later_config;
+ bool ignore_path_in_watch_later_config;
char *watch_later_directory;
char **watch_later_options;
- int pause;
+ bool pause;
int keep_open;
- int keep_open_pause;
+ bool keep_open_pause;
double image_display_duration;
char *lavfi_complex;
int stream_id[2][STREAM_TYPE_COUNT];
char **stream_lang[STREAM_TYPE_COUNT];
- int stream_auto_sel;
- int subs_with_matching_audio;
+ bool stream_auto_sel;
+ bool subs_with_matching_audio;