diff --git a/cfg-common.h b/cfg-common.h index 0ae68d0531..529eeb56aa 100644 --- a/cfg-common.h +++ b/cfg-common.h @@ -608,8 +608,7 @@ const m_option_t common_opts[] = { // scaling: {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL}, {"ssf", (void *) scaler_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, - OPT_FLAG_ON("zoom", softzoom, 0), - OPT_FLAG_OFF("nozoom", softzoom, 0), + OPT_MAKE_FLAGS("zoom", softzoom, 0), OPT_FLOATRANGE("aspect", movie_aspect, 0, 0.2, 3.0), OPT_FLAG_CONSTANTS("noaspect", movie_aspect, 0, 0, 0), OPT_FLOATRANGE("xy", screen_size_xy, 0, 0.001, 4096), @@ -624,8 +623,7 @@ const m_option_t common_opts[] = { {"tskeepbroken", &ts_keep_broken, CONF_TYPE_FLAG, 0, 0, 1, NULL}, // draw by slices or whole frame (useful with libmpeg2/libavcodec) - OPT_FLAG_ON("slices", vd_use_slices, 0), - OPT_FLAG_OFF("noslices", vd_use_slices, 0), + OPT_MAKE_FLAGS("slices", vd_use_slices, 0), {"field-dominance", &field_dominance, CONF_TYPE_INT, CONF_RANGE, -1, 1, NULL}, #ifdef CONFIG_FFMPEG @@ -693,8 +691,7 @@ const m_option_t common_opts[] = { {"subfont-autoscale", &subtitle_autoscale, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL}, #endif #ifdef CONFIG_ASS - OPT_FLAG_ON("ass", ass_enabled, 0), - OPT_FLAG_OFF("noass", ass_enabled, 0), + OPT_MAKE_FLAGS("ass", ass_enabled, 0), {"ass-font-scale", &ass_font_scale, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL}, {"ass-line-spacing", &ass_line_spacing, CONF_TYPE_FLOAT, CONF_RANGE, -1000, 1000, NULL}, {"ass-top-margin", &ass_top_margin, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL}, diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 54282f3f4a..7413d171d4 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -83,10 +83,8 @@ const m_option_t mplayer_opts[]={ CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, OPT_STRINGLIST("vo", video_driver_list, 0), OPT_STRINGLIST("ao", audio_driver_list, 0), - OPT_FLAG_ON("fixed-vo", fixed_vo, CONF_GLOBAL), - OPT_FLAG_OFF("nofixed-vo", fixed_vo, CONF_GLOBAL), - OPT_FLAG_ON("ontop", vo_ontop, 0), - OPT_FLAG_OFF("noontop", vo_ontop, 0), + OPT_MAKE_FLAGS("fixed-vo", fixed_vo, CONF_GLOBAL), + OPT_MAKE_FLAGS("ontop", vo_ontop, 0), {"rootwin", &vo_rootwin, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"border", &vo_border, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"noborder", &vo_border, CONF_TYPE_FLAG, 0, 1, 0, NULL}, @@ -156,8 +154,7 @@ const m_option_t mplayer_opts[]={ OPT_INTRANGE("screenh", vo_screenheight, CONF_OLD, 0, 4096), // Geometry string {"geometry", &vo_geometry, CONF_TYPE_STRING, 0, 0, 0, NULL}, - OPT_FLAG_ON("force-window-position", force_window_position, 0), - OPT_FLAG_OFF("noforce-window-position", force_window_position, 0), + OPT_MAKE_FLAGS("force-window-position", force_window_position, 0), // vo name (X classname) and window title strings OPT_STRING("name", vo_winname, 0), OPT_STRING("title", vo_wintitle, 0), @@ -165,11 +162,9 @@ const m_option_t mplayer_opts[]={ OPT_FLOATRANGE("monitoraspect", force_monitor_aspect, 0, 0.0, 9.0), OPT_FLOATRANGE("monitorpixelaspect", monitor_pixel_aspect, 0, 0.2, 9.0), // video mode switching: (x11,xv,dga) - OPT_FLAG_ON("vm", vidmode, 0), - OPT_FLAG_OFF("novm", vidmode, 0), + OPT_MAKE_FLAGS("vm", vidmode, 0), // start in fullscreen mode: - OPT_FLAG_ON("fs", fullscreen, 0), - OPT_FLAG_OFF("nofs", fullscreen, 0), + OPT_MAKE_FLAGS("fs", fullscreen, 0), // set fullscreen switch method (workaround for buggy WMs) {"fsmode", "-fsmode is obsolete, avoid it and use -fstype instead.\nIf you really want it, try -fsmode-dontuse, but don't report bugs!\n", CONF_TYPE_PRINT, CONF_RANGE, 0, 31, NULL}, {"fsmode-dontuse", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL}, @@ -294,8 +289,7 @@ const m_option_t mplayer_opts[]={ {"dumpjacosub", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 8, NULL}, {"dumpsami", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 9, NULL}, - OPT_FLAG_ON("capture", capture_dump, 0), - OPT_FLAG_OFF("nocapture", capture_dump, 0), + OPT_MAKE_FLAGS("capture", capture_dump, 0), #ifdef CONFIG_LIRC {"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, @@ -309,12 +303,10 @@ const m_option_t mplayer_opts[]={ OPT_INTRANGE("loop", loop_times, 0, -1, 10000), {"playlist", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL}, - OPT_FLAG_ON("ordered-chapters", ordered_chapters, 0), - OPT_FLAG_OFF("noordered-chapters", ordered_chapters, 0), + OPT_MAKE_FLAGS("ordered-chapters", ordered_chapters, 0), // a-v sync stuff: - OPT_FLAG_ON("correct-pts", user_correct_pts, 0), - OPT_FLAG_OFF("nocorrect-pts", user_correct_pts, 0), + OPT_MAKE_FLAGS("correct-pts", user_correct_pts, 0), OPT_INTRANGE("pts-association-mode", user_pts_assoc_mode, 0, 0, 2), {"noautosync", &autosync, CONF_TYPE_FLAG, 0, 0, -1, NULL}, {"autosync", &autosync, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL}, diff --git a/input/input.c b/input/input.c index 658e34f4dc..294e091bf4 100644 --- a/input/input.c +++ b/input/input.c @@ -605,21 +605,16 @@ static const m_option_t input_conf[] = { OPT_STRING("js-dev", input.js_dev, CONF_GLOBAL), OPT_STRING("ar-dev", input.ar_dev, CONF_GLOBAL), OPT_STRING("file", input.in_file, CONF_GLOBAL), - OPT_FLAG_ON("default-bindings", input.default_bindings, CONF_GLOBAL), - OPT_FLAG_OFF("nodefault-bindings", input.default_bindings, CONF_GLOBAL), + OPT_MAKE_FLAGS("default-bindings", input.default_bindings, CONF_GLOBAL), { NULL, NULL, 0, 0, 0, 0, NULL} }; static const m_option_t mp_input_opts[] = { { "input", &input_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, - OPT_FLAG_OFF("nojoystick", input.use_joystick, CONF_GLOBAL), - OPT_FLAG_ON("joystick", input.use_joystick, CONF_GLOBAL), - OPT_FLAG_OFF("nolirc", input.use_lirc, CONF_GLOBAL), - OPT_FLAG_ON("lirc", input.use_lirc, CONF_GLOBAL), - OPT_FLAG_OFF("nolircc", input.use_lircc, CONF_GLOBAL), - OPT_FLAG_ON("lircc", input.use_lircc, CONF_GLOBAL), - OPT_FLAG_OFF("noar", input.use_ar, CONF_GLOBAL), - OPT_FLAG_ON("ar", input.use_ar, CONF_GLOBAL), + OPT_MAKE_FLAGS("joystick", input.use_joystick, CONF_GLOBAL), + OPT_MAKE_FLAGS("lirc", input.use_lirc, CONF_GLOBAL), + OPT_MAKE_FLAGS("lircc", input.use_lircc, CONF_GLOBAL), + OPT_MAKE_FLAGS("ar", input.use_ar, CONF_GLOBAL), { NULL, NULL, 0, 0, 0, 0, NULL} }; diff --git a/m_option.h b/m_option.h index c2c992ec80..26c457e24d 100644 --- a/m_option.h +++ b/m_option.h @@ -533,6 +533,7 @@ int parse_timestring(const char *str, double *time, char endchar); #define OPT_FLAG_ON(optname, varname, flags) {optname, NULL, &m_option_type_flag, flags, 0, 1, NULL, 1, offsetof(struct MPOpts, varname)} #define OPT_FLAG_OFF(optname, varname, flags) {optname, NULL, &m_option_type_flag, flags, 1, 0, NULL, 1, offsetof(struct MPOpts, varname)} +#define OPT_MAKE_FLAGS(optname, varname, flags) OPT_FLAG_ON(optname, varname, flags), OPT_FLAG_OFF("no" optname, varname, flags) #define OPT_FLAG_CONSTANTS(optname, varname, flags, offvalue, value) {optname, NULL, &m_option_type_flag, flags, offvalue, value, NULL, 1, offsetof(struct MPOpts, varname)} #define OPT_STRINGLIST(optname, varname, flags) {optname, NULL, &m_option_type_string_list, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)} #define OPT_INT(optname, varname, flags) {optname, NULL, &m_option_type_int, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)}