diff options
author | Christoph Heinrich <christoph.heinrich@student.tugraz.at> | 2023-02-20 04:32:50 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-02-21 17:15:17 +0000 |
commit | 91cc0d8cf6a2cf264c243ca3b3e99b5fd4044c29 (patch) | |
tree | 448b141d92c9ea7636954213b587aaf380fc21db /video/out | |
parent | b9850a6e8c45f95563a703af7f21dfe1c1ee40b6 (diff) | |
download | mpv-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 'video/out')
29 files changed, 121 insertions, 129 deletions
diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift index 5c312cbff0..03b263cf99 100644 --- a/video/out/cocoa_cb_common.swift +++ b/video/out/cocoa_cb_common.swift @@ -202,7 +202,7 @@ class CocoaCB: Common { func shutdown(_ destroy: Bool = false) { isShuttingDown = window?.isAnimating ?? false || - window?.isInFullscreen ?? false && Bool(mpv?.opts.native_fs ?? 1) + window?.isInFullscreen ?? false && mpv?.opts.native_fs ?? true if window?.isInFullscreen ?? false && !(window?.isAnimating ?? false) { window?.close() } diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c index b96039fe55..2d736203fd 100644 --- a/video/out/d3d11/context.c +++ b/video/out/d3d11/context.c @@ -34,12 +34,12 @@ static int d3d11_validate_adapter(struct mp_log *log, struct d3d11_opts { int feature_level; int warp; - int flip; + bool flip; int sync_interval; char *adapter_name; int output_format; int color_space; - int exclusive_fs; + bool exclusive_fs; }; #define OPT_BASE_STRUCT struct d3d11_opts @@ -59,7 +59,7 @@ const struct m_sub_options d3d11_conf = { {"9_3", D3D_FEATURE_LEVEL_9_3}, {"9_2", D3D_FEATURE_LEVEL_9_2}, {"9_1", D3D_FEATURE_LEVEL_9_1})}, - {"d3d11-flip", OPT_FLAG(flip)}, + {"d3d11-flip", OPT_BOOL(flip)}, {"d3d11-sync-interval", OPT_INT(sync_interval), M_RANGE(0, 4)}, {"d3d11-adapter", OPT_STRING_VALIDATE(adapter_name, d3d11_validate_adapter)}, @@ -75,18 +75,17 @@ const struct m_sub_options d3d11_conf = { {"linear", DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709}, {"pq", DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020}, {"bt.2020", DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020})}, - {"d3d11-exclusive-fs", OPT_FLAG(exclusive_fs)}, + {"d3d11-exclusive-fs", OPT_BOOL(exclusive_fs)}, {0} }, .defaults = &(const struct d3d11_opts) { .feature_level = D3D_FEATURE_LEVEL_12_1, .warp = -1, - .flip = 1, + .flip = true, .sync_interval = 1, .adapter_name = NULL, .output_format = DXGI_FORMAT_UNKNOWN, .color_space = -1, - .exclusive_fs = 0, }, .size = sizeof(struct d3d11_opts) }; @@ -222,7 +221,6 @@ static bool d3d11_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo) *out_fbo = (struct ra_fbo) { .tex = p->backbuffer, - .flip = false, .color_space = p->swapchain_csp }; return true; diff --git a/video/out/d3d11/hwdec_d3d11va.c b/video/out/d3d11/hwdec_d3d11va.c index 1bce9a5cd7..a080e5f618 100644 --- a/video/out/d3d11/hwdec_d3d11va.c +++ b/video/out/d3d11/hwdec_d3d11va.c @@ -28,17 +28,16 @@ #include "video/out/gpu/hwdec.h" struct d3d11va_opts { - int zero_copy; + bool zero_copy; }; #define OPT_BASE_STRUCT struct d3d11va_opts const struct m_sub_options d3d11va_conf = { .opts = (const struct m_option[]) { - {"d3d11va-zero-copy", OPT_FLAG(zero_copy)}, + {"d3d11va-zero-copy", OPT_BOOL(zero_copy)}, {0} }, .defaults = &(const struct d3d11va_opts) { - .zero_copy = 0, }, .size = sizeof(struct d3d11va_opts) }; diff --git a/video/out/gpu/context.c b/video/out/gpu/context.c index a145e2dc98..e41dd99476 100644 --- a/video/out/gpu/context.c +++ b/video/out/gpu/context.c @@ -269,8 +269,8 @@ const struct m_sub_options ra_ctx_conf = { {"gpu-api", OPT_STRING_VALIDATE(context_type, ra_ctx_validate_api), .help = ra_ctx_api_help}, - {"gpu-debug", OPT_FLAG(debug)}, - {"gpu-sw", OPT_FLAG(allow_sw)}, + {"gpu-debug", OPT_BOOL(debug)}, + {"gpu-sw", OPT_BOOL(allow_sw)}, {0} }, .size = sizeof(struct ra_ctx_opts), diff --git a/video/out/gpu/context.h b/video/out/gpu/context.h index dae95fa666..a7510c2afd 100644 --- a/video/out/gpu/context.h +++ b/video/out/gpu/context.h @@ -6,9 +6,9 @@ #include "ra.h" struct ra_ctx_opts { - int allow_sw; // allow software renderers + bool allow_sw; // allow software renderers int want_alpha; // create an alpha framebuffer if possible - int debug; // enable debugging layers/callbacks etc. + bool debug; // enable debugging layers/callbacks etc. bool probing; // the backend was auto-probed char *context_name; // filter by `ra_ctx_fns.name` char *context_type; // filter by `ra_ctx_fns.type` diff --git a/video/out/gpu/lcms.c b/video/out/gpu/lcms.c index 3df5eba5f2..bbf857d968 100644 --- a/video/out/gpu/lcms.c +++ b/video/out/gpu/lcms.c @@ -491,9 +491,9 @@ static int validate_3dlut_size_opt(struct mp_log *log, const m_option_t *opt, #define OPT_BASE_STRUCT struct mp_icc_opts const struct m_sub_options mp_icc_conf = { .opts = (const m_option_t[]) { - {"use-embedded-icc-profile", OPT_FLAG(use_embedded)}, + {"use-embedded-icc-profile", OPT_BOOL(use_embedded)}, {"icc-profile", OPT_STRING(profile), .flags = M_OPT_FILE}, - {"icc-profile-auto", OPT_FLAG(profile_auto)}, + {"icc-profile-auto", OPT_BOOL(profile_auto)}, {"icc-cache-dir", OPT_STRING(cache_dir), .flags = M_OPT_FILE}, {"icc-intent", OPT_INT(intent)}, {"icc-force-contrast", OPT_CHOICE(contrast, {"no", 0}, {"inf", -1}), diff --git a/video/out/gpu/lcms.h b/video/out/gpu/lcms.h index 62b2437194..bd4b16175a 100644 --- a/video/out/gpu/lcms.h +++ b/video/out/gpu/lcms.h @@ -10,9 +10,9 @@ extern const struct m_sub_options mp_icc_conf; struct mp_icc_opts { - int use_embedded; + bool use_embedded; char *profile; - int profile_auto; + bool profile_auto; char *cache_dir; char *size_str; int intent; diff --git a/video/out/gpu/user_shaders.c b/video/out/gpu/user_shaders.c index 708de87485..03842377f8 100644 --- a/video/out/gpu/user_shaders.c +++ b/video/out/gpu/user_shaders.c @@ -170,7 +170,6 @@ static bool parse_hook(struct mp_log *log, struct bstr *body, *out = (struct gl_user_shader_hook){ .pass_desc = bstr0("(unknown)"), .offset = identity_trans, - .align_offset = false, .width = {{ SZEXP_VAR_W, { .varname = bstr0("HOOKED") }}}, .height = {{ SZEXP_VAR_H, { .varname = bstr0("HOOKED") }}}, .cond = {{ SZEXP_CONST, { .cval = 1.0 }}}, diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index b94f4d85be..90b22dab23 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -25,6 +25,7 @@ #include <libavutil/common.h> #include <libavutil/lfg.h> +#include "options/m_option.h" #include "video.h" #include "misc/bstr.h" @@ -312,7 +313,7 @@ static const struct gl_video_opts gl_video_opts_def = { {{"mitchell", .params={NAN, NAN}}, {.params = {NAN, NAN}}, .clamp = 1, }, // tscale }, - .scaler_resizes_only = 1, + .scaler_resizes_only = true, .scaler_lut_size = 6, .interpolation_threshold = 0.01, .alpha_mode = ALPHA_BLEND_TILES, @@ -368,7 +369,7 @@ const struct m_sub_options gl_video_conf = { {"auto", 0}, {"yes", 1}, {"no", -1})}, {"gamma-factor", OPT_FLOAT(gamma), M_RANGE(0.1, 2.0), .deprecation_message = "no replacement"}, - {"gamma-auto", OPT_FLAG(gamma_auto), + {"gamma-auto", OPT_BOOL(gamma_auto), .deprecation_message = "no replacement"}, {"target-prim", OPT_CHOICE_C(target_prim, mp_csp_prim_names)}, {"target-trc", OPT_CHOICE_C(target_trc, mp_csp_trc_names)}, @@ -388,7 +389,7 @@ const struct m_sub_options gl_video_conf = { {"st2094-40", TONE_MAPPING_ST2094_40}, {"st2094-10", TONE_MAPPING_ST2094_10})}, {"tone-mapping-param", OPT_FLOATDEF(tone_map.curve_param)}, - {"inverse-tone-mapping", OPT_FLAG(tone_map.inverse)}, + {"inverse-tone-mapping", OPT_BOOL(tone_map.inverse)}, {"tone-mapping-crosstalk", OPT_FLOAT(tone_map.crosstalk), M_RANGE(0.0, 0.3)}, {"tone-mapping-max-boost", OPT_FLOAT(tone_map.max_boost), @@ -399,7 +400,7 @@ const struct m_sub_options gl_video_conf = { {"max", TONE_MAP_MODE_MAX}, {"hybrid", TONE_MAP_MODE_HYBRID}, {"luma", TONE_MAP_MODE_LUMA})}, - {"tone-mapping-visualize", OPT_FLAG(tone_map.visualize)}, + {"tone-mapping-visualize", OPT_BOOL(tone_map.visualize)}, {"gamut-mapping-mode", OPT_CHOICE(tone_map.gamut_mode, {"auto", GAMUT_AUTO}, {"clip", GAMUT_CLIP}, @@ -416,17 +417,17 @@ const struct m_sub_options gl_video_conf = { M_RANGE(0, 20.0)}, {"hdr-scene-threshold-high", OPT_FLOAT(tone_map.scene_threshold_high), M_RANGE(0, 20.0)}, - {"opengl-pbo", OPT_FLAG(pbo)}, + {"opengl-pbo", OPT_BOOL(pbo)}, SCALER_OPTS("scale", SCALER_SCALE), SCALER_OPTS("dscale", SCALER_DSCALE), SCALER_OPTS("cscale", SCALER_CSCALE), SCALER_OPTS("tscale", SCALER_TSCALE), {"scaler-lut-size", OPT_INT(scaler_lut_size), M_RANGE(4, 10)}, - {"scaler-resizes-only", OPT_FLAG(scaler_resizes_only)}, - {"correct-downscaling", OPT_FLAG(correct_downscaling)}, - {"linear-downscaling", OPT_FLAG(linear_downscaling)}, - {"linear-upscaling", OPT_FLAG(linear_upscaling)}, - {"sigmoid-upscaling", OPT_FLAG(sigmoid_upscaling)}, + {"scaler-resizes-only", OPT_BOOL(scaler_resizes_only)}, + {"correct-downscaling", OPT_BOOL(correct_downscaling)}, + {"linear-downscaling", OPT_BOOL(linear_downscaling)}, + {"linear-upscaling", OPT_BOOL(linear_upscaling)}, + {"sigmoid-upscaling", OPT_BOOL(sigmoid_upscaling)}, {"sigmoid-center", OPT_FLOAT(sigmoid_center), M_RANGE(0.0, 1.0)}, {"sigmoid-slope", OPT_FLOAT(sigmoid_slope), M_RANGE(1.0, 20.0)}, {"fbo-format", OPT_STRING(fbo_format)}, @@ -438,7 +439,7 @@ const struct m_sub_options gl_video_conf = { {"error-diffusion", DITHER_ERROR_DIFFUSION}, {"no", DITHER_NONE})}, {"dither-size-fruit", OPT_INT(dither_size), M_RANGE(2, 8)}, - {"temporal-dither", OPT_FLAG(temporal_dither)}, + {"temporal-dither", OPT_BOOL(temporal_dither)}, {"temporal-dither-period", OPT_INT(temporal_dither_period), M_RANGE(1, 128)}, {"error-diffusion", @@ -448,9 +449,9 @@ const struct m_sub_options gl_video_conf = { {"yes", ALPHA_YES}, {"blend", ALPHA_BLEND}, {"blend-tiles", ALPHA_BLEND_TILES})}, - {"opengl-rectangle-textures", OPT_FLAG(use_rectangle)}, + {"opengl-rectangle-textures", OPT_BOOL(use_rectangle)}, {"background", OPT_COLOR(background)}, - {"interpolation", OPT_FLAG(interpolation)}, + {"interpolation", OPT_BOOL(interpolation)}, {"interpolation-threshold", OPT_FLOAT(interpolation_threshold)}, {"blend-subtitles", OPT_CHOICE(blend_subs, {"no", BLEND_SUBS_NO}, @@ -459,7 +460,7 @@ const struct m_sub_options gl_video_conf = { {"glsl-shaders", OPT_PATHLIST(user_shaders), .flags = M_OPT_FILE}, {"glsl-shader", OPT_CLI_ALIAS("glsl-shaders-append")}, {"glsl-shader-opts", OPT_KEYVALUELIST(user_shader_opts)}, - {"deband", OPT_FLAG(deband)}, + {"deband", OPT_BOOL(deband)}, {"deband", OPT_SUBSTRUCT(deband_opts, deband_conf)}, {"sharpen", OPT_FLOAT(unsharp)}, {"gpu-tex-pad-x", OPT_INT(tex_pad_x), M_RANGE(0, 4096)}, @@ -3876,7 +3877,7 @@ static void check_gl_features(struct gl_video *p) // p->opts is a copy => we can just mess with it. p->opts.scaler[n].kernel.name = "bilinear"; if (n == SCALER_TSCALE) - p->opts.interpolation = 0; + p->opts.interpolation = false; } } } @@ -3900,7 +3901,7 @@ static void check_gl_features(struct gl_video *p) MP_WARN(p, "Disabling color management (GLSL version too old).\n"); } if (!have_mglsl && p->opts.deband) { - p->opts.deband = 0; + p->opts.deband = false; MP_WARN(p, "Disabling debanding (GLSL version too old).\n"); } } diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h index 692d261584..0ef4618790 100644 --- a/video/out/gpu/video.h +++ b/video/out/gpu/video.h @@ -122,7 +122,7 @@ struct gl_tone_map_opts { int curve; float curve_param; float max_boost; - int inverse; + bool inverse; float crosstalk; int mode; int compute_peak; @@ -130,7 +130,7 @@ struct gl_tone_map_opts { float scene_threshold_low; float scene_threshold_high; int gamut_mode; - int visualize; + bool visualize; }; struct gl_video_opts { @@ -138,35 +138,35 @@ struct gl_video_opts { struct scaler_config scaler[4]; int scaler_lut_size; float gamma; - int gamma_auto; + bool gamma_auto; int target_prim; int target_trc; int target_peak; struct gl_tone_map_opts tone_map; - int correct_downscaling; - int linear_downscaling; - int linear_upscaling; - int sigmoid_upscaling; + bool correct_downscaling; + bool linear_downscaling; + bool linear_upscaling; + bool sigmoid_upscaling; float sigmoid_center; float sigmoid_slope; - int scaler_resizes_only; - int pbo; + bool scaler_resizes_only; + bool pbo; int dither_depth; int dither_algo; int dither_size; - int temporal_dither; + bool temporal_dither; int temporal_dither_period; char *error_diffusion; char *fbo_format; int alpha_mode; - int use_rectangle; + bool use_rectangle; struct m_color background; - int interpolation; + bool interpolation; float interpolation_threshold; int blend_subs; char **user_shaders; char **user_shader_opts; - int deband; + bool deband; struct deband_opts *deband_opts; float unsharp; int tex_pad_x, tex_pad_y; diff --git a/video/out/mac/common.swift b/video/out/mac/common.swift index 66faf816d0..feb354261c 100644 --- a/video/out/mac/common.swift +++ b/video/out/mac/common.swift @@ -633,7 +633,7 @@ class Common: NSObject { let size = UnsafeBufferPointer(start: sizeData, count: 2) var rect = NSMakeRect(0, 0, CGFloat(size[0]), CGFloat(size[1])) DispatchQueue.main.async { - if let screen = self.window?.currentScreen, !Bool(self.mpv?.opts.hidpi_window_scale ?? 1) { + if let screen = self.window?.currentScreen, !Bool(self.mpv?.opts.hidpi_window_scale ?? true) { rect = screen.convertRectFromBacking(rect) } self.window?.updateSize(rect.size) diff --git a/video/out/mac/gl_layer.swift b/video/out/mac/gl_layer.swift index 6c48004f4f..79df1e9c80 100644 --- a/video/out/mac/gl_layer.swift +++ b/video/out/mac/gl_layer.swift @@ -269,12 +269,12 @@ class GLLayer: CAOpenGLLayer { glBase.insert(CGLPixelFormatAttribute(ver.rawValue), at: 1) var glFormat = [glBase] - if (ccb.libmpv.macOpts.cocoa_cb_10bit_context == 1) { + if ccb.libmpv.macOpts.cocoa_cb_10bit_context { glFormat += [glFormat10Bit] } glFormat += glFormatOptional - if (ccb.libmpv.macOpts.macos_force_dedicated_gpu == 0) { + if !ccb.libmpv.macOpts.macos_force_dedicated_gpu { glFormat += [glFormatAutoGPU] } diff --git a/video/out/mac/window.swift b/video/out/mac/window.swift index 8ae3a6549e..755d4d397f 100644 --- a/video/out/mac/window.swift +++ b/video/out/mac/window.swift @@ -137,7 +137,7 @@ class Window: NSWindow, NSWindowDelegate { setFrame(frame, display: true) } - if Bool(mpv?.opts.native_fs ?? 1) { + if Bool(mpv?.opts.native_fs ?? true) { super.toggleFullScreen(sender) } else { if !isInFullscreen { diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c index 5ec1e487a9..2162c459d6 100644 --- a/video/out/opengl/context.c +++ b/video/out/opengl/context.c @@ -44,8 +44,8 @@ enum { }; struct opengl_opts { - int use_glfinish; - int waitvsync; + bool use_glfinish; + bool waitvsync; int vsync_pattern[2]; int swapinterval; int early_flush; @@ -55,8 +55,8 @@ struct opengl_opts { #define OPT_BASE_STRUCT struct opengl_opts const struct m_sub_options opengl_conf = { .opts = (const struct m_option[]) { - {"opengl-glfinish", OPT_FLAG(use_glfinish)}, - {"opengl-waitvsync", OPT_FLAG(waitvsync)}, + {"opengl-glfinish", OPT_BOOL(use_glfinish)}, + {"opengl-waitvsync", OPT_BOOL(waitvsync)}, {"opengl-swapinterval", OPT_INT(swapinterval)}, {"opengl-check-pattern-a", OPT_INT(vsync_pattern[0])}, {"opengl-check-pattern-b", OPT_INT(vsync_pattern[1])}, diff --git a/video/out/opengl/context_angle.c b/video/out/opengl/context_angle.c index 2784026d1d..ccdca9ff4f 100644 --- a/video/out/opengl/context_angle.c +++ b/video/out/opengl/context_angle.c @@ -53,7 +53,7 @@ struct angle_opts { int d3d11_warp; int d3d11_feature_level; int egl_windowing; - int flip; + bool flip; }; #define OPT_BASE_STRUCT struct angle_opts @@ -76,7 +76,7 @@ const struct m_sub_options angle_conf = { {"auto", -1}, {"no", 0}, {"yes", 1})}, - {"angle-flip", OPT_FLAG(flip)}, + {"angle-flip", OPT_BOOL(flip)}, {"angle-max-frame-latency", OPT_REPLACED("swapchain-depth")}, {"angle-swapchain-length", OPT_REMOVED("controlled by --swapchain-depth")}, {0} @@ -86,7 +86,7 @@ const struct m_sub_options angle_conf = { .d3d11_warp = -1, .d3d11_feature_level = D3D_FEATURE_LEVEL_11_0, .egl_windowing = -1, - .flip = 1, + .flip = true, }, .size = sizeof(struct angle_opts), }; diff --git a/video/out/opengl/libmpv_gl.c b/video/out/opengl/libmpv_gl.c index e916a3c45d..1dcb21231a 100644 --- a/video/out/opengl/libmpv_gl.c +++ b/video/out/opengl/libmpv_gl.c @@ -36,7 +36,6 @@ static int init(struct libmpv_gpu_context *ctx, mpv_render_param *params) p->ra_ctx->log = ctx->log; p->ra_ctx->global = ctx->global; p->ra_ctx->opts = (struct ra_ctx_opts) { - .probing = false, .allow_sw = true, }; @@ -55,8 +54,8 @@ static int init(struct libmpv_gpu_context *ctx, mpv_render_param *params) if (!ra_gl_ctx_init(p->ra_ctx, p->gl, gl_params)) return MPV_ERROR_UNSUPPORTED; - int debug; - mp_read_option_raw(ctx->global, "gpu-debug", &m_option_type_flag, &debug); + bool debug; + mp_read_option_raw(ctx->global, "gpu-debug", &m_option_type_bool, &debug); p->ra_ctx->opts.debug = debug; p->gl->debug_context = debug; ra_gl_set_debug(p->ra_ctx->ra, debug); diff --git a/video/out/placebo/ra_pl.c b/video/out/placebo/ra_pl.c index c7cf19efdc..a008e28c5f 100644 --- a/video/out/placebo/ra_pl.c +++ b/video/out/placebo/ra_pl.c @@ -153,7 +153,6 @@ bool mppl_wrap_tex(struct ra *ra, pl_tex pltex, struct ra_tex *out_tex) .downloadable = pltex->params.host_readable, // These don't exist upstream, so just pick something reasonable .src_linear = pltex->params.format->caps & PL_FMT_CAP_LINEAR, - .src_repeat = false, }, .priv = (void *) pltex, }; diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c index 74e5f7b1fe..2fe26db173 100644 --- a/video/out/vo_direct3d.c +++ b/video/out/vo_direct3d.c @@ -80,12 +80,12 @@ struct d3dtex { typedef struct d3d_priv { struct mp_log *log; - int opt_disable_texture_align; + bool opt_disable_texture_align; // debugging - int opt_force_power_of_2; + bool opt_force_power_of_2; int opt_texture_memory; - int opt_swap_discard; - int opt_exact_backbuffer; + bool opt_swap_discard; + bool opt_exact_backbuffer; struct vo *vo; @@ -1222,16 +1222,16 @@ static void draw_osd(struct vo *vo) #define OPT_BASE_STRUCT d3d_priv static const struct m_option opts[] = { - {"force-power-of-2", OPT_FLAG(opt_force_power_of_2)}, - {"disable-texture-align", OPT_FLAG(opt_disable_texture_align)}, + {"force-power-of-2", OPT_BOOL(opt_force_power_of_2)}, + {"disable-texture-align", OPT_BOOL(opt_disable_texture_align)}, {"texture-memory", OPT_CHOICE(opt_texture_memory, {"default", 0}, {"managed", 1}, {"default-pool", 2}, {"default-pool-shadow", 3}, {"scratch", 4})}, - {"swap-discard", OPT_FLAG(opt_swap_discard)}, - {"exact-backbuffer", OPT_FLAG(opt_exact_backbuffer)}, + {"swap-discard", OPT_BOOL(opt_swap_discard)}, + {"exact-backbuffer", OPT_BOOL(opt_exact_backbuffer)}, {0} }; diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 4c92faff66..060b17a80b 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -147,9 +147,9 @@ struct priv { // Performance data of last frame struct voctrl_performance_data perf; - int delayed_peak; - int inter_preserve; - int target_hint; + bool delayed_peak; + bool inter_preserve; + bool target_hint; }; static void update_render_options(struct vo *vo); @@ -1961,14 +1961,14 @@ const struct vo_driver video_out_gpu_next = { }, .options = (const struct m_option[]) { - {"allow-delayed-peak-detect", OPT_FLAG(delayed_peak)}, - {"interpolation-preserve", OPT_FLAG(inter_preserve)}, + {"allow-delayed-peak-detect", OPT_BOOL(delayed_peak)}, + {"interpolation-preserve", OPT_BOOL(inter_preserve)}, {"lut", OPT_STRING(lut.opt), .flags = M_OPT_FILE}, {"lut-type", OPT_CHOICE_C(lut.type, lut_types)}, {"image-lut", OPT_STRING(image_lut.opt), .flags = M_OPT_FILE}, {"image-lut-type", OPT_CHOICE_C(image_lut.type, lut_types)}, {"target-lut", OPT_STRING(target_lut.opt), .flags = M_OPT_FILE}, - {"target-colorspace-hint", OPT_FLAG(target_hint)}, + {"target-colorspace-hint", OPT_BOOL(target_hint)}, // No `target-lut-type` because we don't support non-RGB targets {0} }, diff --git a/video/out/vo_kitty.c b/video/out/vo_kitty.c index 6a511c8c8e..7d548c7c34 100644 --- a/video/out/vo_kitty.c +++ b/video/out/vo_kitty.c @@ -79,8 +79,8 @@ static inline void write_str(const char *s) struct vo_kitty_opts { int width, height, top, left, rows, cols; - int config_clear, alt_screen; - int use_shm; + bool config_clear, alt_screen; + bool use_shm; }; struct priv { @@ -414,8 +414,8 @@ const struct vo_driver video_out_kitty = { .priv_size = sizeof(struct priv), .priv_defaults = &(const struct priv) { .shm_fd = -1, - .opts.config_clear = 1, - .opts.alt_screen = 1, + .opts.config_clear = true, + .opts.alt_screen = true, }, .options = (const m_option_t[]) { {"width", OPT_INT(opts.width)}, @@ -424,9 +424,9 @@ const struct vo_driver video_out_kitty = { {"left", OPT_INT(opts.left)}, {"rows", OPT_INT(opts.rows)}, {"cols", OPT_INT(opts.cols)}, - {"config-clear", OPT_FLAG(opts.config_clear), }, - {"alt-screen", OPT_FLAG(opts.alt_screen), }, - {"use-shm", OPT_FLAG(opts.use_shm), }, + {"config-clear", OPT_BOOL(opts.config_clear), }, + {"alt-screen", OPT_BOOL(opts.alt_screen), }, + {"use-shm", OPT_BOOL(opts.use_shm), }, {0} }, .options_prefix = "vo-kitty", diff --git a/video/out/vo_rpi.c b/video/out/vo_rpi.c index 0d89cfa4d3..cac3ac2295 100644 --- a/video/out/vo_rpi.c +++ b/video/out/vo_rpi.c @@ -95,8 +95,8 @@ struct priv { int display_nr; int layer; - int background; - int enable_osd; + bool background; + bool enable_osd; }; // Magic alignments (in pixels) expected by the MMAL internals. @@ -916,8 +916,8 @@ fail: static const struct m_option options[] = { {"display", OPT_INT(display_nr)}, {"layer", OPT_INT(layer), OPTDEF_INT(-10)}, - {"background", OPT_FLAG(background)}, - {"osd", OPT_FLAG(enable_osd), OPTDEF_INT(1)}, + {"background", OPT_BOOL(background)}, + {"osd", OPT_BOOL(enable_osd), OPTDEF_INT(1)}, {0}, }; diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c index d47f31df11..4e2c20a681 100644 --- a/video/out/vo_sdl.c +++ b/video/out/vo_sdl.c @@ -192,9 +192,9 @@ struct priv { struct m_config_cache *opts_cache; // options - int allow_sw; - int switch_mode; - int vsync; + bool allow_sw; + bool switch_mode; + bool vsync; }; static bool lock_texture(struct vo *vo, struct mp_image *texmpi) @@ -240,7 +240,7 @@ static bool lock_texture(struct vo *vo, struct mp_image *texmpi) } static bool is_good_renderer(SDL_RendererInfo *ri, - const char *driver_name_wanted, int allow_sw, + const char *driver_name_wanted, bool allow_sw, struct formatmap_entry *osd_format) { if (driver_name_wanted && driver_name_wanted[0]) @@ -975,13 +975,12 @@ const struct vo_driver video_out_sdl = { .priv_size = sizeof(struct priv), .priv_defaults = &(const struct priv) { .renderer_index = -1, - .vsync = 1, - .screensaver_enabled = false, + .vsync = true, }, .options = (const struct m_option []){ - {"sw", OPT_FLAG(allow_sw)}, - {"switch-mode", OPT_FLAG(switch_mode)}, - {"vsync", OPT_FLAG(vsync)}, + {"sw", OPT_BOOL(allow_sw)}, + {"switch-mode", OPT_BOOL(switch_mode)}, + {"vsync", OPT_BOOL(vsync)}, {NULL} }, .preinit = preinit, diff --git a/video/out/vo_sixel.c b/video/out/vo_sixel.c index 77eeb571e6..d052e7dbd9 100644 --- a/video/out/vo_sixel.c +++ b/video/out/vo_sixel.c @@ -51,13 +51,13 @@ struct vo_sixel_opts { int diffuse; int reqcolors; - int fixedpal; + bool fixedpal; int threshold; int width, height, top, left; int pad_y, pad_x; int rows, cols; - int config_clear, alt_screen; - int buffered; + bool config_clear, alt_screen; + bool buffered; }; struct priv { @@ -591,16 +591,15 @@ const struct vo_driver video_out_sixel = { .opts.height = 0, .opts.reqcolors = 256, .opts.threshold = -1, - .opts.fixedpal = 1, + .op |