diff options
author | wm4 <wm4@nowhere> | 2020-03-14 21:28:01 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-03-18 19:52:01 +0100 |
commit | 26f4f18c0629998a9b91e94722d166866d8b80a3 (patch) | |
tree | 16d4891d241d528f63ee99f0017530bba7b3dc8b /video/out | |
parent | cdd6eb0994bc6aeb8aeb0326e5d8c61c06eb38eb (diff) | |
download | mpv-26f4f18c0629998a9b91e94722d166866d8b80a3.tar.bz2 mpv-26f4f18c0629998a9b91e94722d166866d8b80a3.tar.xz |
options: change option macros and all option declarations
Change all OPT_* macros such that they don't define the entire m_option
initializer, and instead expand only to a part of it, which sets certain
fields. This requires changing almost every option declaration, because
they all use these macros. A declaration now always starts with
{"name", ...
followed by designated initializers only (possibly wrapped in macros).
The OPT_* macros now initialize the .offset and .type fields only,
sometimes also .priv and others.
I think this change makes the option macros less tricky. The old code
had to stuff everything into macro arguments (and attempted to allow
setting arbitrary fields by letting the user pass designated
initializers in the vararg parts). Some of this was made messy due to
C99 and C11 not allowing 0-sized varargs with ',' removal. It's also
possible that this change is pointless, other than cosmetic preferences.
Not too happy about some things. For example, the OPT_CHOICE()
indentation I applied looks a bit ugly.
Much of this change was done with regex search&replace, but some places
required manual editing. In particular, code in "obscure" areas (which I
didn't include in compilation) might be broken now.
In wayland_common.c the author of some option declarations confused the
flags parameter with the default value (though the default value was
also properly set below). I fixed this with this change.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/android_common.c | 3 | ||||
-rw-r--r-- | video/out/d3d11/context.c | 60 | ||||
-rw-r--r-- | video/out/d3d11/hwdec_d3d11va.c | 2 | ||||
-rw-r--r-- | video/out/drm_common.c | 42 | ||||
-rw-r--r-- | video/out/gpu/lcms.c | 20 | ||||
-rw-r--r-- | video/out/gpu/spirv.c | 2 | ||||
-rw-r--r-- | video/out/gpu/video.c | 212 | ||||
-rw-r--r-- | video/out/gpu/video_shaders.c | 8 | ||||
-rw-r--r-- | video/out/opengl/context.c | 29 | ||||
-rw-r--r-- | video/out/opengl/context_angle.c | 40 | ||||
-rw-r--r-- | video/out/opengl/context_cocoa.c | 2 | ||||
-rw-r--r-- | video/out/vo_direct3d.c | 30 | ||||
-rw-r--r-- | video/out/vo_gpu.c | 8 | ||||
-rw-r--r-- | video/out/vo_image.c | 4 | ||||
-rw-r--r-- | video/out/vo_null.c | 2 | ||||
-rw-r--r-- | video/out/vo_rpi.c | 8 | ||||
-rw-r--r-- | video/out/vo_sdl.c | 6 | ||||
-rw-r--r-- | video/out/vo_tct.c | 12 | ||||
-rw-r--r-- | video/out/vo_vaapi.c | 12 | ||||
-rw-r--r-- | video/out/vo_vdpau.c | 38 | ||||
-rw-r--r-- | video/out/vo_xv.c | 28 | ||||
-rw-r--r-- | video/out/vulkan/context.c | 20 | ||||
-rw-r--r-- | video/out/wayland_common.c | 8 |
23 files changed, 300 insertions, 296 deletions
diff --git a/video/out/android_common.c b/video/out/android_common.c index 24b87d6017..52132f2d66 100644 --- a/video/out/android_common.c +++ b/video/out/android_common.c @@ -31,7 +31,8 @@ struct android_opts { #define OPT_BASE_STRUCT struct android_opts const struct m_sub_options android_conf = { .opts = (const struct m_option[]) { - OPT_SIZE_BOX("android-surface-size", surface_size, UPDATE_VO_RESIZE), + {"android-surface-size", OPT_SIZE_BOX(surface_size), + .flags = UPDATE_VO_RESIZE}, {0} }, .size = sizeof(struct android_opts), diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c index bdfbacfe54..600058c1d2 100644 --- a/video/out/d3d11/context.c +++ b/video/out/d3d11/context.c @@ -43,36 +43,36 @@ struct d3d11_opts { #define OPT_BASE_STRUCT struct d3d11_opts const struct m_sub_options d3d11_conf = { .opts = (const struct m_option[]) { - OPT_CHOICE("d3d11-warp", warp, 0, - ({"auto", -1}, - {"no", 0}, - {"yes", 1})), - OPT_CHOICE("d3d11-feature-level", feature_level, 0, - ({"12_1", D3D_FEATURE_LEVEL_12_1}, - {"12_0", D3D_FEATURE_LEVEL_12_0}, - {"11_1", D3D_FEATURE_LEVEL_11_1}, - {"11_0", D3D_FEATURE_LEVEL_11_0}, - {"10_1", D3D_FEATURE_LEVEL_10_1}, - {"10_0", D3D_FEATURE_LEVEL_10_0}, - {"9_3", D3D_FEATURE_LEVEL_9_3}, - {"9_2", D3D_FEATURE_LEVEL_9_2}, - {"9_1", D3D_FEATURE_LEVEL_9_1})), - OPT_FLAG("d3d11-flip", flip, 0), - OPT_INTRANGE("d3d11-sync-interval", sync_interval, 0, 0, 4), - OPT_STRING_VALIDATE("d3d11-adapter", adapter_name, 0, - d3d11_validate_adapter), - OPT_CHOICE("d3d11-output-format", output_format, 0, - ({"auto", DXGI_FORMAT_UNKNOWN}, - {"rgba8", DXGI_FORMAT_R8G8B8A8_UNORM}, - {"bgra8", DXGI_FORMAT_B8G8R8A8_UNORM}, - {"rgb10_a2", DXGI_FORMAT_R10G10B10A2_UNORM}, - {"rgba16f", DXGI_FORMAT_R16G16B16A16_FLOAT})), - OPT_CHOICE("d3d11-output-csp", color_space, 0, - ({"auto", -1}, - {"srgb", DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709}, - {"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-warp", OPT_CHOICE(warp, + {"auto", -1}, + {"no", 0}, + {"yes", 1})}, + {"d3d11-feature-level", OPT_CHOICE(feature_level, + {"12_1", D3D_FEATURE_LEVEL_12_1}, + {"12_0", D3D_FEATURE_LEVEL_12_0}, + {"11_1", D3D_FEATURE_LEVEL_11_1}, + {"11_0", D3D_FEATURE_LEVEL_11_0}, + {"10_1", D3D_FEATURE_LEVEL_10_1}, + {"10_0", D3D_FEATURE_LEVEL_10_0}, + {"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-sync-interval", OPT_INT(sync_interval), M_RANGE(0, 4)}, + {"d3d11-adapter", OPT_STRING_VALIDATE(adapter_name, + d3d11_validate_adapter)}, + {"d3d11-output-format", OPT_CHOICE(output_format, + {"auto", DXGI_FORMAT_UNKNOWN}, + {"rgba8", DXGI_FORMAT_R8G8B8A8_UNORM}, + {"bgra8", DXGI_FORMAT_B8G8R8A8_UNORM}, + {"rgb10_a2", DXGI_FORMAT_R10G10B10A2_UNORM}, + {"rgba16f", DXGI_FORMAT_R16G16B16A16_FLOAT})}, + {"d3d11-output-csp", OPT_CHOICE(color_space, + {"auto", -1}, + {"srgb", DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709}, + {"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})}, {0} }, .defaults = &(const struct d3d11_opts) { diff --git a/video/out/d3d11/hwdec_d3d11va.c b/video/out/d3d11/hwdec_d3d11va.c index 8d22fe3de5..02f796e003 100644 --- a/video/out/d3d11/hwdec_d3d11va.c +++ b/video/out/d3d11/hwdec_d3d11va.c @@ -36,7 +36,7 @@ struct d3d11va_opts { #define OPT_BASE_STRUCT struct d3d11va_opts const struct m_sub_options d3d11va_conf = { .opts = (const struct m_option[]) { - OPT_FLAG("d3d11va-zero-copy", zero_copy, 0), + {"d3d11va-zero-copy", OPT_FLAG(zero_copy)}, {0} }, .defaults = &(const struct d3d11va_opts) { diff --git a/video/out/drm_common.c b/video/out/drm_common.c index 084cf22768..4ecad6f0c4 100644 --- a/video/out/drm_common.c +++ b/video/out/drm_common.c @@ -64,27 +64,27 @@ static double mode_get_Hz(const drmModeModeInfo *mode); #define OPT_BASE_STRUCT struct drm_opts const struct m_sub_options drm_conf = { .opts = (const struct m_option[]) { - OPT_STRING_VALIDATE("drm-connector", drm_connector_spec, - 0, drm_validate_connector_opt), - OPT_STRING_VALIDATE("drm-mode", drm_mode_spec, - 0, drm_validate_mode_opt), - OPT_CHOICE("drm-atomic", drm_atomic, 0, - ({"no", 0}, - {"auto", 1})), - OPT_CHOICE_OR_INT("drm-draw-plane", drm_draw_plane, 0, 0, INT_MAX, - ({"primary", DRM_OPTS_PRIMARY_PLANE}, - {"overlay", DRM_OPTS_OVERLAY_PLANE})), - OPT_CHOICE_OR_INT("drm-drmprime-video-plane", drm_drmprime_video_plane, 0, 0, INT_MAX, - ({"primary", DRM_OPTS_PRIMARY_PLANE}, - {"overlay", DRM_OPTS_OVERLAY_PLANE})), - OPT_CHOICE("drm-format", drm_format, 0, - ({"xrgb8888", DRM_OPTS_FORMAT_XRGB8888}, - {"xrgb2101010", DRM_OPTS_FORMAT_XRGB2101010})), - OPT_SIZE_BOX("drm-draw-surface-size", drm_draw_surface_size, 0), - - OPT_REPLACED("drm-osd-plane-id", "drm-draw-plane"), - OPT_REPLACED("drm-video-plane-id", "drm-drmprime-video-plane"), - OPT_REPLACED("drm-osd-size", "drm-draw-surface-size"), + {"drm-connector", OPT_STRING_VALIDATE(drm_connector_spec, + drm_validate_connector_opt)}, + {"drm-mode", OPT_STRING_VALIDATE(drm_mode_spec, + drm_validate_mode_opt)}, + {"drm-atomic", OPT_CHOICE(drm_atomic, {"no", 0}, {"auto", 1})}, + {"drm-draw-plane", OPT_CHOICE(drm_draw_plane, + {"primary", DRM_OPTS_PRIMARY_PLANE}, + {"overlay", DRM_OPTS_OVERLAY_PLANE}), + M_RANGE(0, INT_MAX)}, + {"drm-drmprime-video-plane", OPT_CHOICE(drm_drmprime_video_plane, + {"primary", DRM_OPTS_PRIMARY_PLANE}, + {"overlay", DRM_OPTS_OVERLAY_PLANE}), + M_RANGE(0, INT_MAX)}, + {"drm-format", OPT_CHOICE(drm_format, + {"xrgb8888", DRM_OPTS_FORMAT_XRGB8888}, + {"xrgb2101010", DRM_OPTS_FORMAT_XRGB2101010})}, + {"drm-draw-surface-size", OPT_SIZE_BOX(drm_draw_surface_size)}, + + {"drm-osd-plane-id", OPT_REPLACED("drm-draw-plane")}, + {"drm-video-plane-id", OPT_REPLACED("drm-drmprime-video-plane")}, + {"drm-osd-size", OPT_REPLACED("drm-draw-surface-size")}, {0}, }, .defaults = &(const struct drm_opts) { diff --git a/video/out/gpu/lcms.c b/video/out/gpu/lcms.c index 1d4e90d7af..0f3a0bf646 100644 --- a/video/out/gpu/lcms.c +++ b/video/out/gpu/lcms.c @@ -78,16 +78,16 @@ 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[]) { - OPT_FLAG("use-embedded-icc-profile", use_embedded, 0), - OPT_STRING("icc-profile", profile, M_OPT_FILE), - OPT_FLAG("icc-profile-auto", profile_auto, 0), - OPT_STRING("icc-cache-dir", cache_dir, M_OPT_FILE), - OPT_INT("icc-intent", intent, 0), - OPT_CHOICE_OR_INT("icc-contrast", contrast, 0, 0, 1000000, ({"inf", -1})), - OPT_STRING_VALIDATE("icc-3dlut-size", size_str, 0, validate_3dlut_size_opt), - - OPT_REPLACED("3dlut-size", "icc-3dlut-size"), - OPT_REMOVED("icc-cache", "see icc-cache-dir"), + {"use-embedded-icc-profile", OPT_FLAG(use_embedded)}, + {"icc-profile", OPT_STRING(profile), .flags = M_OPT_FILE}, + {"icc-profile-auto", OPT_FLAG(profile_auto)}, + {"icc-cache-dir", OPT_STRING(cache_dir), .flags = M_OPT_FILE}, + {"icc-intent", OPT_INT(intent)}, + {"icc-contrast", OPT_CHOICE(contrast, {"inf", -1}), + M_RANGE(0, 1000000)}, + {"icc-3dlut-size", OPT_STRING_VALIDATE(size_str, validate_3dlut_size_opt)}, + {"3dlut-size", OPT_REPLACED("icc-3dlut-size")}, + {"icc-cache", OPT_REMOVED("see icc-cache-dir")}, {0} }, .size = sizeof(struct mp_icc_opts), diff --git a/video/out/gpu/spirv.c b/video/out/gpu/spirv.c index ee11d601a3..67088bc7df 100644 --- a/video/out/gpu/spirv.c +++ b/video/out/gpu/spirv.c @@ -33,7 +33,7 @@ struct spirv_opts { #define OPT_BASE_STRUCT struct spirv_opts const struct m_sub_options spirv_conf = { .opts = (const struct m_option[]) { - OPT_CHOICE_C("spirv-compiler", compiler, 0, compiler_choices), + {"spirv-compiler", OPT_CHOICE_C(compiler, compiler_choices)}, {0} }, .size = sizeof(struct spirv_opts), diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 539934fe67..9d5df7c739 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -346,119 +346,123 @@ static int validate_error_diffusion_opt(struct mp_log *log, const m_option_t *op #define OPT_BASE_STRUCT struct gl_video_opts // Use for options which use NAN for defaults. -#define OPT_FLOATDEF(name, var, flags) \ - OPT_FLOAT(name, var, (flags) | M_OPT_DEFAULT_NAN) +#define OPT_FLOATDEF(field) \ + OPT_FLOAT(field), \ + .flags = M_OPT_DEFAULT_NAN #define SCALER_OPTS(n, i) \ - OPT_STRING_VALIDATE(n, scaler[i].kernel.name, 0, validate_scaler_opt), \ - OPT_FLOATDEF(n"-param1", scaler[i].kernel.params[0], 0), \ - OPT_FLOATDEF(n"-param2", scaler[i].kernel.params[1], 0), \ - OPT_FLOAT(n"-blur", scaler[i].kernel.blur, 0), \ - OPT_FLOATRANGE(n"-cutoff", scaler[i].cutoff, 0, 0.0, 1.0), \ - OPT_FLOATRANGE(n"-taper", scaler[i].kernel.taper, 0, 0.0, 1.0), \ - OPT_FLOATDEF(n"-wparam", scaler[i].window.params[0], 0), \ - OPT_FLOAT(n"-wblur", scaler[i].window.blur, 0), \ - OPT_FLOATRANGE(n"-wtaper", scaler[i].window.taper, 0, 0.0, 1.0), \ - OPT_FLOATRANGE(n"-clamp", scaler[i].clamp, 0, 0.0, 1.0), \ - OPT_FLOATRANGE(n"-radius", scaler[i].radius, 0, 0.5, 16.0), \ - OPT_FLOATRANGE(n"-antiring", scaler[i].antiring, 0, 0.0, 1.0), \ - OPT_STRING_VALIDATE(n"-window", scaler[i].window.name, 0, validate_window_opt) + {n, OPT_STRING_VALIDATE(scaler[i].kernel.name, validate_scaler_opt)}, \ + {n"-param1", OPT_FLOATDEF(scaler[i].kernel.params[0])}, \ + {n"-param2", OPT_FLOATDEF(scaler[i].kernel.params[1])}, \ + {n"-blur", OPT_FLOAT(scaler[i].kernel.blur)}, \ + {n"-cutoff", OPT_FLOAT(scaler[i].cutoff), M_RANGE(0.0, 1.0)}, \ + {n"-taper", OPT_FLOAT(scaler[i].kernel.taper), M_RANGE(0.0, 1.0)}, \ + {n"-wparam", OPT_FLOATDEF(scaler[i].window.params[0])}, \ + {n"-wblur", OPT_FLOAT(scaler[i].window.blur)}, \ + {n"-wtaper", OPT_FLOAT(scaler[i].window.taper), M_RANGE(0.0, 1.0)}, \ + {n"-clamp", OPT_FLOAT(scaler[i].clamp), M_RANGE(0.0, 1.0)}, \ + {n"-radius", OPT_FLOAT(scaler[i].radius), M_RANGE(0.5, 16.0)}, \ + {n"-antiring", OPT_FLOAT(scaler[i].antiring), M_RANGE(0.0, 1.0)}, \ + {n"-window", OPT_STRING_VALIDATE(scaler[i].window.name, validate_window_opt)} const struct m_sub_options gl_video_conf = { .opts = (const m_option_t[]) { - OPT_CHOICE("gpu-dumb-mode", dumb_mode, 0, - ({"auto", 0}, {"yes", 1}, {"no", -1})), - OPT_FLOATRANGE("gamma-factor", gamma, 0, 0.1, 2.0), - OPT_FLAG("gamma-auto", gamma_auto, 0), - OPT_CHOICE_C("target-prim", target_prim, 0, mp_csp_prim_names), - OPT_CHOICE_C("target-trc", target_trc, 0, mp_csp_trc_names), - OPT_CHOICE_OR_INT("target-peak", target_peak, 0, 10, 10000, - ({"auto", 0})), - OPT_CHOICE("tone-mapping", tone_map.curve, 0, - ({"clip", TONE_MAPPING_CLIP}, - {"mobius", TONE_MAPPING_MOBIUS}, - {"reinhard", TONE_MAPPING_REINHARD}, - {"hable", TONE_MAPPING_HABLE}, - {"gamma", TONE_MAPPING_GAMMA}, - {"linear", TONE_MAPPING_LINEAR})), - OPT_CHOICE("hdr-compute-peak", tone_map.compute_peak, 0, - ({"auto", 0}, - {"yes", 1}, - {"no", -1})), - OPT_FLOATRANGE("hdr-peak-decay-rate", tone_map.decay_rate, 0, 1.0, 1000.0), - OPT_FLOATRANGE("hdr-scene-threshold-low", - tone_map.scene_threshold_low, 0, 0, 20.0), - OPT_FLOATRANGE("hdr-scene-threshold-high", - tone_map.scene_threshold_high, 0, 0, 20.0), - OPT_FLOATDEF("tone-mapping-param", tone_map.curve_param, 0), - OPT_FLOATRANGE("tone-mapping-max-boost", tone_map.max_boost, 0, 1.0, 10.0), - OPT_FLOAT("tone-mapping-desaturate", tone_map.desat, 0), - OPT_FLOATRANGE("tone-mapping-desaturate-exponent", - tone_map.desat_exp, 0, 0.0, 20.0), - OPT_FLAG("gamut-warning", tone_map.gamut_warning, 0), - OPT_FLAG("opengl-pbo", pbo, 0), + {"gpu-dumb-mode", OPT_CHOICE(dumb_mode, + {"auto", 0}, {"yes", 1}, {"no", -1})}, + {"gamma-factor", OPT_FLOAT(gamma), M_RANGE(0.1, 2.0)}, + {"gamma-auto", OPT_FLAG(gamma_auto)}, + {"target-prim", OPT_CHOICE_C(target_prim, mp_csp_prim_names)}, + {"target-trc", OPT_CHOICE_C(target_trc, mp_csp_trc_names)}, + {"target-peak", OPT_CHOICE(target_peak, {"auto", 0}), + M_RANGE(10, 10000)}, + {"tone-mapping", OPT_CHOICE(tone_map.curve, + {"clip", TONE_MAPPING_CLIP}, + {"mobius", TONE_MAPPING_MOBIUS}, + {"reinhard", TONE_MAPPING_REINHARD}, + {"hable", TONE_MAPPING_HABLE}, + {"gamma", TONE_MAPPING_GAMMA}, + {"linear", TONE_MAPPING_LINEAR})}, + {"hdr-compute-peak", OPT_CHOICE(tone_map.compute_peak, + {"auto", 0}, + {"yes", 1}, + {"no", -1})}, + {"hdr-peak-decay-rate", OPT_FLOAT(tone_map.decay_rate), + M_RANGE(1.0, 1000.0)}, + {"hdr-scene-threshold-low", OPT_FLOAT(tone_map.scene_threshold_low), + M_RANGE(0, 20.0)}, + {"hdr-scene-threshold-high", OPT_FLOAT(tone_map.scene_threshold_high), + M_RANGE(0, 20.0)}, + {"tone-mapping-param", OPT_FLOATDEF(tone_map.curve_param)}, + {"tone-mapping-max-boost", OPT_FLOAT(tone_map.max_boost), + M_RANGE(1.0, 10.0)}, + {"tone-mapping-desaturate", OPT_FLOAT(tone_map.desat)}, + {"tone-mapping-desaturate-exponent", OPT_FLOAT(tone_map.desat_exp), + M_RANGE(0.0, 20.0)}, + {"gamut-warning", OPT_FLAG(tone_map.gamut_warning)}, + {"opengl-pbo", OPT_FLAG(pbo)}, SCALER_OPTS("scale", SCALER_SCALE), SCALER_OPTS("dscale", SCALER_DSCALE), SCALER_OPTS("cscale", SCALER_CSCALE), SCALER_OPTS("tscale", SCALER_TSCALE), - OPT_INTRANGE("scaler-lut-size", scaler_lut_size, 0, 4, 10), - OPT_FLAG("scaler-resizes-only", scaler_resizes_only, 0), - OPT_FLAG("correct-downscaling", correct_downscaling, 0), - OPT_FLAG("linear-downscaling", linear_downscaling, 0), - OPT_FLAG("linear-upscaling", linear_upscaling, 0), - OPT_FLAG("sigmoid-upscaling", sigmoid_upscaling, 0), - OPT_FLOATRANGE("sigmoid-center", sigmoid_center, 0, 0.0, 1.0), - OPT_FLOATRANGE("sigmoid-slope", sigmoid_slope, 0, 1.0, 20.0), - OPT_STRING("fbo-format", fbo_format, 0), - OPT_CHOICE_OR_INT("dither-depth", dither_depth, 0, -1, 16, - ({"no", -1}, {"auto", 0})), - OPT_CHOICE("dither", dither_algo, 0, - ({"fruit", DITHER_FRUIT}, - {"ordered", DITHER_ORDERED}, - {"error-diffusion", DITHER_ERROR_DIFFUSION}, - {"no", DITHER_NONE})), - OPT_INTRANGE("dither-size-fruit", dither_size, 0, 2, 8), - OPT_FLAG("temporal-dither", temporal_dither, 0), - OPT_INTRANGE("temporal-dither-period", temporal_dither_period, 0, 1, 128), - OPT_STRING_VALIDATE("error-diffusion", error_diffusion, 0, - validate_error_diffusion_opt), - OPT_CHOICE("alpha", alpha_mode, 0, - ({"no", ALPHA_NO}, - {"yes", ALPHA_YES}, - {"blend", ALPHA_BLEND}, - {"blend-tiles", ALPHA_BLEND_TILES})), - OPT_FLAG("opengl-rectangle-textures", use_rectangle, 0), - OPT_COLOR("background", background, 0), - OPT_FLAG("interpolation", interpolation, 0), - OPT_FLOAT("interpolation-threshold", interpolation_threshold, 0), - OPT_CHOICE("blend-subtitles", blend_subs, 0, - ({"no", BLEND_SUBS_NO}, - {"yes", BLEND_SUBS_YES}, - {"video", BLEND_SUBS_VIDEO})), - OPT_PATHLIST("glsl-shaders", user_shaders, M_OPT_FILE), - OPT_CLI_ALIAS("glsl-shader", "glsl-shaders-append"), - OPT_FLAG("deband", deband, 0), - OPT_SUBSTRUCT("deband", deband_opts, deband_conf, 0), - OPT_FLOAT("sharpen", unsharp, 0), - OPT_INTRANGE("gpu-tex-pad-x", tex_pad_x, 0, 0, 4096), - OPT_INTRANGE("gpu-tex-pad-y", tex_pad_y, 0, 0, 4096), - OPT_SUBSTRUCT("", icc_opts, mp_icc_conf, 0), - OPT_STRING("gpu-shader-cache-dir", shader_cache_dir, M_OPT_FILE), - OPT_STRING_VALIDATE("gpu-hwdec-interop", hwdec_interop, 0, - ra_hwdec_validate_opt), - OPT_REPLACED("opengl-hwdec-interop", "gpu-hwdec-interop"), - OPT_REPLACED("hwdec-preload", "opengl-hwdec-interop"), - OPT_REPLACED("hdr-tone-mapping", "tone-mapping"), - OPT_REPLACED("opengl-shaders", "glsl-shaders"), - OPT_REPLACED("opengl-shader", "glsl-shader"), - OPT_REPLACED("opengl-shader-cache-dir", "gpu-shader-cache-dir"), - OPT_REPLACED("opengl-tex-pad-x", "gpu-tex-pad-x"), - OPT_REPLACED("opengl-tex-pad-y", "gpu-tex-pad-y"), - OPT_REPLACED("opengl-fbo-format", "fbo-format"), - OPT_REPLACED("opengl-dumb-mode", "gpu-dumb-mode"), - OPT_REPLACED("opengl-gamma", "gamma-factor"), - OPT_REMOVED("linear-scaling", "Split into --linear-upscaling and " - "--linear-downscaling"), + {"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)}, + {"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)}, + {"dither-depth", OPT_CHOICE(dither_depth, {"no", -1}, {"auto", 0}), + M_RANGE(-1, 16)}, + {"dither", OPT_CHOICE(dither_algo, + {"fruit", DITHER_FRUIT}, + {"ordered", DITHER_ORDERED}, + {"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-period", OPT_INT(temporal_dither_period), + M_RANGE(1, 128)}, + {"error-diffusion", + OPT_STRING_VALIDATE(error_diffusion, validate_error_diffusion_opt)}, + {"alpha", OPT_CHOICE(alpha_mode, + {"no", ALPHA_NO}, + {"yes", ALPHA_YES}, + {"blend", ALPHA_BLEND}, + {"blend-tiles", ALPHA_BLEND_TILES})}, + {"opengl-rectangle-textures", OPT_FLAG(use_rectangle)}, + {"background", OPT_COLOR(background)}, + {"interpolation", OPT_FLAG(interpolation)}, + {"interpolation-threshold", OPT_FLOAT(interpolation_threshold)}, + {"blend-subtitles", OPT_CHOICE(blend_subs, + {"no", BLEND_SUBS_NO}, + {"yes", BLEND_SUBS_YES}, + {"video", BLEND_SUBS_VIDEO})}, + {"glsl-shaders", OPT_PATHLIST(user_shaders), .flags = M_OPT_FILE}, + {"glsl-shader", OPT_CLI_ALIAS("glsl-shaders-append")}, + {"deband", OPT_FLAG(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)}, + {"gpu-tex-pad-y", OPT_INT(tex_pad_y), M_RANGE(0, 4096)}, + {"", OPT_SUBSTRUCT(icc_opts, mp_icc_conf)}, + {"gpu-shader-cache-dir", OPT_STRING(shader_cache_dir), .flags = M_OPT_FILE}, + {"gpu-hwdec-interop", + OPT_STRING_VALIDATE(hwdec_interop, ra_hwdec_validate_opt)}, + {"opengl-hwdec-interop", OPT_REPLACED("gpu-hwdec-interop")}, + {"hwdec-preload", OPT_REPLACED("opengl-hwdec-interop")}, + {"hdr-tone-mapping", OPT_REPLACED("tone-mapping")}, + {"opengl-shaders", OPT_REPLACED("glsl-shaders")}, + {"opengl-shader", OPT_REPLACED("glsl-shader")}, + {"opengl-shader-cache-dir", OPT_REPLACED("gpu-shader-cache-dir")}, + {"opengl-tex-pad-x", OPT_REPLACED("gpu-tex-pad-x")}, + {"opengl-tex-pad-y", OPT_REPLACED("gpu-tex-pad-y")}, + {"opengl-fbo-format", OPT_REPLACED("fbo-format")}, + {"opengl-dumb-mode", OPT_REPLACED("gpu-dumb-mode")}, + {"opengl-gamma", OPT_REPLACED("gamma-factor")}, + {"linear-scaling", OPT_REMOVED("Split into --linear-upscaling and " + "--linear-downscaling")}, {0} }, .size = sizeof(struct gl_video_opts), diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c index 51b62ad7db..ff1660c85a 100644 --- a/video/out/gpu/video_shaders.c +++ b/video/out/gpu/video_shaders.c @@ -882,10 +882,10 @@ const struct deband_opts deband_opts_def = { #define OPT_BASE_STRUCT struct deband_opts const struct m_sub_options deband_conf = { .opts = (const m_option_t[]) { - OPT_INTRANGE("iterations", iterations, 0, 1, 16), - OPT_FLOATRANGE("threshold", threshold, 0, 0.0, 4096.0), - OPT_FLOATRANGE("range", range, 0, 1.0, 64.0), - OPT_FLOATRANGE("grain", grain, 0, 0.0, 4096.0), + {"iterations", OPT_INT(iterations), M_RANGE(1, 16)}, + {"threshold", OPT_FLOAT(threshold), M_RANGE(0.0, 4096.0)}, + {"range", OPT_FLOAT(range), M_RANGE(1.0, 64.0)}, + {"grain", OPT_FLOAT(grain), M_RANGE(0.0, 4096.0)}, {0} }, .size = sizeof(struct deband_opts), diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c index 07fa183acc..781352da34 100644 --- a/video/out/opengl/context.c +++ b/video/out/opengl/context.c @@ -59,21 +59,20 @@ struct opengl_opts { #define OPT_BASE_STRUCT struct opengl_opts const struct m_sub_options opengl_conf = { .opts = (const struct m_option[]) { - OPT_FLAG("opengl-glfinish", use_glfinish, 0), - OPT_FLAG("opengl-waitvsync", waitvsync, 0), - OPT_INT("opengl-swapinterval", swapinterval, 0), - OPT_INT("opengl-check-pattern-a", vsync_pattern[0], 0), - OPT_INT("opengl-check-pattern-b", vsync_pattern[1], 0), - OPT_INT("opengl-restrict", restrict_version, 0), - OPT_CHOICE("opengl-es", gles_mode, 0, - ({"auto", GLES_AUTO}, {"yes", GLES_YES}, {"no", GLES_NO})), - OPT_CHOICE("opengl-early-flush", early_flush, 0, - ({"no", FLUSH_NO}, {"yes", FLUSH_YES}, {"auto", FLUSH_AUTO})), - - OPT_REPLACED("opengl-debug", "gpu-debug"), - OPT_REPLACED("opengl-sw", "gpu-sw"), - OPT_REPLACED("opengl-vsync-fences", "swapchain-depth"), - OPT_REPLACED("opengl-backend", "gpu-context"), + {"opengl-glfinish", OPT_FLAG(use_glfinish)}, + {"opengl-waitvsync", OPT_FLAG(waitvsync)}, + {"opengl-swapinterval", OPT_INT(swapinterval)}, + {"opengl-check-pattern-a", OPT_INT(vsync_pattern[0])}, + {"opengl-check-pattern-b", OPT_INT(vsync_pattern[1])}, + {"opengl-restrict", OPT_INT(restrict_version)}, + {"opengl-es", OPT_CHOICE(gles_mode, + {"auto", GLES_AUTO}, {"yes", GLES_YES}, {"no", GLES_NO})}, + {"opengl-early-flush", OPT_CHOICE(early_flush, + {"no", FLUSH_NO}, {"yes", FLUSH_YES}, {"auto", FLUSH_AUTO})}, + {"opengl-debug", OPT_REPLACED("gpu-debug")}, + {"opengl-sw", OPT_REPLACED("gpu-sw")}, + {"opengl-vsync-fences", OPT_REPLACED("swapchain-depth")}, + {"opengl-backend", OPT_REPLACED("gpu-context")}, {0}, }, .defaults = &(const struct opengl_opts) { diff --git a/video/out/opengl/context_angle.c b/video/out/opengl/context_angle.c index 76d104e9b9..2784026d1d 100644 --- a/video/out/opengl/context_angle.c +++ b/video/out/opengl/context_angle.c @@ -59,26 +59,26 @@ struct angle_opts { #define OPT_BASE_STRUCT struct angle_opts const struct m_sub_options angle_conf = { .opts = (const struct m_option[]) { - OPT_CHOICE("angle-renderer", renderer, 0, - ({"auto", RENDERER_AUTO}, - {"d3d9", RENDERER_D3D9}, - {"d3d11", RENDERER_D3D11})), - OPT_CHOICE("angle-d3d11-warp", d3d11_warp, 0, - ({"auto", -1}, - {"no", 0}, - {"yes", 1})), - OPT_CHOICE("angle-d3d11-feature-level", d3d11_feature_level, 0, - ({"11_0", D3D_FEATURE_LEVEL_11_0}, - {"10_1", D3D_FEATURE_LEVEL_10_1}, - {"10_0", D3D_FEATURE_LEVEL_10_0}, - {"9_3", D3D_FEATURE_LEVEL_9_3})), - OPT_CHOICE("angle-egl-windowing", egl_windowing, 0, - ({"auto", -1}, - {"no", 0}, - {"yes", 1})), - OPT_FLAG("angle-flip", flip, 0), - OPT_REPLACED("angle-max-frame-latency", "swapchain-depth"), - OPT_REMOVED("angle-swapchain-length", "controlled by --swapchain-depth"), + {"angle-renderer", OPT_CHOICE(renderer, + {"auto", RENDERER_AUTO}, + {"d3d9", RENDERER_D3D9}, + {"d3d11", RENDERER_D3D11})}, + {"angle-d3d11-warp", OPT_CHOICE(d3d11_warp, + {"auto", -1}, + {"no", 0}, + {"yes", 1})}, + {"angle-d3d11-feature-level", OPT_CHOICE(d3d11_feature_level, + {"11_0", D3D_FEATURE_LEVEL_11_0}, + {"10_1", D3D_FEATURE_LEVEL_10_1}, + {"10_0", D3D_FEATURE_LEVEL_10_0}, + {"9_3", D3D_FEATURE_LEVEL_9_3})}, + {"angle-egl-windowing", OPT_CHOICE(egl_windowing, + {"auto", -1}, + {"no", 0}, + {"yes", 1})}, + {"angle-flip", OPT_FLAG(flip)}, + {"angle-max-frame-latency", OPT_REPLACED("swapchain-depth")}, + {"angle-swapchain-length", OPT_REMOVED("controlled by --swapchain-depth")}, {0} }, .defaults = &(const struct angle_opts) { diff --git a/video/out/opengl/context_cocoa.c b/video/out/opengl/context_cocoa.c index d0fcd63d62..b7cab8e718 100644 --- a/video/out/opengl/context_cocoa.c +++ b/video/out/opengl/context_cocoa.c @@ -28,7 +28,7 @@ struct cocoa_opts { #define OPT_BASE_STRUCT struct cocoa_opts const struct m_sub_options cocoa_conf = { .opts = (const struct m_option[]) { - OPT_REPLACED("cocoa-force-dedicated-gpu", "macos-force-dedicated-gpu"), + {"cocoa-force-dedicated-gpu", OPT_REPLACED("macos-force-dedicated-gpu")}, {0} }, .size = sizeof(struct cocoa_opts), diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c index a131d210cb..455c3faafd 100644 --- a/video/out/vo_direct3d.c +++ b/video/out/vo_direct3d.c @@ -1684,21 +1684,21 @@ static void draw_osd(struct vo *vo) #define OPT_BASE_STRUCT d3d_priv static const struct m_option opts[] = { - OPT_FLAG("prefer-stretchrect", opt_prefer_stretchrect, 0), - OPT_FLAG("disable-textures", opt_disable_textures, 0), - OPT_FLAG("disable-stretchrect", opt_disable_stretchrect, 0), - OPT_FLAG("disable-shaders", opt_disable_shaders, 0), - OPT_FLAG("only-8bit", opt_only_8bit, 0), - OPT_FLAG("force-power-of-2", opt_force_power_of_2, 0), - OPT_FLAG("disable-texture-align", opt_disable_texture_align, 0), - OPT_CHOICE("texture-memory", opt_texture_memory, 0, - ({"default", 0}, - {"managed", 1}, - {"default-pool", 2}, - {"default-pool-shadow", 3}, - {"scratch", 4})), - OPT_FLAG("swap-discard", opt_swap_discard, 0), - OPT_FLAG("exact-backbuffer", opt_exact_backbuffer, 0), + {"prefer-stretchrect", OPT_FLAG(opt_prefer_stretchrect)}, + {"disable-textures", OPT_FLAG(opt_disable_textures)}, + {"disable-stretchrect", OPT_FLAG(opt_disable_stretchrect)}, + {"disable-shaders", OPT_FLAG(opt_disable_shaders)}, + {"only-8bit", OPT_FLAG(opt_only_8bit)}, + {"force-power-of-2", OPT_FLAG(opt_force_power_of_2)}, + {"disable-texture-align", OPT_FLAG(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)}, {0} }; diff --git a/video/out/vo_gpu.c b/video/out/vo_gpu.c index 5b21646aa2..f765e79d34 100644 --- a/video/out/vo_gpu.c +++ b/video/out/vo_gpu.c @@ -311,10 +311,10 @@ err_out: #define OPT_BASE_STRUCT struct gpu_priv static const m_option_t options[] = { - OPT_STRING_VALIDATE("gpu-context", context_name, 0, ra_ctx_validate_context), - OPT_STRING_VALIDATE("gpu-api", context_type, 0, ra_ctx_validate_api), - OPT_FLAG("gpu-debug", opts.debug, 0), - OPT_FLAG("gpu-sw", opts.allow_sw, 0), + {"gpu-context", OPT_STRING_VALIDATE(context_name, ra_ctx_validate_context)}, + {"gpu-api", OPT_STRING_VALIDATE(context_type, ra_ctx_validate_api)}, + {"gpu-debug", OPT_FLAG(opts.debug)}, + {"gpu-sw", OPT_FLAG(opts.allow_sw)}, {0} }; diff --git a/video/out/vo_image.c b/video/out/vo_image.c index 2a3b8fae87..15c1a34498 100644 --- a/video/out/vo_image.c +++ b/video/out/vo_image.c @@ -56,8 +56,8 @@ struct vo_image_opts { |