diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-05-27 15:06:24 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-05-27 15:06:24 -0700 |
commit | d208c3cab4f8a17db070fd7e73f00122541f2812 (patch) | |
tree | fba70dac63b5b51bf865d0246ee2b6fc2d168eb9 /src | |
parent | 4d6f0450968b06f5be50dc454de43510a844daee (diff) |
modules/rtv: desc the snow_module name setting
Like modules/checkers required for fill_module, we need to do the
same for for rtv::snow_module.
There's more work to do on rtv::channels, but that's still
unsettled stuff in terms of settings syntax since rtv randomizes
settings. It's desirable to have the rtv settings able to
specify which settings to hold constant at a specific value
per-channel, leaving everything else for randomizing on channel
switch.
But there's no syntax for that kind of stuff currently, and it
seems like there's a need to communicate during the setup_func
dance when we're in a "settings optional because we'll fill them
in automatically at time of use later" to the front-end.
It's not strictly a front-end issue though - because the back-end
setup_func actually controls the forward progress. From the
current setup_func's perspective, everything's important to it
and must be fulfilled. And we certainly want the setup_func to
continue informing the setup process.
So it's more like the channel settings being populated via rtv
still need to all get populated, rtv just needs a way to add an
attribute to mark which settings are static vs. which should get
randomized on every use.
Perhaps there should just be a special value syntax reserved for
saying "random value" and the front-end can apply that, but then
a til_module_randomize_setup() could detect that too in a
per-setting flag the front-end set. That way the value gets
re-randomized, while the ones without that value set get left
alone.
Yes, I know this isn't the appropriate place for such commentary.
But nobody is reading these things anyways on my toy side project.
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/rtv/rtv.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index 6255a60..a0f8047 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -330,7 +330,8 @@ static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting const char *context_duration; const char *caption_duration; const char *snow_duration; - const char *snow_module; + const char *snow_module, *snow_module_name; + til_setting_t *snow_module_name_setting; const char *log_channels; const char *log_channels_values[] = { "off", @@ -437,8 +438,28 @@ static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting assert(res_setting && *res_setting && (*res_setting)->value_as_nested_settings); snow_module_settings = (*res_setting)->value_as_nested_settings; - if (strcasecmp(snow_module, "none")) { - const char *snow_module_name = til_settings_get_value_by_idx(snow_module_settings, 0, NULL); + snow_module_name = til_settings_get_value_by_idx(snow_module_settings, 0, &snow_module_name_setting); + if (!snow_module_name) + return -EINVAL; + + if (!snow_module_name_setting->desc) { + r = til_setting_desc_new(snow_module_settings, + &(til_setting_spec_t){ + /* this is basically just to get the .as_label */ + .name = "Snow module name", + .preferred = "none", + .as_label = 1, + }, + res_desc); + if (r < 0) + return r; + + *res_setting = snow_module_name_setting; + + return 1; + } + + if (strcasecmp(snow_module_name, "none")) { const til_module_t *snow_module = til_lookup_module(snow_module_name); if (!snow_module) |