summaryrefslogtreecommitdiff
path: root/src/modules/rtv/rtv.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-09-13 12:26:36 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-09-13 12:26:36 -0700
commit93d90e8e1d176c2ad2ed925693e6a232ed2d61ae (patch)
tree253a68afc73f6ff26bfbdc07fab5dd555e94e88a /src/modules/rtv/rtv.c
parent44b32d60501cc5320de4b34d34c9de3d5f4c11bf (diff)
modules/rtv: implement snow_module setting
This takes a module name or "none", to use the specified module or do nothing during the channel switching snow_duration. The default is "snow" like before.
Diffstat (limited to 'src/modules/rtv/rtv.c')
-rw-r--r--src/modules/rtv/rtv.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c
index 3aaad65..c9ff986 100644
--- a/src/modules/rtv/rtv.c
+++ b/src/modules/rtv/rtv.c
@@ -53,7 +53,8 @@ static unsigned rtv_duration = RTV_DURATION_SECS;
static unsigned rtv_context_duration = RTV_CONTEXT_DURATION_SECS;
static unsigned rtv_snow_duration = RTV_SNOW_DURATION_SECS;
static unsigned rtv_caption_duration = RTV_CAPTION_DURATION_SECS;
-static char **rtv_channels;
+static char **rtv_channels;
+static char *rtv_snow_module;
rototiller_module_t rtv_module = {
@@ -231,6 +232,7 @@ static void * rtv_create_context(unsigned ticks, unsigned num_cpus)
rtv_context_t *ctxt;
const rototiller_module_t **modules;
size_t n_modules;
+ static rototiller_module_t none_module = {};
rototiller_get_modules(&modules, &n_modules);
@@ -240,9 +242,12 @@ static void * rtv_create_context(unsigned ticks, unsigned num_cpus)
ctxt->n_cpus = num_cpus;
- ctxt->snow_channel.module = rototiller_lookup_module("snow");
- if (ctxt->snow_channel.module->create_context)
- ctxt->snow_channel.module_ctxt = ctxt->snow_channel.module->create_context(ticks, ctxt->n_cpus);
+ ctxt->snow_channel.module = &none_module;
+ if (rtv_snow_module) {
+ ctxt->snow_channel.module = rototiller_lookup_module(rtv_snow_module);
+ if (ctxt->snow_channel.module->create_context)
+ ctxt->snow_channel.module_ctxt = ctxt->snow_channel.module->create_context(ticks, ctxt->n_cpus);
+ }
for (size_t i = 0; i < n_modules; i++) {
if (rtv_should_skip_module(ctxt, modules[i]))
@@ -307,6 +312,7 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
const char *caption_duration;
const char *snow_duration;
const char *channels;
+ const char *snow_module;
channels = settings_get_value(settings, "channels");
if (!channels) {
@@ -392,6 +398,22 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
return 1;
}
+ snow_module = settings_get_value(settings, "snow_module");
+ if (!snow_module) {
+ int r;
+
+ r = setting_desc_clone(&(setting_desc_t){
+ .name = "Module To Use For Snow (\"none\" To Blank)",
+ .key = "snow_module",
+ .preferred = "snow",
+ .annotations = NULL
+ }, next_setting);
+ if (r < 0)
+ return r;
+
+ return 1;
+ }
+
/* turn channels colon-separated list into a null-terminated array of strings */
if (strcmp(channels, "all")) {
const rototiller_module_t **modules;
@@ -430,6 +452,9 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
} while (channel = strtok(NULL, ":"));
}
+ if (strcmp(snow_module, "none"))
+ rtv_snow_module = strdup(snow_module);
+
/* TODO FIXME: parse errors */
sscanf(duration, "%u", &rtv_duration);
sscanf(context_duration, "%u", &rtv_context_duration);
© All Rights Reserved