diff options
author | Christoph Heinrich <christoph.heinrich@student.tugraz.at> | 2023-02-20 04:32:50 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-02-21 17:15:17 +0000 |
commit | 91cc0d8cf6a2cf264c243ca3b3e99b5fd4044c29 (patch) | |
tree | 448b141d92c9ea7636954213b587aaf380fc21db /audio/out | |
parent | b9850a6e8c45f95563a703af7f21dfe1c1ee40b6 (diff) | |
download | mpv-91cc0d8cf6a2cf264c243ca3b3e99b5fd4044c29.tar.bz2 mpv-91cc0d8cf6a2cf264c243ca3b3e99b5fd4044c29.tar.xz |
options: transition options from OPT_FLAG to OPT_BOOL
c78482045444c488bb7948305d583a55d17cd236 introduced a bool option type
as a replacement for the flag type, but didn't actually transition and
remove the flag type because it would have been too much mundane work.
Diffstat (limited to 'audio/out')
-rw-r--r-- | audio/out/ao_alsa.c | 13 | ||||
-rw-r--r-- | audio/out/ao_audiotrack.c | 4 | ||||
-rw-r--r-- | audio/out/ao_coreaudio.c | 4 | ||||
-rw-r--r-- | audio/out/ao_coreaudio_exclusive.c | 5 | ||||
-rw-r--r-- | audio/out/ao_jack.c | 10 | ||||
-rw-r--r-- | audio/out/ao_null.c | 12 | ||||
-rw-r--r-- | audio/out/ao_openal.c | 6 | ||||
-rw-r--r-- | audio/out/ao_oss.c | 1 | ||||
-rw-r--r-- | audio/out/ao_pcm.c | 10 | ||||
-rw-r--r-- | audio/out/ao_pulse.c | 8 |
10 files changed, 35 insertions, 38 deletions
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", |