From 1a2319f3e4cc42c680e2fd3ba30022c7a9adf3fe Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 25 Nov 2016 21:00:39 +0100 Subject: options: remove deprecated sub-option handling for --vo and --ao Long planned. Leads to some sanity. There still are some rather gross things. Especially g_groups is ugly, and a hack that can hopefully be removed. (There is a plan for it, but whether it's implemented depends on how much energy is left.) --- audio/out/ao.c | 23 ++++++++++------------- audio/out/ao_alsa.c | 10 ---------- audio/out/ao_audiounit.m | 3 --- audio/out/ao_coreaudio.c | 9 ++------- audio/out/ao_jack.c | 8 -------- audio/out/ao_null.c | 2 +- audio/out/ao_openal.c | 2 +- audio/out/ao_opensles.c | 2 +- audio/out/ao_oss.c | 2 +- audio/out/ao_pcm.c | 2 +- audio/out/ao_pulse.c | 2 +- audio/out/ao_rsound.c | 2 +- audio/out/ao_sdl.c | 2 +- audio/out/ao_sndio.c | 2 +- audio/out/ao_wasapi.c | 7 ------- audio/out/ao_wasapi.h | 2 -- audio/out/ao_wasapi_utils.c | 5 +---- audio/out/internal.h | 2 +- 18 files changed, 23 insertions(+), 64 deletions(-) (limited to 'audio/out') diff --git a/audio/out/ao.c b/audio/out/ao.c index b624f4196c..6cf8de2d88 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -112,8 +112,8 @@ static bool get_desc(struct m_obj_desc *dst, int index) .priv_size = ao->priv_size, .priv_defaults = ao->priv_defaults, .options = ao->options, + .options_prefix = ao->options_prefix, .global_opts = ao->global_opts, - .legacy_prefix = ao->legacy_prefix, .hidden = ao->encode, .p = ao, }; @@ -127,11 +127,12 @@ const struct m_obj_list ao_obj_list = { .allow_unknown_entries = true, .allow_trailer = true, .disallow_positional_parameters = true, + .use_global_options = true, }; static struct ao *ao_alloc(bool probing, struct mpv_global *global, void (*wakeup_cb)(void *ctx), void *wakeup_ctx, - char *name, char **args) + char *name) { assert(wakeup_cb); @@ -155,12 +156,9 @@ static struct ao *ao_alloc(bool probing, struct mpv_global *global, .def_buffer = opts->audio_buffer, .client_name = talloc_strdup(ao, opts->audio_client_name), }; - struct m_config *config = - m_config_from_obj_desc_and_args(ao, ao->log, global, &desc, - name, opts->ao_defs, args); - if (!config) + ao->priv = m_config_group_from_desc(ao, ao->log, global, &desc, name); + if (!ao->priv) goto error; - ao->priv = config->optstruct; return ao; error: talloc_free(ao); @@ -171,9 +169,9 @@ static struct ao *ao_init(bool probing, struct mpv_global *global, void (*wakeup_cb)(void *ctx), void *wakeup_ctx, struct encode_lavc_context *encode_lavc_ctx, int flags, int samplerate, int format, struct mp_chmap channels, - char *dev, char *name, char **args) + char *dev, char *name) { - struct ao *ao = ao_alloc(probing, global, wakeup_cb, wakeup_ctx, name, args); + struct ao *ao = ao_alloc(probing, global, wakeup_cb, wakeup_ctx, name); if (!ao) return NULL; ao->samplerate = samplerate; @@ -206,7 +204,7 @@ static struct ao *ao_init(bool probing, struct mpv_global *global, talloc_free(ao); return ao_init(probing, global, wakeup_cb, wakeup_ctx, encode_lavc_ctx, flags, samplerate, format, channels, - rdevice, redirect, NULL); + rdevice, redirect); } goto fail; } @@ -313,8 +311,7 @@ struct ao *ao_init_best(struct mpv_global *global, mp_verbose(log, "Using preferred device '%s'\n", dev); } ao = ao_init(probing, global, wakeup_cb, wakeup_ctx, encode_lavc_ctx, - init_flags, samplerate, format, channels, dev, - entry->name, entry->attribs); + init_flags, samplerate, format, channels, dev, entry->name); if (ao) break; if (!probing) @@ -571,7 +568,7 @@ struct ao_device_list *ao_hotplug_get_device_list(struct ao_hotplug *hp) break; // don't add unsafe/special entries struct ao *ao = ao_alloc(true, hp->global, hp->wakeup_cb, hp->wakeup_ctx, - (char *)d->name, NULL); + (char *)d->name); if (!ao) continue; diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index 91c8e2d3fc..d63a760d73 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -1196,15 +1196,5 @@ const struct ao_driver audio_out_alsa = { .wakeup = ao_wakeup_poll, .list_devs = list_devs, .priv_size = sizeof(struct priv), - .options = (const struct m_option[]) { - OPT_SUBOPT_LEGACY("device", "alsa-device"), - OPT_SUBOPT_LEGACY("resample", "alsa-resample"), - OPT_SUBOPT_LEGACY("mixer-device", "alsa-mixer-device"), - OPT_SUBOPT_LEGACY("mixer-name", "alsa-mixer-name"), - OPT_SUBOPT_LEGACY("mixer-index", "alsa-mixer-index"), - OPT_SUBOPT_LEGACY("non-interleaved", "alsa-non-interleaved"), - OPT_SUBOPT_LEGACY("ignore-chmap", "alsa-ignore-chmap"), - {0} - }, .global_opts = &ao_alsa_conf, }; diff --git a/audio/out/ao_audiounit.m b/audio/out/ao_audiounit.m index 7411a1a1dd..31703525a9 100644 --- a/audio/out/ao_audiounit.m +++ b/audio/out/ao_audiounit.m @@ -195,7 +195,4 @@ const struct ao_driver audio_out_audiounit = { .pause = stop, .resume = start, .priv_size = sizeof(struct priv), - .options = (const struct m_option[]){ - {0} - }, }; diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index 3a7aa2eac1..ba0dd9b0ba 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -39,7 +39,6 @@ struct priv { AudioStreamID original_asbd_stream; int change_physical_format; - int exclusive; }; static int64_t ca_get_hardware_latency(struct ao *ao) { @@ -143,9 +142,7 @@ static int init(struct ao *ao) { struct priv *p = ao->priv; - p->exclusive |= ao->init_flags & AO_INIT_EXCLUSIVE; - - if (!af_fmt_is_pcm(ao->format) || p->exclusive) { + if (!af_fmt_is_pcm(ao->format) || (ao->init_flags & AO_INIT_EXCLUSIVE)) { MP_VERBOSE(ao, "redirecting to coreaudio_exclusive\n"); ao->redirect = "coreaudio_exclusive"; return CONTROL_ERROR; @@ -429,9 +426,7 @@ const struct ao_driver audio_out_coreaudio = { .priv_size = sizeof(struct priv), .options = (const struct m_option[]){ OPT_FLAG("change-physical-format", change_physical_format, 0), - OPT_FLAG("exclusive", exclusive, 0, - .deprecation_message = "use --audio-exclusive"), {0} }, - .legacy_prefix = "coreaudio", + .options_prefix = "coreaudio", }; diff --git a/audio/out/ao_jack.c b/audio/out/ao_jack.c index 56c7e28544..2ad3cad586 100644 --- a/audio/out/ao_jack.c +++ b/audio/out/ao_jack.c @@ -246,13 +246,5 @@ const struct ao_driver audio_out_jack = { .uninit = uninit, .resume = resume, .priv_size = sizeof(struct priv), - .options = (const struct m_option[]) { - OPT_SUBOPT_LEGACY("port", "jack-port"), - OPT_SUBOPT_LEGACY("name", "jack-name"), - OPT_SUBOPT_LEGACY("autostart", "jack-autostart"), - OPT_SUBOPT_LEGACY("connect", "jack-connect"), - OPT_SUBOPT_LEGACY("std-channel-layout", "jack-std-channel-layout"), - {0} - }, .global_opts = &ao_jack_conf, }; diff --git a/audio/out/ao_null.c b/audio/out/ao_null.c index 7c0c745b12..7b288a8245 100644 --- a/audio/out/ao_null.c +++ b/audio/out/ao_null.c @@ -241,5 +241,5 @@ const struct ao_driver audio_out_null = { OPT_CHANNELS("channel-layouts", channel_layouts, 0), {0} }, - .legacy_prefix = "ao-null", + .options_prefix = "ao-null", }; diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c index aba049445d..a1fd95ab18 100644 --- a/audio/out/ao_openal.c +++ b/audio/out/ao_openal.c @@ -374,5 +374,5 @@ const struct ao_driver audio_out_openal = { DEVICE_OPT_DEPRECATION), {0} }, - .legacy_prefix = "ao-openal", + .options_prefix = "ao-openal", }; diff --git a/audio/out/ao_opensles.c b/audio/out/ao_opensles.c index dd20dbf1d0..5357ab4920 100644 --- a/audio/out/ao_opensles.c +++ b/audio/out/ao_opensles.c @@ -246,5 +246,5 @@ const struct ao_driver audio_out_opensles = { OPT_INTRANGE("sample-rate", cfg_sample_rate, 0, 1000, 100000), {0} }, - .legacy_prefix = "opensles", + .options_prefix = "opensles", }; diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index 5bf5fec29b..c0446eb2aa 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -653,5 +653,5 @@ const struct ao_driver audio_out_oss = { OPT_STRING("mixer-channel", cfg_oss_mixer_channel, 0), {0} }, - .legacy_prefix = "oss", + .options_prefix = "oss", }; diff --git a/audio/out/ao_pcm.c b/audio/out/ao_pcm.c index 169a1b94a1..4e5ec0a319 100644 --- a/audio/out/ao_pcm.c +++ b/audio/out/ao_pcm.c @@ -224,5 +224,5 @@ const struct ao_driver audio_out_pcm = { OPT_FLAG("append", append, 0), {0} }, - .legacy_prefix = "ao-pcm", + .options_prefix = "ao-pcm", }; diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index 5a68553e88..6c6a517f2a 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -841,5 +841,5 @@ const struct ao_driver audio_out_pulse = { OPT_FLAG("latency-hacks", cfg_latency_hacks, 0), {0} }, - .legacy_prefix = "pulse", + .options_prefix = "pulse", }; diff --git a/audio/out/ao_rsound.c b/audio/out/ao_rsound.c index 5ecb39b9d3..9689a9e0b8 100644 --- a/audio/out/ao_rsound.c +++ b/audio/out/ao_rsound.c @@ -162,6 +162,6 @@ const struct ao_driver audio_out_rsound = { .deprecation_message = "request --audio-device support on issue tracker"), {0} }, - .legacy_prefix = "rsound", + .options_prefix = "rsound", }; diff --git a/audio/out/ao_sdl.c b/audio/out/ao_sdl.c index d9d00628b6..1564e26120 100644 --- a/audio/out/ao_sdl.c +++ b/audio/out/ao_sdl.c @@ -212,5 +212,5 @@ const struct ao_driver audio_out_sdl = { OPT_FLOAT("buflen", buflen, 0), {0} }, - .legacy_prefix = "sdl", + .options_prefix = "sdl", }; diff --git a/audio/out/ao_sndio.c b/audio/out/ao_sndio.c index f60fa303e5..e0fd9f0296 100644 --- a/audio/out/ao_sndio.c +++ b/audio/out/ao_sndio.c @@ -324,5 +324,5 @@ const struct ao_driver audio_out_sndio = { DEVICE_OPT_DEPRECATION), {0} }, - .legacy_prefix = "ao-sndio", + .options_prefix = "ao-sndio", }; diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index 17f3e98653..b2e035d3dc 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -496,11 +496,4 @@ const struct ao_driver audio_out_wasapi = { .hotplug_init = hotplug_init, .hotplug_uninit = hotplug_uninit, .priv_size = sizeof(wasapi_state), - .options = (const struct m_option[]) { - OPT_FLAG("exclusive", opt_exclusive, 0, - .deprecation_message = "use --audio-exclusive"), - OPT_STRING("device", opt_device, 0, DEVICE_OPT_DEPRECATION), - {NULL}, - }, - .legacy_prefix = "ao-wasapi", }; diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h index 6dd130b50f..ea9f5c2bad 100644 --- a/audio/out/ao_wasapi.h +++ b/audio/out/ao_wasapi.h @@ -92,8 +92,6 @@ typedef struct wasapi_state { // ao options int opt_exclusive; - int opt_list; - char *opt_device; // format info WAVEFORMATEXTENSIBLE format; diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index 320bb6767b..8b12ef4d5c 100644 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -858,10 +858,7 @@ static LPWSTR select_device(struct mp_log *l, struct device_desc *d) bstr wasapi_get_specified_device_string(struct ao *ao) { struct wasapi_state *state = ao->priv; - bstr device = bstr_strip(bstr0(state->opt_device)); - if (!device.len) - device = bstr_strip(bstr0(ao->device)); - return device; + return bstr_strip(bstr0(ao->device)); } LPWSTR wasapi_find_deviceID(struct ao *ao) diff --git a/audio/out/internal.h b/audio/out/internal.h index 3ddc1becb9..b35f20fba2 100644 --- a/audio/out/internal.h +++ b/audio/out/internal.h @@ -182,8 +182,8 @@ struct ao_driver { int priv_size; const void *priv_defaults; const struct m_option *options; + const char *options_prefix; const struct m_sub_options *global_opts; - const char *legacy_prefix; }; // These functions can be called by AOs. -- cgit v1.2.3