From 91cc0d8cf6a2cf264c243ca3b3e99b5fd4044c29 Mon Sep 17 00:00:00 2001 From: Christoph Heinrich Date: Mon, 20 Feb 2023 04:32:50 +0100 Subject: [PATCH] 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. --- audio/decode/ad_lavc.c | 5 +- audio/filter/af_format.c | 4 +- audio/filter/af_lavcac3enc.c | 6 +- audio/out/ao_alsa.c | 13 +- audio/out/ao_audiotrack.c | 4 +- audio/out/ao_coreaudio.c | 4 +- audio/out/ao_coreaudio_exclusive.c | 5 +- audio/out/ao_jack.c | 10 +- audio/out/ao_null.c | 12 +- audio/out/ao_openal.c | 6 +- audio/out/ao_oss.c | 1 - audio/out/ao_pcm.c | 10 +- audio/out/ao_pulse.c | 8 +- common/encode.h | 8 +- common/encode_lavc.c | 10 +- demux/demux.c | 28 +-- demux/demux_lavf.c | 18 +- demux/demux_libarchive.c | 4 +- demux/demux_mkv.c | 6 +- filters/f_decoder_wrapper.c | 12 +- filters/f_lavfi.c | 4 +- filters/f_swresample.c | 4 +- filters/f_swresample.h | 4 +- filters/filter.c | 1 - input/input.c | 52 +++--- options/options.c | 267 ++++++++++++++--------------- options/options.h | 182 ++++++++++---------- osdep/macos/mpv_helper.swift | 4 +- osdep/macosx_application.h | 4 +- osdep/macosx_application.m | 6 +- player/loadfile.c | 2 +- stream/dvbin.h | 2 +- stream/stream.c | 8 +- stream/stream_cdda.c | 10 +- stream/stream_dvb.c | 2 +- stream/stream_lavf.c | 8 +- stream/stream_slice.c | 1 - sub/osd.c | 4 +- sub/osd.h | 4 +- video/decode/vd_lavc.c | 23 ++- video/filter/vf_d3d11vpp.c | 12 +- video/filter/vf_fingerprint.c | 12 +- video/filter/vf_format.c | 16 +- video/filter/vf_vavpp.c | 11 +- video/filter/vf_vdpaupp.c | 12 +- video/image_writer.c | 15 +- video/image_writer.h | 8 +- video/out/cocoa_cb_common.swift | 2 +- video/out/d3d11/context.c | 12 +- video/out/d3d11/hwdec_d3d11va.c | 5 +- video/out/gpu/context.c | 4 +- video/out/gpu/context.h | 4 +- video/out/gpu/lcms.c | 4 +- video/out/gpu/lcms.h | 4 +- video/out/gpu/user_shaders.c | 1 - video/out/gpu/video.c | 33 ++-- video/out/gpu/video.h | 26 +-- video/out/mac/common.swift | 2 +- video/out/mac/gl_layer.swift | 4 +- video/out/mac/window.swift | 2 +- video/out/opengl/context.c | 8 +- video/out/opengl/context_angle.c | 6 +- video/out/opengl/libmpv_gl.c | 5 +- video/out/placebo/ra_pl.c | 1 - video/out/vo_direct3d.c | 16 +- video/out/vo_gpu_next.c | 12 +- video/out/vo_kitty.c | 14 +- video/out/vo_rpi.c | 8 +- video/out/vo_sdl.c | 17 +- video/out/vo_sixel.c | 23 ++- video/out/vo_tct.c | 4 +- video/out/vo_vaapi.c | 4 +- video/out/vo_vdpau.c | 16 +- video/out/vulkan/context.c | 8 +- video/out/wayland_common.c | 3 +- video/out/wayland_common.h | 2 +- video/sws_utils.c | 14 +- video/vdpau_mixer.h | 4 +- video/zimg.c | 4 +- video/zimg.h | 2 +- 80 files changed, 550 insertions(+), 576 deletions(-) diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index cdb86c3507..99d04a8f85 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -60,7 +60,7 @@ struct priv { #define OPT_BASE_STRUCT struct ad_lavc_params struct ad_lavc_params { float ac3drc; - int downmix; + bool downmix; int threads; char **avopts; }; @@ -68,7 +68,7 @@ struct ad_lavc_params { const struct m_sub_options ad_lavc_conf = { .opts = (const m_option_t[]) { {"ac3drc", OPT_FLOAT(ac3drc), M_RANGE(0, 6)}, - {"downmix", OPT_FLAG(downmix)}, + {"downmix", OPT_BOOL(downmix)}, {"threads", OPT_INT(threads), M_RANGE(0, 16)}, {"o", OPT_KEYVALUELIST(avopts)}, {0} @@ -76,7 +76,6 @@ const struct m_sub_options ad_lavc_conf = { .size = sizeof(struct ad_lavc_params), .defaults = &(const struct ad_lavc_params){ .ac3drc = 0, - .downmix = 0, .threads = 1, }, }; diff --git a/audio/filter/af_format.c b/audio/filter/af_format.c index 88ae99ed56..2d1c1cc97d 100644 --- a/audio/filter/af_format.c +++ b/audio/filter/af_format.c @@ -30,7 +30,7 @@ struct f_opts { int out_srate; struct m_channels out_channels; - int fail; + bool fail; }; struct priv { @@ -135,7 +135,7 @@ const struct mp_user_filter_entry af_format = { {"out-srate", OPT_INT(out_srate), M_RANGE(1000, 8*48000)}, {"out-channels", OPT_CHANNELS(out_channels), .flags = M_OPT_CHANNELS_LIMITED}, - {"fail", OPT_FLAG(fail)}, + {"fail", OPT_BOOL(fail)}, {0} }, }, diff --git a/audio/filter/af_lavcac3enc.c b/audio/filter/af_lavcac3enc.c index 86c34a1278..b4a1d59fe7 100644 --- a/audio/filter/af_lavcac3enc.c +++ b/audio/filter/af_lavcac3enc.c @@ -56,7 +56,7 @@ const static uint16_t ac3_bitrate_tab[19] = { }; struct f_opts { - int add_iec61937_header; + bool add_iec61937_header; int bit_rate; int min_channel_num; char *encoder; @@ -418,13 +418,13 @@ const struct mp_user_filter_entry af_lavcac3enc = { .name = "lavcac3enc", .priv_size = sizeof(OPT_BASE_STRUCT), .priv_defaults = &(const OPT_BASE_STRUCT) { - .add_iec61937_header = 1, + .add_iec61937_header = true, .bit_rate = 640, .min_channel_num = 3, .encoder = "ac3", }, .options = (const struct m_option[]) { - {"tospdif", OPT_FLAG(add_iec61937_header)}, + {"tospdif", OPT_BOOL(add_iec61937_header)}, {"bitrate", OPT_CHOICE(bit_rate, {"auto", 0}, {"default", 0}), M_RANGE(32, 640)}, {"minch", OPT_INT(min_channel_num), M_RANGE(2, 6)}, diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index ee43578e4a..64a41901c3 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -56,9 +56,9 @@ struct ao_alsa_opts { char *mixer_device; char *mixer_name; int mixer_index; - int resample; - int ni; - int ignore_chmap; + bool resample; + bool ni; + bool ignore_chmap; int buffer_time; int frags; }; @@ -66,12 +66,12 @@ struct ao_alsa_opts { #define OPT_BASE_STRUCT struct ao_alsa_opts static const struct m_sub_options ao_alsa_conf = { .opts = (const struct m_option[]) { - {"alsa-resample", OPT_FLAG(resample)}, + {"alsa-resample", OPT_BOOL(resample)}, {"alsa-mixer-device", OPT_STRING(mixer_device)}, {"alsa-mixer-name", OPT_STRING(mixer_name)}, {"alsa-mixer-index", OPT_INT(mixer_index), M_RANGE(0, 99)}, - {"alsa-non-interleaved", OPT_FLAG(ni)}, - {"alsa-ignore-chmap", OPT_FLAG(ignore_chmap)}, + {"alsa-non-interleaved", OPT_BOOL(ni)}, + {"alsa-ignore-chmap", OPT_BOOL(ignore_chmap)}, {"alsa-buffer-time", OPT_INT(buffer_time), M_RANGE(0, INT_MAX)}, {"alsa-periods", OPT_INT(frags), M_RANGE(0, INT_MAX)}, {0} @@ -80,7 +80,6 @@ static const struct m_sub_options ao_alsa_conf = { .mixer_device = "default", .mixer_name = "Master", .mixer_index = 0, - .ni = 0, .buffer_time = 100000, .frags = 4, }, diff --git a/audio/out/ao_audiotrack.c b/audio/out/ao_audiotrack.c index d11109d085..b465aa692e 100644 --- a/audio/out/ao_audiotrack.c +++ b/audio/out/ao_audiotrack.c @@ -54,7 +54,7 @@ struct priv { jfloatArray floatarray; jobject bbuf; - int cfg_pcm_float; + bool cfg_pcm_float; int cfg_session_id; bool needs_timestamp_offset; @@ -818,7 +818,7 @@ const struct ao_driver audio_out_audiotrack = { .start = start, .priv_size = sizeof(struct priv), .options = (const struct m_option[]) { - {"pcm-float", OPT_FLAG(cfg_pcm_float)}, + {"pcm-float", OPT_BOOL(cfg_pcm_float)}, {"session-id", OPT_INT(cfg_session_id)}, {0} }, diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index fd85fdca1a..ee8d63a81c 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -36,7 +36,7 @@ struct priv { AudioStreamBasicDescription original_asbd; AudioStreamID original_asbd_stream; - int change_physical_format; + bool change_physical_format; }; static int64_t ca_get_hardware_latency(struct ao *ao) { @@ -421,7 +421,7 @@ const struct ao_driver audio_out_coreaudio = { .list_devs = ca_get_device_list, .priv_size = sizeof(struct priv), .options = (const struct m_option[]){ - {"change-physical-format", OPT_FLAG(change_physical_format)}, + {"change-physical-format", OPT_BOOL(change_physical_format)}, {0} }, .options_prefix = "coreaudio", diff --git a/audio/out/ao_coreaudio_exclusive.c b/audio/out/ao_coreaudio_exclusive.c index f88d0fb318..cd94f0e6b8 100644 --- a/audio/out/ao_coreaudio_exclusive.c +++ b/audio/out/ao_coreaudio_exclusive.c @@ -72,7 +72,7 @@ struct priv { AudioStreamBasicDescription original_asbd; // Output s16 physical format, float32 virtual format, ac3/dts mpv format - int spdif_hack; + bool spdif_hack; bool changed_mixing; @@ -461,10 +461,9 @@ const struct ao_driver audio_out_coreaudio_exclusive = { .hog_pid = -1, .stream = 0, .stream_idx = -1, - .changed_mixing = false, }, .options = (const struct m_option[]){ - {"spdif-hack", OPT_FLAG(spdif_hack)}, + {"spdif-hack", OPT_BOOL(spdif_hack)}, {0} }, .options_prefix = "coreaudio", diff --git a/audio/out/ao_jack.c b/audio/out/ao_jack.c index 767f437895..0901fec36b 100644 --- a/audio/out/ao_jack.c +++ b/audio/out/ao_jack.c @@ -47,8 +47,8 @@ struct jack_opts { char *port; char *client_name; - int connect; - int autostart; + bool connect; + bool autostart; int stdlayout; }; @@ -57,15 +57,15 @@ static const struct m_sub_options ao_jack_conf = { .opts = (const struct m_option[]){ {"jack-port", OPT_STRING(port)}, {"jack-name", OPT_STRING(client_name)}, - {"jack-autostart", OPT_FLAG(autostart)}, - {"jack-connect", OPT_FLAG(connect)}, + {"jack-autostart", OPT_BOOL(autostart)}, + {"jack-connect", OPT_BOOL(connect)}, {"jack-std-channel-layout", OPT_CHOICE(stdlayout, {"waveext", 0}, {"any", 1})}, {0} }, .defaults = &(const struct jack_opts) { .client_name = "mpv", - .connect = 1, + .connect = true, }, .size = sizeof(struct jack_opts), }; diff --git a/audio/out/ao_null.c b/audio/out/ao_null.c index 26d03fe81b..fcb61d20dd 100644 --- a/audio/out/ao_null.c +++ b/audio/out/ao_null.c @@ -43,13 +43,13 @@ struct priv { int buffersize; // samples bool playing; - int untimed; + bool untimed; float bufferlen; // seconds float speed; // multiplier float latency_sec; // seconds float latency; // samples - int broken_eof; - int broken_delay; + bool broken_eof; + bool broken_delay; // Minimal unit of audio samples that can be written at once. If play() is // called with sizes not aligned to this, a rounded size will be returned. @@ -215,13 +215,13 @@ const struct ao_driver audio_out_null = { .speed = 1, }, .options = (const struct m_option[]) { - {"untimed", OPT_FLAG(untimed)}, + {"untimed", OPT_BOOL(untimed)}, {"buffer", OPT_FLOAT(bufferlen), M_RANGE(0, 100)}, {"outburst", OPT_INT(outburst), M_RANGE(1, 100000)}, {"speed", OPT_FLOAT(speed), M_RANGE(0, 10000)}, {"latency", OPT_FLOAT(latency_sec), M_RANGE(0, 100)}, - {"broken-eof", OPT_FLAG(broken_eof)}, - {"broken-delay", OPT_FLAG(broken_delay)}, + {"broken-eof", OPT_BOOL(broken_eof)}, + {"broken-delay", OPT_BOOL(broken_delay)}, {"channel-layouts", OPT_CHANNELS(channel_layouts)}, {"format", OPT_AUDIOFORMAT(format)}, {0} diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c index 080ecaf280..7172908e70 100644 --- a/audio/out/ao_openal.c +++ b/audio/out/ao_openal.c @@ -56,7 +56,7 @@ struct priv { ALenum al_format; int num_buffers; int num_samples; - int direct_channels; + bool direct_channels; }; static int control(struct ao *ao, enum aocontrol cmd, void *arg) @@ -389,12 +389,12 @@ const struct ao_driver audio_out_openal = { .priv_defaults = &(const struct priv) { .num_buffers = 4, .num_samples = 8192, - .direct_channels = 1, + .direct_channels = true, }, .options = (const struct m_option[]) { {"num-buffers", OPT_INT(num_buffers), M_RANGE(2, MAX_BUF)}, {"num-samples", OPT_INT(num_samples), M_RANGE(256, MAX_SAMPLES)}, - {"direct-channels", OPT_FLAG(direct_channels)}, + {"direct-channels", OPT_BOOL(direct_channels)}, {0} }, .options_prefix = "openal", diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index daa35da9d2..6ab0ca03f0 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -404,6 +404,5 @@ const struct ao_driver audio_out_oss = { .priv_size = sizeof(struct priv), .priv_defaults = &(const struct priv) { .dsp_fd = -1, - .playing = false, }, }; diff --git a/audio/out/ao_pcm.c b/audio/out/ao_pcm.c index bbf6c2c554..4097aa3bd6 100644 --- a/audio/out/ao_pcm.c +++ b/audio/out/ao_pcm.c @@ -42,8 +42,8 @@ struct priv { char *outputfilename; - int waveheader; - int append; + bool waveheader; + bool append; uint64_t data_length; FILE *fp; }; @@ -237,11 +237,11 @@ const struct ao_driver audio_out_pcm = { .start = start, .reset = reset, .priv_size = sizeof(struct priv), - .priv_defaults = &(const struct priv) { .waveheader = 1 }, + .priv_defaults = &(const struct priv) { .waveheader = true }, .options = (const struct m_option[]) { {"file", OPT_STRING(outputfilename), .flags = M_OPT_FILE}, - {"waveheader", OPT_FLAG(waveheader)}, - {"append", OPT_FLAG(append)}, + {"waveheader", OPT_BOOL(waveheader)}, + {"append", OPT_BOOL(append)}, {0} }, .options_prefix = "ao-pcm", diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index 998ca04e80..ae19c875c0 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -56,8 +56,8 @@ struct priv { char *cfg_host; int cfg_buffer; - int cfg_latency_hacks; - int cfg_allow_suspended; + bool cfg_latency_hacks; + bool cfg_allow_suspended; }; #define GENERIC_ERR_MSG(str) \ @@ -810,8 +810,8 @@ const struct ao_driver audio_out_pulse = { {"host", OPT_STRING(cfg_host)}, {"buffer", OPT_CHOICE(cfg_buffer, {"native", 0}), M_RANGE(1, 2000)}, - {"latency-hacks", OPT_FLAG(cfg_latency_hacks)}, - {"allow-suspended", OPT_FLAG(cfg_allow_suspended)}, + {"latency-hacks", OPT_BOOL(cfg_latency_hacks)}, + {"allow-suspended", OPT_BOOL(cfg_allow_suspended)}, {0} }, .options_prefix = "pulse", diff --git a/common/encode.h b/common/encode.h index c951e95d51..85fc3f1960 100644 --- a/common/encode.h +++ b/common/encode.h @@ -40,10 +40,10 @@ struct encode_opts { char **aopts; float voffset; float aoffset; - int rawts; - int video_first; - int audio_first; - int copy_metadata; + bool rawts; + bool video_first; + bool audio_first; + bool copy_metadata; char **set_metadata; char **remove_metadata; }; diff --git a/common/encode_lavc.c b/common/encode_lavc.c index 87fe88e33f..7a9a20a517 100644 --- a/common/encode_lavc.c +++ b/common/encode_lavc.c @@ -87,12 +87,12 @@ const struct m_sub_options encode_config = { .deprecation_message = "--audio-delay (once unbroken)"}, {"oaoffset", OPT_FLOAT(aoffset), M_RANGE(-1000000.0, 1000000.0), .deprecation_message = "--audio-delay (once unbroken)"}, - {"orawts", OPT_FLAG(rawts)}, - {"ovfirst", OPT_FLAG(video_first), + {"orawts", OPT_BOOL(rawts)}, + {"ovfirst", OPT_BOOL(video_first), .deprecation_message = "no replacement"}, - {"oafirst", OPT_FLAG(audio_first), + {"oafirst", OPT_BOOL(audio_first), .deprecation_message = "no replacement"}, - {"ocopy-metadata", OPT_FLAG(copy_metadata)}, + {"ocopy-metadata", OPT_BOOL(copy_metadata)}, {"oset-metadata", OPT_KEYVALUELIST(set_metadata)}, {"oremove-metadata", OPT_STRINGLIST(remove_metadata)}, @@ -106,7 +106,7 @@ const struct m_sub_options encode_config = { }, .size = sizeof(struct encode_opts), .defaults = &(const struct encode_opts){ - .copy_metadata = 1, + .copy_metadata = true, }, }; diff --git a/demux/demux.c b/demux/demux.c index 79fa1aaebe..3d4c2fb692 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -86,24 +86,24 @@ static const demuxer_desc_t *const demuxer_list[] = { struct demux_opts { int enable_cache; - int disk_cache; + bool disk_cache; int64_t max_bytes; int64_t max_bytes_bw; - int donate_fw; + bool donate_fw; double min_secs; double hyst_secs; - int force_seekable; + bool force_seekable; double min_secs_cache; - int access_references; + bool access_references; int seekable_cache; - int create_ccs; + bool create_ccs; char *record_file; int video_back_preroll; int audio_back_preroll; int back_batch[STREAM_TYPE_COUNT]; double back_seek_size; char *meta_cp; - int force_retry_eof; + bool force_retry_eof; }; #define OPT_BASE_STRUCT struct demux_opts @@ -114,20 +114,20 @@ const struct m_sub_options demux_conf = { .opts = (const struct m_option[]){ {"cache", OPT_CHOICE(enable_cache, {"no", 0}, {"auto", -1}, {"yes", 1})}, - {"cache-on-disk", OPT_FLAG(disk_cache)}, + {"cache-on-disk", OPT_BOOL(disk_cache)}, {"demuxer-readahead-secs", OPT_DOUBLE(min_secs), M_RANGE(0, DBL_MAX)}, {"demuxer-hysteresis-secs", OPT_DOUBLE(hyst_secs), M_RANGE(0, DBL_MAX)}, {"demuxer-max-bytes", OPT_BYTE_SIZE(max_bytes), M_RANGE(0, M_MAX_MEM_BYTES)}, {"demuxer-max-back-bytes", OPT_BYTE_SIZE(max_bytes_bw), M_RANGE(0, M_MAX_MEM_BYTES)}, - {"demuxer-donate-buffer", OPT_FLAG(donate_fw)}, - {"force-seekable", OPT_FLAG(force_seekable)}, + {"demuxer-donate-buffer", OPT_BOOL(donate_fw)}, + {"force-seekable", OPT_BOOL(force_seekable)}, {"cache-secs", OPT_DOUBLE(min_secs_cache), M_RANGE(0, DBL_MAX)}, - {"access-references", OPT_FLAG(access_references)}, + {"access-references", OPT_BOOL(access_references)}, {"demuxer-seekable-cache", OPT_CHOICE(seekable_cache, {"auto", -1}, {"no", 0}, {"yes", 1})}, - {"sub-create-cc-track", OPT_FLAG(create_ccs)}, + {"sub-create-cc-track", OPT_BOOL(create_ccs)}, {"stream-record", OPT_STRING(record_file)}, {"video-backward-overlap", OPT_CHOICE(video_back_preroll, {"auto", -1}), M_RANGE(0, 1024)}, @@ -140,7 +140,7 @@ const struct m_sub_options demux_conf = { {"demuxer-backward-playback-step", OPT_DOUBLE(back_seek_size), M_RANGE(0, DBL_MAX)}, {"metadata-codepage", OPT_STRING(meta_cp)}, - {"demuxer-force-retry-on-eof", OPT_FLAG(force_retry_eof), + {"demuxer-force-retry-on-eof", OPT_BOOL(force_retry_eof), .deprecation_message = "temporary debug option, no replacement"}, {0} }, @@ -149,11 +149,11 @@ const struct m_sub_options demux_conf = { .enable_cache = -1, // auto .max_bytes = 150 * 1024 * 1024, .max_bytes_bw = 50 * 1024 * 1024, - .donate_fw = 1, + .donate_fw = true, .min_secs = 1.0, .min_secs_cache = 1000.0 * 60 * 60, .seekable_cache = -1, - .access_references = 1, + .access_references = true, .video_back_preroll = -1, .audio_back_preroll = -1, .back_seek_size = 60, diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index f4d3f96fdf..efe7f45ae9 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -76,14 +76,14 @@ struct demux_lavf_opts { int probescore; float analyzeduration; int buffersize; - int allow_mimetype; + bool allow_mimetype; char *format; char **avopts; - int hacks; + bool hacks; char *sub_cp; int rtsp_transport; int linearize_ts; - int propagate_opts; + bool propagate_opts; }; const struct m_sub_options demux_lavf_conf = { @@ -96,10 +96,10 @@ const struct m_sub_options demux_lavf_conf = { M_RANGE(0, 3600)}, {"demuxer-lavf-buffersize", OPT_INT(buffersize), M_RANGE(1, 10 * 1024 * 1024), OPTDEF_INT(BIO_BUFFER_SIZE)}, - {"demuxer-lavf-allow-mimetype", OPT_FLAG(allow_mimetype)}, + {"demuxer-lavf-allow-mimetype", OPT_BOOL(allow_mimetype)}, {"demuxer-lavf-probescore", OPT_INT(probescore), M_RANGE(1, AVPROBE_SCORE_MAX)}, - {"demuxer-lavf-hacks", OPT_FLAG(hacks)}, + {"demuxer-lavf-hacks", OPT_BOOL(hacks)}, {"demuxer-lavf-o", OPT_KEYVALUELIST(avopts)}, {"sub-codepage", OPT_STRING(sub_cp)}, {"rtsp-transport", OPT_CHOICE(rtsp_transport, @@ -110,14 +110,14 @@ const struct m_sub_options demux_lavf_conf = { {"udp_multicast", 4})}, {"demuxer-lavf-linearize-timestamps", OPT_CHOICE(linearize_ts, {"no", 0}, {"auto", -1}, {"yes", 1})}, - {"demuxer-lavf-propagate-opts", OPT_FLAG(propagate_opts)}, + {"demuxer-lavf-propagate-opts", OPT_BOOL(propagate_opts)}, {0} }, .size = sizeof(struct demux_lavf_opts), .defaults = &(const struct demux_lavf_opts){ .probeinfo = -1, - .allow_mimetype = 1, - .hacks = 1, + .allow_mimetype = true, + .hacks = true, // AVPROBE_SCORE_MAX/4 + 1 is the "recommended" limit. Below that, the // user is supposed to retry with larger probe sizes until a higher // value is reached. @@ -125,7 +125,7 @@ const struct m_sub_options demux_lavf_conf = { .sub_cp = "auto", .rtsp_transport = 2, .linearize_ts = -1, - .propagate_opts = 1, + .propagate_opts = true, }, }; diff --git a/demux/demux_libarchive.c b/demux/demux_libarchive.c index 9873232851..ec5049849d 100644 --- a/demux/demux_libarchive.c +++ b/demux/demux_libarchive.c @@ -28,7 +28,7 @@ #include "stream/stream_libarchive.h" struct demux_libarchive_opts { - int rar_list_all_volumes; + bool rar_list_all_volumes; }; static int cmp_filename(const void *a, const void *b) @@ -112,7 +112,7 @@ const struct demuxer_desc demuxer_desc_libarchive = { .open = open_file, .options = &(const struct m_sub_options){ .opts = (const struct m_option[]) { - {"rar-list-all-volumes", OPT_FLAG(rar_list_all_volumes)}, + {"rar-list-all-volumes", OPT_BOOL(rar_list_all_volumes)}, {0} }, .size = sizeof(OPT_BASE_STRUCT), diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index bd454cb143..3f0472dae9 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -224,7 +224,7 @@ struct demux_mkv_opts { double subtitle_preroll_secs; double subtitle_preroll_secs_index; int probe_duration; - int probe_start_time; + bool probe_start_time; }; const struct m_sub_options demux_mkv_conf = { @@ -237,7 +237,7 @@ const struct m_sub_options demux_mkv_conf = { M_RANGE(0, DBL_MAX)}, {"probe-video-duration", OPT_CHOICE(probe_duration, {"no", 0}, {"yes", 1}, {"full", 2})}, - {"probe-start-time", OPT_FLAG(probe_start_time)}, + {"probe-start-time", OPT_BOOL(probe_start_time)}, {0} }, .size = sizeof(struct demux_mkv_opts), @@ -245,7 +245,7 @@ const struct m_sub_options demux_mkv_conf = { .subtitle_preroll = 2, .subtitle_preroll_secs = 1.0, .subtitle_preroll_secs_index = 10.0, - .probe_start_time = 1, + .probe_start_time = true, }, }; diff --git a/filters/f_decoder_wrapper.c b/filters/f_decoder_wrapper.c index 4d0a8e7ac4..b0c174955b 100644 --- a/filters/f_decoder_wrapper.c +++ b/filters/f_decoder_wrapper.c @@ -53,7 +53,7 @@ #include "filter_internal.h" struct dec_queue_opts { - int use_queue; + bool use_queue; int64_t max_bytes; int64_t max_samples; double max_duration; @@ -62,7 +62,7 @@ struct dec_queue_opts { #define OPT_BASE_STRUCT struct dec_queue_opts static const struct m_option dec_queue_opts_list[] = { - {"enable", OPT_FLAG(use_queue)}, + {"enable", OPT_BOOL(use_queue)}, {"max-secs", OPT_DOUBLE(max_duration), M_RANGE(0, DBL_MAX)}, {"max-bytes", OPT_BYTE_SIZE(max_bytes), M_RANGE(0, M_MAX_MEM_BYTES)}, {"max-samples", OPT_INT64(max_samples), M_RANGE(0, DBL_MAX)}, @@ -73,7 +73,6 @@ static const struct m_sub_options vdec_queue_conf = { .opts = dec_queue_opts_list, .size = sizeof(struct dec_queue_opts), .defaults = &(const struct dec_queue_opts){ - .use_queue = 0, .max_bytes = 512 * 1024 * 1024, .max_samples = 50, .max_duration = 2, @@ -84,7 +83,6 @@ static const struct m_sub_options adec_queue_conf = { .opts = dec_queue_opts_list, .size = sizeof(struct dec_queue_opts), .defaults = &(const struct dec_queue_opts){ - .use_queue = 0, .max_bytes = 1 * 1024 * 1024, .max_samples = 48000, .max_duration = 1, @@ -98,7 +96,7 @@ struct dec_wrapper_opts { float movie_aspect; int aspect_method; double force_fps; - int correct_pts; + bool correct_pts; int video_rotate; char *audio_decoders; char *video_decoders; @@ -114,7 +112,7 @@ static int decoder_list_help(struct mp_log *log, const m_option_t *opt, const struct m_sub_options dec_wrapper_conf = { .opts = (const struct m_option[]){ - {"correct-pts", OPT_FLAG(correct_pts)}, + {"correct-pts", OPT_BOOL(correct_pts)}, {"fps", OPT_DOUBLE(force_fps), M_RANGE(0, DBL_MAX)}, {"ad", OPT_STRING(audio_decoders), .help = decoder_list_help}, @@ -139,7 +137,7 @@ const struct m_sub_options dec_wrapper_conf = { }, .size = sizeof(struct dec_wrapper_opts), .defaults = &(const struct dec_wrapper_opts){ - .correct_pts = 1, + .correct_pts = true, .movie_aspect = -1., .aspect_method = 2, .video_reverse_size = 1 * 1024 * 1024 * 1024, diff --git a/filters/f_lavfi.c b/filters/f_lavfi.c index 14ed2483a2..597cf91fc0 100644 --- a/filters/f_lavfi.c +++ b/filters/f_lavfi.c @@ -946,7 +946,7 @@ struct lavfi_user_opts { char *filter_name; char **filter_opts; - int fix_pts; + bool fix_pts; char *hwdec_interop; }; @@ -1119,7 +1119,7 @@ const struct mp_user_filter_entry af_lavfi = { .priv_size = sizeof(OPT_BASE_STRUCT), .options = (const m_option_t[]){ {"graph", OPT_STRING(graph)}, - {"fix-pts", OPT_FLAG(fix_pts)}, + {"fix-pts", OPT_BOOL(fix_pts)}, {"o", OPT_KEYVALUELIST(avopts)}, {"hwdec_interop", OPT_STRING_VALIDATE(hwdec_interop, diff --git a/filters/f_swresample.c b/filters/f_swresample.c index 60f9082ad3..fb1ef05194 100644 --- a/filters/f_swresample.c +++ b/filters/f_swresample.c @@ -71,9 +71,9 @@ const struct m_sub_options resample_conf = { .opts = (const m_option_t[]) { {"audio-resample-filter-size", OPT_INT(filter_size), M_RANGE(0, 32)}, {"audio-resample-phase-shift", OPT_INT(phase_shift), M_RANGE(0, 30)}, - {"audio-resample-linear", OPT_FLAG(linear)}, + {"audio-resample-linear", OPT_BOOL(linear)}, {"audio-resample-cutoff", OPT_DOUBLE(cutoff), M_RANGE(0, 1)}, - {"audio-normalize-downmix", OPT_FLAG(normalize)}, + {"audio-normalize-downmix", OPT_BOOL(normalize)}, {"audio-resample-max-output-size", OPT_DOUBLE(max_output_frame_size)}, {"audio-swresample-o", OPT_KEYVALUELIST(avopts)}, {0} diff --git a/filters/f_swresample.h b/filters/f_swresample.h index 10d6176a56..8ef33357e8 100644 --- a/filters/f_swresample.h +++ b/filters/f_swresample.h @@ -19,9 +19,9 @@ struct mp_swresample { struct mp_resample_opts { int filter_size; int phase_shift; - int linear; + bool linear; double cutoff; - int normalize; + bool normalize; int allow_passthrough; double max_output_frame_size; char **avopts; diff --git a/filters/filter.c b/filters/filter.c index eb757f5753..e07caef131 100644 --- a/filters/filter.c +++ b/filters/filter.c @@ -693,7 +693,6 @@ struct mp_hwdec_ctx *mp_filter_load_hwdec_device(struct mp_filter *f, int imgfmt struct hwdec_imgfmt_request params = { .imgfmt = imgfmt, - .probing = false, }; hwdec_devices_request_for_img_fmt(info->hwdec_devs, ¶ms); diff --git a/input/input.c b/input/input.c index 6afbc2094d..dec8d0235d 100644 --- a/input/input.c +++ b/input/input.c @@ -171,15 +171,15 @@ struct input_opts { // Autorepeat config (be aware of mp_input_set_repeat_info()) int ar_delay; int ar_rate; - int use_alt_gr; - int use_gamepad; - int use_media_keys; - int default_bindings; - int builtin_bindings; - int enable_mouse_movements; - int vo_key_input; - int test; - int allow_win_drag; + bool use_alt_gr; + bool use_gamepad; + bool use_media_keys; + bool default_bindings; + bool builtin_bindings; + bool enable_mouse_movements; + bool vo_key_input; + bool test; + bool allow_win_drag; }; const struct m_sub_options input_config = { @@ -189,20 +189,20 @@ const struct m_sub_options input_config = { {"input-ar-rate", OPT_INT(ar_rate)}, {"input-keylist", OPT_PRINT(mp_print_key_list)}, {"input-cmdlist", OPT_PRINT(mp_print_cmd_list)}, - {"input-default-bindings", OPT_FLAG(default_bindings)}, - {"input-builtin-bindings", OPT_FLAG(builtin_bindings)}, - {"input-test", OPT_FLAG(test)}, + {"input-default-bindings", OPT_BOOL(default_bindings)}, + {"input-builtin-bindings", OPT_BOOL(builtin_bindings)}, + {"input-test", OPT_BOOL(test)}, {"input-doubleclick-time", OPT_INT(doubleclick_time), M_RANGE(0, 1000)}, - {"input-right-alt-gr", OPT_FLAG(use_alt_gr)}, + {"input-right-alt-gr", OPT_BOOL(use_alt_gr)}, {"input-key-fifo-size", OPT_INT(key_fifo_size), M_RANGE(2, 65000)}, - {"input-cursor", OPT_FLAG(enable_mouse_movements)}, - {"input-vo-keyboard", OPT_FLAG(vo_key_input)}, - {"input-media-keys", OPT_FLAG(use_media_keys)}, + {"input-cursor", OPT_BOOL(enable_mouse_movements)}, + {"input-vo-keyboard", OPT_BOOL(vo_key_input)}, + {"input-media-keys", OPT_BOOL(use_media_keys)}, #if HAVE_SDL2_GAMEPAD - {"input-gamepad", OPT_FLAG(use_gamepad)}, + {"input-gamepad", OPT_BOOL(use_gamepad)}, #endif - {"window-dragging", OPT_FLAG(allow_win_drag)}, + {"window-dragging", OPT_BOOL(allow_win_drag)}, {"input-x11-keyboard", OPT_REPLACED("input-vo-keyboard")}, #if HAVE_COCOA {"input-appleremote", OPT_REMOVED("replaced by MediaPlayer support")}, @@ -215,13 +215,13 @@ const struct m_sub_options input_config = { .doubleclick_time = 300, .ar_delay = 200, .ar_rate = 40, - .use_alt_gr = 1, - .enable_mouse_movements = 1, - .use_media_keys = 1, - .default_bindings = 1, - .builtin_bindings = 1, - .vo_key_input = 1, - .allow_win_drag = 1, + .use_alt_gr = true, + .enable_mouse_movements = true, + .use_media_keys = true, + .default_bindings = true, + .builtin_bindings = true, + .vo_key_input = true, + .allow_win_drag = true, }, .change_flags = UPDATE_INPUT, }; @@ -1474,7 +1474,6 @@ void mp_input_bind_key(struct input_ctx *ictx, int key, bstr command) .cmd = bstrdup0(bs->binds, command), .location = talloc_strdup(bs->binds, "keybind-command"), .owner = bs, - .is_builtin = false, .num_keys = 1, }; memcpy(bind->keys, &key, 1 * sizeof(bind->keys[0])); @@ -1698,4 +1697,3 @@ void mp_input_set_repeat_info(struct input_ctx *ictx, int rate, int delay) ictx->opts->ar_delay = delay; input_unlock(ictx); } - 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; int audio_display; char **display_tags; char **audio_files; char *demuxer_name; - int demuxer_thread; + bool demuxer_thread; double demux_termination_timeout; - int demuxer_cache_wait; - int prefetch_open; + bool demuxer_cache_wait; + bool prefetch_open; char *audio_demuxer_name; char *sub_demuxer_name; - int cache_pause; - int cache_pause_initial; + bool cache_pause; + bool cache_pause_initial; float cache_pause_wait; struct image_writer_opts *screenshot_image_opts; @@ -292,7 +292,7 @@ typedef struct MPOpts { int audio_output_format; int force_srate; double playback_speed; - int pitch_correction; + bool pitch_correction; struct m_obj_settings *vf_settings, *vf_defs; struct m_obj_settings *af_settings, *af_defs; struct filter_opts *filter_opts; @@ -302,12 +302,12 @@ typedef struct MPOpts { char **audiofile_paths; char **coverart_files; char **external_files; - int autoload_files; + bool autoload_files; int sub_auto; int audiofile_auto; int coverart_auto; bool coverart_whitelist; - int osd_bar_visible; + bool osd_bar_visible; int w32_priority; @@ -374,7 +374,7 @@ struct dvd_opts { }; struct filter_opts { - int deinterlace; + bool deinterlace; }; extern const struct m_sub_options vo_sub_opts; diff --git a/osdep/macos/mpv_helper.swift b/osdep/macos/mpv_helper.swift index 6fde975c06..3b2a7162cb 100644 --- a/osdep/macos/mpv_helper.swift +++ b/osdep/macos/mpv_helper.swift @@ -92,14 +92,14 @@ class MPVHelper { } func setOption(minimized: Bool) { - optsPtr.pointee.window_minimized = Int32(minimized) + optsPtr.pointee.window_minimized = minimized _ = withUnsafeMutableBytes(of: &optsPtr.pointee.window_minimized) { (ptr: UnsafeMutableRawBufferPointer) in m_config_cache_write_opt(optsCachePtr, ptr.baseAddress) } } func setOption(maximized: Bool) { - optsPtr.pointee.window_maximized = Int32(maximized) + optsPtr.pointee.window_maximized = maximized _ = withUnsafeMutableBytes(of: &optsPtr.pointee.window_maximized) { (ptr: UnsafeMutableRawBufferPointer) in m_config_cache_write_opt(optsCachePtr, ptr.baseAddress) } diff --git a/osdep/macosx_application.h b/osdep/macosx_application.h index 05d0b07c07..d95940fd31 100644 --- a/osdep/macosx_application.h +++ b/osdep/macosx_application.h @@ -32,11 +32,11 @@ struct macos_opts { int macos_title_bar_material; struct m_color macos_title_bar_color; int macos_fs_animation_duration; - int macos_force_dedicated_gpu; + bool macos_force_dedicated_gpu; int macos_app_activation_policy; int macos_geometry_calculation; int cocoa_cb_sw_renderer; - int cocoa_cb_10bit_context; + bool cocoa_cb_10bit_context; }; // multithreaded wrapper for mpv_main diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index bb8b67b575..95f6a9fcd2 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -62,14 +62,14 @@ const struct m_sub_options macos_conf = { {"macos-fs-animation-duration", OPT_CHOICE(macos_fs_animation_duration, {"default", -1}), M_RANGE(0, 1000)}, - {"macos-force-dedicated-gpu", OPT_FLAG(macos_force_dedicated_gpu)}, + {"macos-force-dedicated-gpu", OPT_BOOL(macos_force_dedicated_gpu)}, {"macos-app-activation-policy", OPT_CHOICE(macos_app_activation_policy, {"regular", 0}, {"accessory", 1}, {"prohibited", 2})}, {"macos-geometry-calculation", OPT_CHOICE(macos_geometry_calculation, {"visible", FRAME_VISIBLE}, {"whole", FRAME_WHOLE})}, {"cocoa-cb-sw-renderer", OPT_CHOICE(cocoa_cb_sw_renderer, {"auto", -1}, {"no", 0}, {"yes", 1})}, - {"cocoa-cb-10bit-context", OPT_FLAG(cocoa_cb_10bit_context)}, + {"cocoa-cb-10bit-context", OPT_BOOL(cocoa_cb_10bit_context)}, {"macos-title-bar-style", OPT_REMOVED("Split into --macos-title-bar-appearance " "and --macos-title-bar-material")}, {0} @@ -79,7 +79,7 @@ const struct m_sub_options macos_conf = { .macos_title_bar_color = {0, 0, 0, 0}, .macos_fs_animation_duration = -1, .cocoa_cb_sw_renderer = -1, - .cocoa_cb_10bit_context = 1 + .cocoa_cb_10bit_context = true }, }; diff --git a/player/loadfile.c b/player/loadfile.c index 38f11af9ac..9c76ddafde 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1691,7 +1691,7 @@ terminate_playback: update_core_idle_state(mpctx); if (mpctx->step_frames) { - opts->pause = 1; + opts->pause = true; m_config_notify_change_opt_ptr(mpctx->mconfig, &opts->pause); } diff --git a/stream/dvbin.h b/stream/dvbin.h index 2bb494d3d9..9bb06abe36 100644 --- a/stream/dvbin.h +++ b/stream/dvbin.h @@ -91,7 +91,7 @@ typedef struct { int cfg_devno; int cfg_timeout; char *cfg_file; - int cfg_full_transponder; + bool cfg_full_transponder; int cfg_channel_switch_offset; } dvb_opts_t; diff --git a/stream/stream.c b/stream/stream.c index 436bc7f779..263c7f5e72 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -103,7 +103,7 @@ static const stream_info_t *const stream_list[] = { struct stream_opts { int64_t buffer_size; - int load_unsafe_playlists; + bool load_unsafe_playlists; }; #define OPT_BASE_STRUCT struct stream_opts @@ -112,7 +112,7 @@ const struct m_sub_options stream_conf = { .opts = (const struct m_option[]){ {"stream-buffer-size", OPT_BYTE_SIZE(buffer_size), M_RANGE(STREAM_MIN_BUFFER_SIZE, STREAM_MAX_BUFFER_SIZE)}, - {"load-unsafe-playlists", OPT_FLAG(load_unsafe_playlists)}, + {"load-unsafe-playlists", OPT_BOOL(load_unsafe_playlists)}, {0} }, .size = sizeof(struct stream_opts), @@ -353,8 +353,8 @@ static int stream_create_instance(const stream_info_t *sinfo, if (flags & STREAM_LESS_NOISE) mp_msg_set_max_level(s->log, MSGL_WARN); - int opt; - mp_read_option_raw(s->global, "access-references", &m_option_type_flag, &opt); + bool opt; + mp_read_option_raw(s->global, "access-references", &m_option_type_bool, &opt); s->access_references = opt; MP_VERBOSE(s, "Opening %s\n", url); diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index b00bb22539..9a30d6ca23 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -67,10 +67,10 @@ typedef struct cdda_params { int search_overlap; int toc_bias; int toc_offset; - int skip; + bool skip; char *device; int span[2]; - int cdtext; + bool cdtext; } cdda_priv; #define OPT_BASE_STRUCT struct cdda_params @@ -82,17 +82,17 @@ const struct m_sub_options stream_cdda_conf = { {"overlap", OPT_INT(search_overlap), M_RANGE(0, 75)}, {"toc-bias", OPT_INT(toc_bias)}, {"toc-offset", OPT_INT(toc_offset)}, - {"skip", OPT_FLAG(skip)}, + {"skip", OPT_BOOL(skip)}, {"span-a", OPT_INT(span[0])}, {"span-b", OPT_INT(span[1])}, - {"cdtext", OPT_FLAG(cdtext)}, + {"cdtext", OPT_BOOL(cdtext)}, {"span", OPT_REMOVED("use span-a/span-b")}, {0} }, .size = sizeof(struct cdda_params), .defaults = &(const struct cdda_params){ .search_overlap = -1, - .skip = 1, + .skip = true, }, }; diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 22a2d300b1..14ff2f4ca4 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -77,7 +77,7 @@ const struct m_sub_options stream_dvb_conf = { {"card", OPT_INT(cfg_devno), M_RANGE(0, MAX_ADAPTERS-1)}, {"timeout", OPT_INT(cfg_timeout), M_RANGE(1, 30)}, {"file", OPT_STRING(cfg_file), .flags = M_OPT_FILE}, - {"full-transponder", OPT_FLAG(cfg_full_transponder)}, + {"full-transponder", OPT_BOOL(cfg_full_transponder)}, {"channel-switch-offset", OPT_INT(cfg_channel_switch_offset), .flags = UPDATE_DVB_PROG}, {0} diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c index 0886ef8a61..b99243448f 100644 --- a/stream/stream_lavf.c +++ b/stream/stream_lavf.c @@ -37,12 +37,12 @@ #define OPT_BASE_STRUCT struct stream_lavf_params struct stream_lavf_params { char **avopts; - int cookies_enabled; + bool cookies_enabled; char *cookies_file; char *useragent; char *referrer; char **http_header_fields; - int tls_verify; + bool tls_verify; char *tls_ca_file; char *tls_cert_file; char *tls_key_file; @@ -56,9 +56,9 @@ const struct m_sub_options stream_lavf_conf = { {"http-header-fields", OPT_STRINGLIST(http_header_fields)}, {"user-agent", OPT_STRING(useragent)}, {"referrer", OPT_STRING(referrer)}, - {"cookies", OPT_FLAG(cookies_enabled)}, + {"cookies", OPT_BOOL(cookies_enabled)}, {"cookies-file", OPT_STRING(cookies_file), .flags = M_OPT_FILE}, - {"tls-verify", OPT_FLAG(tls_verify)}, + {"tls-verify", OPT_BOOL(tls_verify)}, {"tls-ca-file", OPT_STRING(tls_ca_file), .flags = M_OPT_FILE}, {"tls-cert-file", OPT_STRING(tls_cert_file), .flags = M_OPT_FILE}, {"tls-key-file", OPT_STRING(tls_key_file), .flags = M_OPT_FILE}, diff --git a/stream/stream_slice.c b/stream/stream_slice.c index c0dbeeb2af..88a611c4ad 100644 --- a/stream/stream_slice.c +++ b/stream/stream_slice.c @@ -177,5 +177,4 @@ const stream_info_t stream_info_slice = { .name = "slice", .open2 = open2, .protocols = (const char*const[]){ "slice", NULL }, - .can_write = false, }; diff --git a/sub/osd.c b/sub/osd.c index 6892925e25..8bbd077290 100644 --- a/sub/osd.c +++ b/sub/osd.c @@ -61,8 +61,8 @@ static const m_option_t style_opts[] = { {"align-y", OPT_CHOICE(align_y, {"top", -1}, {"center", 0}, {"bottom", +1})}, {"blur", OPT_FLOAT(blur), M_RANGE(0, 20)}, - {"bold", OPT_FLAG(bold)}, - {"italic", OPT_FLAG(italic)}, + {"bold", OPT_BOOL(bold)}, + {"italic", OPT_BOOL(italic)}, {"justify", OPT_CHOICE(justify, {"auto", 0}, {"left", 1}, {"center", 2}, {"right", 3})}, {"font-provider", OPT_CHOICE(font_provider, diff --git a/sub/osd.h b/sub/osd.h index 168f86320e..9b87dcc58a 100644 --- a/sub/osd.h +++ b/sub/osd.h @@ -153,8 +153,8 @@ struct osd_style_opts { int align_x; int align_y; float blur; - int bold; - int italic; + bool bold; + bool italic; int justify; int font_provider; }; diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 2817bfedd5..82d78787d6 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -70,17 +70,17 @@ static int hwdec_opt_help(struct mp_log *log, const m_option_t *opt, #define OPT_BASE_STRUCT struct vd_lavc_params struct vd_lavc_params { - int fast; + bool fast; int film_grain; - int show_all; + bool show_all; int skip_loop_filter; int skip_idct; int skip_frame; int framedrop; int threads; - int bitexact; - int old_x264; - int check_hw_profile; + bool bitexact; + bool old_x264; + bool check_hw_profile; int software_fallback; char **avopts; int dr; @@ -103,18 +103,18 @@ static const struct m_opt_choice_alternatives discard_names[] = { const struct m_sub_options vd_lavc_conf = { .opts = (const m_option_t[]){ - {"vd-lavc-fast", OPT_FLAG(fast)}, + {"vd-lavc-fast", OPT_BOOL(fast)}, {"vd-lavc-film-grain", OPT_CHOICE(film_grain, {"auto", -1}, {"cpu", 0}, {"gpu", 1})}, - {"vd-lavc-show-all", OPT_FLAG(show_all)}, + {"vd-lavc-show-all", OPT_BOOL(show_all)}, {"vd-lavc-skiploopfilter", OPT_DISCARD(skip_loop_filter)}, {"vd-lavc-skipidct", OPT_DISCARD(skip_idct)}, {"vd-lavc-skipframe", OPT_DISCARD(skip_frame)}, {"vd-lavc-framedrop", OPT_DISCARD(framedrop)}, {"vd-lavc-threads", OPT_INT(threads), M_RANGE(0, DBL_MAX)}, - {"vd-lavc-bitexact", OPT_FLAG(bitexact)}, - {"vd-lavc-assume-old-x264", OPT_FLAG(old_x264)}, - {"vd-lavc-check-hw-profile", OPT_FLAG(check_hw_profile)}, + {"vd-lavc-bitexact", OPT_BOOL(bitexact)}, + {"vd-lavc-assume-old-x264", OPT_BOOL(old_x264)}, + {"vd-lavc-check-hw-profile", OPT_BOOL(check_hw_profile)}, {"vd-lavc-software-fallback", OPT_CHOICE(software_fallback, {"no", INT_MAX}, {"yes", 1}), M_RANGE(1, INT_MAX)}, {"vd-lavc-o", OPT_KEYVALUELIST(avopts)}, @@ -131,8 +131,7 @@ const struct m_sub_options vd_lavc_conf = { .size = sizeof(struct vd_lavc_params), .defaults = &(const struct vd_lavc_params){ .film_grain = -1 /*auto*/, - .show_all = 0, - .check_hw_profile = 1, + .check_hw_profile = true, .software_fallback = 3, .skip_loop_filter = AVDISCARD_DEFAULT, .skip_idct = AVDISCARD_DEFAULT, diff --git a/video/filter/vf_d3d11vpp.c b/video/filter/vf_d3d11vpp.c index 2f05219976..3f306e4be7 100644 --- a/video/filter/vf_d3d11vpp.c +++ b/video/filter/vf_d3d11vpp.c @@ -43,8 +43,8 @@ #define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_FRAME_RATE_CONVERSION 0x20 struct opts { - int deint_enabled; - int interlaced_only; + bool deint_enabled; + bool interlaced_only; int mode; }; @@ -429,7 +429,6 @@ static struct mp_filter *vf_d3d11vpp_create(struct mp_filter *parent, struct hwdec_imgfmt_request params = { .imgfmt = IMGFMT_D3D11, - .probing = false, }; hwdec_devices_request_for_img_fmt(info->hwdec_devs, ¶ms); @@ -479,8 +478,8 @@ fail: #define OPT_BASE_STRUCT struct opts static const m_option_t vf_opts_fields[] = { - {"deint", OPT_FLAG(deint_enabled)}, - {"interlaced-only", OPT_FLAG(interlaced_only)}, + {"deint", OPT_BOOL(deint_enabled)}, + {"interlaced-only", OPT_BOOL(interlaced_only)}, {"mode", OPT_CHOICE(mode, {"blend", D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND}, {"bob", D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB}, @@ -497,8 +496,7 @@ const struct mp_user_filter_entry vf_d3d11vpp = { .name = "d3d11vpp", .priv_size = sizeof(OPT_BASE_STRUCT), .priv_defaults = &(const OPT_BASE_STRUCT) { - .deint_enabled = 1, - .interlaced_only = 0, + .deint_enabled = true, .mode = D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB, }, .options = vf_opts_fields, diff --git a/video/filter/vf_fingerprint.c b/video/filter/vf_fingerprint.c index d06f80502d..8714382ff3 100644 --- a/video/filter/vf_fingerprint.c +++ b/video/filter/vf_fingerprint.c @@ -33,8 +33,8 @@ struct f_opts { int type; - int clear; - int print; + bool clear; + bool print; }; const struct m_opt_choice_alternatives type_names[] = { @@ -46,14 +46,14 @@ const struct m_opt_choice_alternatives type_names[] = { #define OPT_BASE_STRUCT struct f_opts static const struct m_option f_opts_list[] = { {"type", OPT_CHOICE_C(type, type_names)}, - {"clear-on-query", OPT_FLAG(clear)}, - {"print", OPT_FLAG(print)}, + {"clear-on-query", OPT_BOOL(clear)}, + {"print", OPT_BOOL(print)}, {0} }; static const struct f_opts f_opts_def = { .type = 16, - .clear = 1, + .clear = true, }; struct print_entry { @@ -212,7 +212,7 @@ static struct mp_filter *f_create(struct mp_filter *parent, void *options) .scaler_chroma_params = {NAN, NAN}, .scaler_chroma = ZIMG_RESIZE_BILINEAR, .dither = ZIMG_DITHER_NONE, - .fast = 1, + .fast = true, }; return f; } diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c index 6c3061ce0a..0073efab7f 100644 --- a/video/filter/vf_format.c +++ b/video/filter/vf_format.c @@ -55,10 +55,10 @@ struct vf_format_opts { int w, h; int dw, dh; double dar; - int convert; + bool convert; int force_scaler; - int dovi; - int film_grain; + bool dovi; + bool film_grain; }; static void set_params(struct vf_format_opts *p, struct mp_image_params *out, @@ -219,9 +219,9 @@ static const m_option_t vf_opts_fields[] = { {"dw", OPT_INT(dw)}, {"dh", OPT_INT(dh)}, {"dar", OPT_DOUBLE(dar)}, - {"convert", OPT_FLAG(convert)}, - {"dolbyvision", OPT_FLAG(dovi)}, - {"film-grain", OPT_FLAG(film_grain)}, + {"convert", OPT_BOOL(convert)}, + {"dolbyvision", OPT_BOOL(dovi)}, + {"film-grain", OPT_BOOL(film_grain)}, {"force-scaler", OPT_CHOICE(force_scaler, {"auto", MP_SWS_AUTO}, {"sws", MP_SWS_SWS}, @@ -238,8 +238,8 @@ const struct mp_user_filter_entry vf_format = { .priv_size = sizeof(OPT_BASE_STRUCT), .priv_defaults = &(const OPT_BASE_STRUCT){ .rotate = -1, - .dovi = 1, - .film_grain = 1, + .dovi = true, + .film_grain = true, }, .options = vf_opts_fields, }, diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c index c96b4b3a5b..5b30c46163 100644 --- a/video/filter/vf_vavpp.c +++ b/video/filter/vf_vavpp.c @@ -51,8 +51,8 @@ struct pipeline { struct opts { int deint_type; - int interlaced_only; - int reversal_bug; + bool interlaced_only; + bool reversal_bug; }; struct priv { @@ -482,8 +482,8 @@ static const m_option_t vf_opts_fields[] = { {"weave", 3}, {"motion-adaptive", 4}, {"motion-compensated", 5})}, - {"interlaced-only", OPT_FLAG(interlaced_only)}, - {"reversal-bug", OPT_FLAG(reversal_bug)}, + {"interlaced-only", OPT_BOOL(interlaced_only)}, + {"reversal-bug", OPT_BOOL(reversal_bug)}, {0} }; @@ -494,8 +494,7 @@ const struct mp_user_filter_entry vf_vavpp = { .priv_size = sizeof(OPT_BASE_STRUCT), .priv_defaults = &(const OPT_BASE_STRUCT){ .deint_type = -1, - .interlaced_only = 0, - .reversal_bug = 1, + .reversal_bug = true, }, .options = vf_opts_fields, }, diff --git a/video/filter/vf_vdpaupp.c b/video/filter/vf_vdpaupp.c index de5caa3534..0519f5a8b8 100644 --- a/video/filter/vf_vdpaupp.c +++ b/video/filter/vf_vdpaupp.c @@ -41,8 +41,8 @@ // processing on the final rendering process in the VO. struct opts { - int deint_enabled; - int interlaced_only; + bool deint_enabled; + bool interlaced_only; struct mp_vdpau_mixer_opts opts; }; @@ -174,13 +174,13 @@ static const m_option_t vf_opts_fields[] = { {"temporal", 3}, {"temporal-spatial", 4}), OPTDEF_INT(3)}, - {"deint", OPT_FLAG(deint_enabled)}, - {"chroma-deint", OPT_FLAG(opts.chroma_deint), OPTDEF_INT(1)}, - {"pullup", OPT_FLAG(opts.pullup)}, + {"deint", OPT_BOOL(deint_enabled)}, + {"chroma-deint", OPT_BOOL(opts.chroma_deint), OPTDEF_INT(1)}, + {"pullup", OPT_BOOL(opts.pullup)}, {"denoise", OPT_FLOAT(opts.denoise), M_RANGE(0, 1)}, {"sharpen", OPT_FLOAT(opts.sharpen), M_RANGE(-1, 1)}, {"hqscaling", OPT_INT(opts.hqscaling), M_RANGE(0, 9)}, - {"interlaced-only", OPT_FLAG(interlaced_only)}, + {"interlaced-only", OPT_BOOL(interlaced_only)}, {0} }; diff --git a/video/image_writer.c b/video/image_writer.c index 657ea6f64f..11f0f6fdb5 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -43,17 +43,16 @@ const struct image_writer_opts image_writer_opts_defaults = { .format = AV_CODEC_ID_MJPEG, - .high_bit_depth = 1, + .high_bit_depth = true, .png_compression = 7, .png_filter = 5, .jpeg_quality = 90, - .jpeg_source_chroma = 1, - .webp_lossless = 0, + .jpeg_source_chroma = true, .webp_quality = 75, .webp_compression = 4, .jxl_distance = 1.0, .jxl_effort = 4, - .tag_csp = 1, + .tag_csp = true, }; const struct m_opt_choice_alternatives mp_image_writer_formats[] = { @@ -72,18 +71,18 @@ const struct m_opt_choice_alternatives mp_image_writer_formats[] = { const struct m_option image_writer_opts[] = { {"format", OPT_CHOICE_C(format, mp_image_writer_formats)}, {"jpeg-quality", OPT_INT(jpeg_quality), M_RANGE(0, 100)}, - {"jpeg-source-chroma", OPT_FLAG(jpeg_source_chroma)}, + {"jpeg-source-chroma", OPT_BOOL(jpeg_source_chroma)}, {"png-compression", OPT_INT(png_compression), M_RANGE(0, 9)}, {"png-filter", OPT_INT(png_filter), M_RANGE(0, 5)}, - {"webp-lossless", OPT_FLAG(webp_lossless)}, + {"webp-lossless", OPT_BOOL(webp_lossless)}, {"webp-quality", OPT_INT(webp_quality), M_RANGE(0, 100)}, {"webp-compression", OPT_INT(webp_compression), M_RANGE(0, 6)}, #if HAVE_JPEGXL {"jxl-distance", OPT_DOUBLE(jxl_distance), M_RANGE(0.0, 15.0)}, {"jxl-effort", OPT_INT(jxl_effort), M_RANGE(1, 9)}, #endif - {"high-bit-depth", OPT_FLAG(high_bit_depth)}, - {"tag-colorspace", OPT_FLAG(tag_csp)}, + {"high-bit-depth", OPT_BOOL(high_bit_depth)}, + {"tag-colorspace", OPT_BOOL(tag_csp)}, {0}, }; diff --git a/video/image_writer.h b/video/image_writer.h index 8a9d67e5bf..c4a9cea386 100644 --- a/video/image_writer.h +++ b/video/image_writer.h @@ -22,7 +22,7 @@ struct mp_log; struct image_writer_opts { int format; - int high_bit_depth; + bool high_bit_depth; int png_compression; int png_filter; int jpeg_quality; @@ -31,13 +31,13 @@ struct image_writer_opts { int jpeg_dpi; int jpeg_progressive; int jpeg_baseline; - int jpeg_source_chroma; - int webp_lossless; + bool jpeg_source_chroma; + bool webp_lossless; int webp_quality; int webp_compression; double jxl_distance; int jxl_effort; - int tag_csp; + bool tag_csp; }; extern const struct image_writer_opts image_writer_opts_defaults; 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 #include +#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, + .opts.fixedpal = true, .opts.top = 0, .opts.left = 0, .opts.pad_y = -1, .opts.pad_x = -1, .opts.rows = 0, .opts.cols = 0, - .opts.config_clear = 1, - .opts.alt_screen = 1, - .opts.buffered = 0, + .opts.config_clear = true, + .opts.alt_screen = true, }, .options = (const m_option_t[]) { {"dither", OPT_CHOICE(opts.diffuse, @@ -616,7 +615,7 @@ const struct vo_driver video_out_sixel = { {"width", OPT_INT(opts.width)}, {"height", OPT_INT(opts.height)}, {"reqcolors", OPT_INT(opts.reqcolors)}, - {"fixedpalette", OPT_FLAG(opts.fixedpal)}, + {"fixedpalette", OPT_BOOL(opts.fixedpal)}, {"threshold", OPT_INT(opts.threshold)}, {"top", OPT_INT(opts.top)}, {"left", OPT_INT(opts.left)}, @@ -624,11 +623,11 @@ const struct vo_driver video_out_sixel = { {"pad-x", OPT_INT(opts.pad_x)}, {"rows", OPT_INT(opts.rows)}, {"cols", OPT_INT(opts.cols)}, - {"config-clear", OPT_FLAG(opts.config_clear), }, - {"exit-clear", OPT_FLAG(opts.alt_screen), + {"config-clear", OPT_BOOL(opts.config_clear), }, + {"exit-clear", OPT_BOOL(opts.alt_screen), .deprecation_message = "replaced by --vo-sixel-alt-screen"}, - {"alt-screen", OPT_FLAG(opts.alt_screen), }, - {"buffered", OPT_FLAG(opts.buffered), }, + {"alt-screen", OPT_BOOL(opts.alt_screen), }, + {"buffered", OPT_BOOL(opts.buffered), }, {0} }, .options_prefix = "vo-sixel", diff --git a/video/out/vo_tct.c b/video/out/vo_tct.c index abe749db13..af7c7ffd48 100644 --- a/video/out/vo_tct.c +++ b/video/out/vo_tct.c @@ -52,7 +52,7 @@ struct vo_tct_opts { int algo; int width; // 0 -> default int height; // 0 -> default - int term256; // 0 -> true color + bool term256; // 0 -> true color }; struct lut_item { @@ -339,7 +339,7 @@ const struct vo_driver video_out_tct = { {"half-blocks", ALGO_HALF_BLOCKS})}, {"width", OPT_INT(opts.width)}, {"height", OPT_INT(opts.height)}, - {"256", OPT_FLAG(opts.term256)}, + {"256", OPT_BOOL(opts.term256)}, {0} }, .options_prefix = "vo-tct", diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c index ad718b3085..009832c734 100644 --- a/video/out/vo_vaapi.c +++ b/video/out/vo_vaapi.c @@ -81,7 +81,7 @@ struct priv { int output_surface; int visible_surface; int scaling; - int force_scaled_osd; + bool force_scaled_osd; VAImageFormat osd_format; // corresponds to OSD_VA_FORMAT struct vaapi_osd_part osd_part; @@ -873,7 +873,7 @@ const struct vo_driver video_out_vaapi = { {"fast", VA_FILTER_SCALING_FAST}, {"hq", VA_FILTER_SCALING_HQ}, {"nla", VA_FILTER_SCALING_NL_ANAMORPHIC})}, - {"scaled-osd", OPT_FLAG(force_scaled_osd)}, + {"scaled-osd", OPT_BOOL(force_scaled_osd)}, {0} }, .options_prefix = "vo-vaapi", diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 02668c3621..d0ce4045c1 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -85,13 +85,13 @@ struct vdpctx { int output_surface_w, output_surface_h; int rotation; - int force_yuv; + bool force_yuv; struct mp_vdpau_mixer *video_mixer; - int pullup; + bool pullup; float denoise; float sharpen; int hqscaling; - int chroma_deint; + bool chroma_deint; int flip_offset_window; int flip_offset_fs; int64_t flip_offset_us; @@ -105,7 +105,7 @@ struct vdpctx { int query_surface_num; VdpTime recent_vsync_time; float user_fps; - int composite_detect; + bool composite_detect; int vsync_interval; uint64_t last_queue_time; uint64_t queue_time[MAX_OUTPUT_SURFACES]; @@ -1118,20 +1118,20 @@ const struct vo_driver video_out_vdpau = { .uninit = uninit, .priv_size = sizeof(struct vdpctx), .options = (const struct m_option []){ - {"chroma-deint", OPT_FLAG(chroma_deint), OPTDEF_INT(1)}, - {"pullup", OPT_FLAG(pullup)}, + {"chroma-deint", OPT_BOOL(chroma_deint), OPTDEF_INT(1)}, + {"pullup", OPT_BOOL(pullup)}, {"denoise", OPT_FLOAT(denoise), M_RANGE(0, 1)}, {"sharpen", OPT_FLOAT(sharpen), M_RANGE(-1, 1)}, {"hqscaling", OPT_INT(hqscaling), M_RANGE(0, 9)}, {"fps", OPT_FLOAT(user_fps)}, - {"composite-detect", OPT_FLAG(composite_detect), OPTDEF_INT(1)}, + {"composite-detect", OPT_BOOL(composite_detect), OPTDEF_INT(1)}, {"queuetime-windowed", OPT_INT(flip_offset_window), OPTDEF_INT(50)}, {"queuetime-fs", OPT_INT(flip_offset_fs), OPTDEF_INT(50)}, {"output-surfaces", OPT_INT(num_output_surfaces), M_RANGE(2, MAX_OUTPUT_SURFACES), OPTDEF_INT(3)}, {"colorkey", OPT_COLOR(colorkey), .defval = &(const struct m_color){.r = 2, .g = 5, .b = 7, .a = 255}}, - {"force-yuv", OPT_FLAG(force_yuv)}, + {"force-yuv", OPT_BOOL(force_yuv)}, {"queuetime_windowed", OPT_REPLACED("queuetime-windowed")}, {"queuetime_fs", OPT_REPLACED("queuetime-fs")}, {"output_surfaces", OPT_REPLACED("output-surfaces")}, diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c index f9b20fd165..d7c093f233 100644 --- a/video/out/vulkan/context.c +++ b/video/out/vulkan/context.c @@ -25,8 +25,8 @@ struct vulkan_opts { char *device; // force a specific GPU int swap_mode; int queue_count; - int async_transfer; - int async_compute; + bool async_transfer; + bool async_compute; }; static int vk_validate_dev(struct mp_log *log, const struct m_option *opt, @@ -96,8 +96,8 @@ const struct m_sub_options vulkan_conf = { {"mailbox", VK_PRESENT_MODE_MAILBOX_KHR}, {"immediate", VK_PRESENT_MODE_IMMEDIATE_KHR})}, {"vulkan-queue-count", OPT_INT(queue_count), M_RANGE(1, 8)}, - {"vulkan-async-transfer", OPT_FLAG(async_transfer)}, - {"vulkan-async-compute", OPT_FLAG(async_compute)}, + {"vulkan-async-transfer", OPT_BOOL(async_transfer)}, + {"vulkan-async-compute", OPT_BOOL(async_compute)}, {"vulkan-disable-events", OPT_REMOVED("Unused")}, {0} }, diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 59381c753c..2fe454e050 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -133,7 +133,7 @@ const struct m_sub_options wayland_conf = { .opts = (const struct m_option[]) { {"wayland-configure-bounds", OPT_CHOICE(configure_bounds, {"auto", -1}, {"no", 0}, {"yes", 1})}, - {"wayland-disable-vsync", OPT_FLAG(disable_vsync)}, + {"wayland-disable-vsync", OPT_BOOL(disable_vsync)}, {"wayland-edge-pixels-pointer", OPT_INT(edge_pixels_pointer), M_RANGE(0, INT_MAX)}, {"wayland-edge-pixels-touch", OPT_INT(edge_pixels_touch), @@ -143,7 +143,6 @@ const struct m_sub_options wayland_conf = { .size = sizeof(struct wayland_opts), .defaults = &(struct wayland_opts) { .configure_bounds = -1, - .disable_vsync = false, .edge_pixels_pointer = 10, .edge_pixels_touch = 32, }, diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index 5aa6f6d612..a518b8b93f 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -31,7 +31,7 @@ typedef struct { struct wayland_opts { int configure_bounds; int content_type; - int disable_vsync; + bool disable_vsync; int edge_pixels_pointer; int edge_pixels_touch; }; diff --git a/video/sws_utils.c b/video/sws_utils.c index 3af60977ad..ad4c7025e9 100644 --- a/video/sws_utils.c +++ b/video/sws_utils.c @@ -52,9 +52,9 @@ struct sws_opts { int chr_hshift; float chr_sharpen; float lum_sharpen; - int fast; - int bitexact; - int zimg; + bool fast; + bool bitexact; + bool zimg; }; #define OPT_BASE_STRUCT struct sws_opts @@ -78,15 +78,15 @@ const struct m_sub_options sws_conf = { {"chs", OPT_INT(chr_hshift)}, {"ls", OPT_FLOAT(lum_sharpen), M_RANGE(-100.0, 100.0)}, {"cs", OPT_FLOAT(chr_sharpen), M_RANGE(-100.0, 100.0)}, - {"fast", OPT_FLAG(fast)}, - {"bitexact", OPT_FLAG(bitexact)}, - {"allow-zimg", OPT_FLAG(zimg)}, + {"fast", OPT_BOOL(fast)}, + {"bitexact", OPT_BOOL(bitexact)}, + {"allow-zimg", OPT_BOOL(zimg)}, {0} }, .size = sizeof(struct sws_opts), .defaults = &(const struct sws_opts){ .scaler = SWS_LANCZOS, - .zimg = 1, + .zimg = true, }, }; diff --git a/video/vdpau_mixer.h b/video/vdpau_mixer.h index e232dd64d4..4abe87e03d 100644 --- a/video/vdpau_mixer.h +++ b/video/vdpau_mixer.h @@ -9,8 +9,8 @@ struct mp_vdpau_mixer_opts { int deint; - int chroma_deint; - int pullup; + bool chroma_deint; + bool pullup; float denoise; float sharpen; int hqscaling; diff --git a/video/zimg.c b/video/zimg.c index e29d7c4ce7..1cdf8d2945 100644 --- a/video/zimg.c +++ b/video/zimg.c @@ -51,7 +51,7 @@ const struct zimg_opts zimg_opts_defaults = { .scaler_chroma_params = {NAN, NAN}, .scaler_chroma = ZIMG_RESIZE_BILINEAR, .dither = ZIMG_DITHER_RANDOM, - .fast = 1, + .fast = true, }; #define OPT_PARAM(var) OPT_DOUBLE(var), .flags = M_OPT_DEFAULT_NAN @@ -70,7 +70,7 @@ const struct m_sub_options zimg_conf = { {"ordered", ZIMG_DITHER_ORDERED}, {"random", ZIMG_DITHER_RANDOM}, {"error-diffusion", ZIMG_DITHER_ERROR_DIFFUSION})}, - {"fast", OPT_FLAG(fast)}, + {"fast", OPT_BOOL(fast)}, {"threads", OPT_CHOICE(threads, {"auto", 0}), M_RANGE(1, 64)}, {0} }, diff --git a/video/zimg.h b/video/zimg.h index a4f1954402..be018ca167 100644 --- a/video/zimg.h +++ b/video/zimg.h @@ -19,7 +19,7 @@ struct zimg_opts { int scaler_chroma; double scaler_chroma_params[2]; int dither; - int fast; + bool fast; int threads; };