diff options
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- |