diff options
78 files changed, 1641 insertions, 1634 deletions
diff --git a/DOCS/tech-overview.txt b/DOCS/tech-overview.txt index fba894606a..4bb06ff764 100644 --- a/DOCS/tech-overview.txt +++ b/DOCS/tech-overview.txt @@ -113,7 +113,7 @@ options/options.h, options/options.c link them to the option parser. For example, an entry like this may be typical: - OPT_SUBSTRUCT("", demux_opts, demux_conf, 0), + {"", OPT_SUBSTRUCT(demux_opts, demux_conf)}, This directs the option access code to include all options in demux_conf into the global option list, with no prefix (""), and as part of the diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index a4e06822b7..eaaf0729e9 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -63,10 +63,10 @@ struct ad_lavc_params { const struct m_sub_options ad_lavc_conf = { .opts = (const m_option_t[]) { - OPT_FLOATRANGE("ac3drc", ac3drc, 0, 0, 6), - OPT_FLAG("downmix", downmix, 0), - OPT_INTRANGE("threads", threads, 0, 0, 16), - OPT_KEYVALUELIST("o", avopts, 0), + {"ac3drc", OPT_FLOAT(ac3drc), M_RANGE(0, 6)}, + {"downmix", OPT_FLAG(downmix)}, + {"threads", OPT_INT(threads), M_RANGE(0, 16)}, + {"o", OPT_KEYVALUELIST(avopts)}, {0} }, .size = sizeof(struct ad_lavc_params), diff --git a/audio/filter/af_format.c b/audio/filter/af_format.c index 3e1eef664c..79d78d1d96 100644 --- a/audio/filter/af_format.c +++ b/audio/filter/af_format.c @@ -128,12 +128,12 @@ const struct mp_user_filter_entry af_format = { .description = "Force audio format", .priv_size = sizeof(struct f_opts), .options = (const struct m_option[]) { - OPT_AUDIOFORMAT("format", in_format, 0), - OPT_INTRANGE("srate", in_srate, 0, 1000, 8*48000), - OPT_CHANNELS("channels", in_channels, 0, .min = 1), - OPT_INTRANGE("out-srate", out_srate, 0, 1000, 8*48000), - OPT_CHANNELS("out-channels", out_channels, 0, .min = 1), - OPT_FLAG("fail", fail, 0), + {"format", OPT_AUDIOFORMAT(in_format)}, + {"srate", OPT_INT(in_srate), M_RANGE(1000, 8*48000)}, + {"channels", OPT_CHANNELS(in_channels), .min = 1}, + {"out-srate", OPT_INT(out_srate), M_RANGE(1000, 8*48000)}, + {"out-channels", OPT_CHANNELS(out_channels), .min = 1}, + {"fail", OPT_FLAG(fail)}, {0} }, }, diff --git a/audio/filter/af_lavcac3enc.c b/audio/filter/af_lavcac3enc.c index c7582cf52b..38f93a1c08 100644 --- a/audio/filter/af_lavcac3enc.c +++ b/audio/filter/af_lavcac3enc.c @@ -375,12 +375,12 @@ const struct mp_user_filter_entry af_lavcac3enc = { .encoder = "ac3", }, .options = (const struct m_option[]) { - OPT_FLAG("tospdif", add_iec61937_header, 0), - OPT_CHOICE_OR_INT("bitrate", bit_rate, 0, 32, 640, - ({"auto", 0}, {"default", 0})), - OPT_INTRANGE("minch", min_channel_num, 0, 2, 6), - OPT_STRING("encoder", encoder, 0), - OPT_KEYVALUELIST("o", avopts, 0), + {"tospdif", OPT_FLAG(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)}, + {"encoder", OPT_STRING(encoder)}, + {"o", OPT_KEYVALUELIST(avopts)}, {0} }, }, diff --git a/audio/filter/af_rubberband.c b/audio/filter/af_rubberband.c index 4c2b69049d..4df2001c49 100644 --- a/audio/filter/af_rubberband.c +++ b/audio/filter/af_rubberband.c @@ -333,35 +333,35 @@ const struct mp_user_filter_entry af_rubberband = { .channels = RubberBandOptionChannelsTogether, }, .options = (const struct m_option[]) { - OPT_CHOICE("transients", transients, 0, - ({"crisp", RubberBandOptionTransientsCrisp}, - {"mixed", RubberBandOptionTransientsMixed}, - {"smooth", RubberBandOptionTransientsSmooth})), - OPT_CHOICE("detector", detector, 0, - ({"compound", RubberBandOptionDetectorCompound}, - {"percussive", RubberBandOptionDetectorPercussive}, - {"soft", RubberBandOptionDetectorSoft})), - OPT_CHOICE("phase", phase, 0, - ({"laminar", RubberBandOptionPhaseLaminar}, - {"independent", RubberBandOptionPhaseIndependent})), - OPT_CHOICE("window", window, 0, - ({"standard", RubberBandOptionWindowStandard}, - {"short", RubberBandOptionWindowShort}, - {"long", RubberBandOptionWindowLong})), - OPT_CHOICE("smoothing", smoothing, 0, - ({"off", RubberBandOptionSmoothingOff}, - {"on", RubberBandOptionSmoothingOn})), - OPT_CHOICE("formant", formant, 0, - ({"shifted", RubberBandOptionFormantShifted}, - {"preserved", RubberBandOptionFormantPreserved})), - OPT_CHOICE("pitch", pitch, 0, - ({"quality", RubberBandOptionPitchHighQuality}, - {"speed", RubberBandOptionPitchHighSpeed}, - {"consistency", RubberBandOptionPitchHighConsistency})), - OPT_CHOICE("channels", channels, 0, - ({"apart", RubberBandOptionChannelsApart}, - {"together", RubberBandOptionChannelsTogether})), - OPT_DOUBLE("pitch-scale", scale, 0, .min = 0.01, .max = 100), + {"transients", OPT_CHOICE(transients, + {"crisp", RubberBandOptionTransientsCrisp}, + {"mixed", RubberBandOptionTransientsMixed}, + {"smooth", RubberBandOptionTransientsSmooth})}, + {"detector", OPT_CHOICE(detector, + {"compound", RubberBandOptionDetectorCompound}, + {"percussive", RubberBandOptionDetectorPercussive}, + {"soft", RubberBandOptionDetectorSoft})}, + {"phase", OPT_CHOICE(phase, + {"laminar", RubberBandOptionPhaseLaminar}, + {"independent", RubberBandOptionPhaseIndependent})}, + {"window", OPT_CHOICE(window, + {"standard", RubberBandOptionWindowStandard}, + {"short", RubberBandOptionWindowShort}, + {"long", RubberBandOptionWindowLong})}, + {"smoothing", OPT_CHOICE(smoothing, + {"off", RubberBandOptionSmoothingOff}, + {"on", RubberBandOptionSmoothingOn})}, + {"formant", OPT_CHOICE(formant, + {"shifted", RubberBandOptionFormantShifted}, + {"preserved", RubberBandOptionFormantPreserved})}, + {"pitch", OPT_CHOICE(pitch, + {"quality", RubberBandOptionPitchHighQuality}, + {"speed", RubberBandOptionPitchHighSpeed}, + {"consistency", RubberBandOptionPitchHighConsistency})}, + {"channels", OPT_CHOICE(channels, + {"apart", RubberBandOptionChannelsApart}, + {"together", RubberBandOptionChannelsTogether})}, + {"pitch-scale", OPT_DOUBLE(scale), M_RANGE(0.01, 100)}, {0} }, }, diff --git a/audio/filter/af_scaletempo.c b/audio/filter/af_scaletempo.c index b76abc8e78..911fd8914e 100644 --- a/audio/filter/af_scaletempo.c +++ b/audio/filter/af_scaletempo.c @@ -609,15 +609,15 @@ const struct mp_user_filter_entry af_scaletempo = { .scale_nominal = 1.0, }, .options = (const struct m_option[]) { - OPT_FLOAT("scale", scale_nominal, 0, .min = 0.01, .max = DBL_MAX), - OPT_FLOAT("stride", ms_stride, 0, .min = 0.01, .max = DBL_MAX), - OPT_FLOAT("overlap", percent_overlap, 0, .min = 0, .max = 1), - OPT_FLOAT("search", ms_search, 0, .min = 0, .max = DBL_MAX), - OPT_CHOICE("speed", speed_opt, 0, - ({"pitch", SCALE_PITCH}, - {"tempo", SCALE_TEMPO}, - {"none", 0}, - {"both", SCALE_TEMPO | SCALE_PITCH})), + {"scale", OPT_FLOAT(scale_nominal), M_RANGE(0.01, DBL_MAX)}, + {"stride", OPT_FLOAT(ms_stride), M_RANGE(0.01, DBL_MAX)}, + {"overlap", OPT_FLOAT(percent_overlap), M_RANGE(0, 1)}, + {"search", OPT_FLOAT(ms_search), M_RANGE(0, DBL_MAX)}, + {"speed", OPT_CHOICE(speed_opt, + {"pitch", SCALE_PITCH}, + {"tempo", SCALE_TEMPO}, + {"none", 0}, + {"both", SCALE_TEMPO | SCALE_PITCH})}, {0} }, }, diff --git a/audio/out/ao.c b/audio/out/ao.c index 0136afca15..42e2cf63d5 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -136,11 +136,12 @@ static const struct m_obj_list ao_obj_list = { #define OPT_BASE_STRUCT struct ao_opts const struct m_sub_options ao_conf = { .opts = (const struct m_option[]) { - OPT_SETTINGSLIST("ao", audio_driver_list, UPDATE_AUDIO, &ao_obj_list, ), - OPT_STRING("audio-device", audio_device, UPDATE_AUDIO), - OPT_STRING("audio-client-name", audio_client_name, UPDATE_AUDIO), - OPT_DOUBLE("audio-buffer", audio_buffer, - UPDATE_AUDIO, .min = 0, .max = 10), + {"ao", OPT_SETTINGSLIST(audio_driver_list, &ao_obj_list), + .flags = UPDATE_AUDIO}, + {"audio-device", OPT_STRING(audio_device), .flags = UPDATE_AUDIO}, + {"audio-client-name", OPT_STRING(audio_client_name), .flags = UPDATE_AUDIO}, + {"audio-buffer", OPT_DOUBLE(audio_buffer), + .flags = UPDATE_AUDIO, M_RANGE(0, 10)}, {0} }, .size = sizeof(OPT_BASE_STRUCT), diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index bb67fd84a8..b4fa18891b 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -67,14 +67,14 @@ 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[]) { - OPT_FLAG("alsa-resample", resample, 0), - OPT_STRING("alsa-mixer-device", mixer_device, 0), - OPT_STRING("alsa-mixer-name", mixer_name, 0), - OPT_INTRANGE("alsa-mixer-index", mixer_index, 0, 0, 99), - OPT_FLAG("alsa-non-interleaved", ni, 0), - OPT_FLAG("alsa-ignore-chmap", ignore_chmap, 0), - OPT_INTRANGE("alsa-buffer-time", buffer_time, 0, 0, INT_MAX), - OPT_INTRANGE("alsa-periods", frags, 0, 0, INT_MAX), + {"alsa-resample", OPT_FLAG(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-buffer-time", OPT_INT(buffer_time), M_RANGE(0, INT_MAX)}, + {"alsa-periods", OPT_INT(frags), M_RANGE(0, INT_MAX)}, {0} }, .defaults = &(const struct ao_alsa_opts) { diff --git a/audio/out/ao_audiotrack.c b/audio/out/ao_audiotrack.c index f54f2584c0..b3be357c1b 100644 --- a/audio/out/ao_audiotrack.c +++ b/audio/out/ao_audiotrack.c @@ -709,8 +709,8 @@ const struct ao_driver audio_out_audiotrack = { .resume = start, .priv_size = sizeof(struct priv), .options = (const struct m_option[]) { - OPT_FLAG("pcm-float", cfg_pcm_float, 0), - OPT_INT("session-id", cfg_session_id, 0), + {"pcm-float", OPT_FLAG(cfg_pcm_float)}, + {"session-id", OPT_INT(cfg_session_id)}, {0} }, .options_prefix = "audiotrack", diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index 2e02c6842b..533d102d32 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -423,7 +423,7 @@ const struct ao_driver audio_out_coreaudio = { .list_devs = ca_get_device_list, .priv_size = sizeof(struct priv), .options = (const struct m_option[]){ - OPT_FLAG("change-physical-format", change_physical_format, 0), + {"change-physical-format", OPT_FLAG(change_physical_format)}, {0} }, .options_prefix = "coreaudio", diff --git a/audio/out/ao_coreaudio_exclusive.c b/audio/out/ao_coreaudio_exclusive.c index a5d4601384..19721e0951 100644 --- a/audio/out/ao_coreaudio_exclusive.c +++ b/audio/out/ao_coreaudio_exclusive.c @@ -465,7 +465,7 @@ const struct ao_driver audio_out_coreaudio_exclusive = { .changed_mixing = false, }, .options = (const struct m_option[]){ - OPT_FLAG("spdif-hack", spdif_hack, 0), + {"spdif-hack", OPT_FLAG(spdif_hack)}, {0} }, .options_prefix = "coreaudio", diff --git a/audio/out/ao_jack.c b/audio/out/ao_jack.c index 0d5a2da207..249c314f9d 100644 --- a/audio/out/ao_jack.c +++ b/audio/out/ao_jack.c @@ -55,12 +55,12 @@ struct jack_opts { #define OPT_BASE_STRUCT struct jack_opts static const struct m_sub_options ao_jack_conf = { .opts = (const struct m_option[]){ - OPT_STRING("jack-port", port, 0), - OPT_STRING("jack-name", client_name, 0), - OPT_FLAG("jack-autostart", autostart, 0), - OPT_FLAG("jack-connect", connect, 0), - OPT_CHOICE("jack-std-channel-layout", stdlayout, 0, - ({"waveext", 0}, {"any", 1})), + {"jack-port", OPT_STRING(port)}, + {"jack-name", OPT_STRING(client_name)}, + {"jack-autostart", OPT_FLAG(autostart)}, + {"jack-connect", OPT_FLAG(connect)}, + {"jack-std-channel-layout", OPT_CHOICE(stdlayout, + {"waveext", 0}, {"any", 1})}, {0} }, .defaults = &(const struct jack_opts) { diff --git a/audio/out/ao_null.c b/audio/out/ao_null.c index 3880ee8aa4..7e15b58e00 100644 --- a/audio/out/ao_null.c +++ b/audio/out/ao_null.c @@ -237,15 +237,15 @@ const struct ao_driver audio_out_null = { .speed = 1, }, .options = (const struct m_option[]) { - OPT_FLAG("untimed", untimed, 0), - OPT_FLOATRANGE("buffer", bufferlen, 0, 0, 100), - OPT_INTRANGE("outburst", outburst, 0, 1, 100000), - OPT_FLOATRANGE("speed", speed, 0, 0, 10000), - OPT_FLOATRANGE("latency", latency_sec, 0, 0, 100), - OPT_FLAG("broken-eof", broken_eof, 0), - OPT_FLAG("broken-delay", broken_delay, 0), - OPT_CHANNELS("channel-layouts", channel_layouts, 0), - OPT_AUDIOFORMAT("format", format, 0), + {"untimed", OPT_FLAG(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)}, + {"channel-layouts", OPT_CHANNELS(channel_layouts)}, + {"format", OPT_AUDIOFORMAT(format)}, {0} }, .options_prefix = "ao-null", diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c index 2af9fadb4f..53fcaca05e 100644 --- a/audio/out/ao_openal.c +++ b/audio/out/ao_openal.c @@ -428,9 +428,9 @@ const struct ao_driver audio_out_openal = { .direct_channels = 0, }, .options = (const struct m_option[]) { - OPT_INTRANGE("num-buffers", num_buffers, 0, 2, MAX_BUF), - OPT_INTRANGE("num-samples", num_samples, 0, 256, MAX_SAMPLES), - OPT_FLAG("direct-channels", direct_channels, 0), + {"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)}, {0} }, .options_prefix = "openal", diff --git a/audio/out/ao_opensles.c b/audio/out/ao_opensles.c index 482a85afea..67ebd46aff 100644 --- a/audio/out/ao_opensles.c +++ b/audio/out/ao_opensles.c @@ -254,8 +254,10 @@ const struct ao_driver audio_out_opensles = { .buffer_size_in_ms = 250, }, .options = (const struct m_option[]) { - OPT_INTRANGE("frames-per-enqueue", frames_per_enqueue, 0, 1, 96000), - OPT_INTRANGE("buffer-size-in-ms", buffer_size_in_ms, 0, 0, 500), + {"frames-per-enqueue", OPT_INT(frames_per_enqueue), + M_RANGE(1, 96000)}, + {"buffer-size-in-ms", OPT_INT(buffer_size_in_ms), + M_RANGE(0, 500)}, {0} }, .options_prefix = "opensles", diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index fbc535e413..fe87a3db73 100644 --- a/audio/out/ao_oss.c +++ b/ |