* If cached is TRUE, no new GVariants are created for the def and
* values fields; instead, the current values are returned.
*/
- struct sr_option *(*options) (gboolean cached);
+ struct sr_option *(*options) (void);
/**
* This function is called once, at the beginning of an output stream.
{ 0 }
};
-static struct sr_option *get_options(gboolean cached)
+static struct sr_option *get_options(void)
{
- if (cached)
- return options;
-
- options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE);
- g_variant_ref_sink(options[0].def);
+ if (!options[0].def) {
+ options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE);
+ g_variant_ref_sink(options[0].def);
+ }
return options;
}
{ 0 }
};
-static struct sr_option *get_options(gboolean cached)
+static struct sr_option *get_options(void)
{
- if (cached)
- return options;
-
- options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE);
- g_variant_ref_sink(options[0].def);
+ if (!options[0].def) {
+ options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE);
+ g_variant_ref_sink(options[0].def);
+ }
return options;
}
{ 0 }
};
-static struct sr_option *get_options(gboolean cached)
+static struct sr_option *get_options(void)
{
- if (cached)
- return options;
-
- options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE);
- g_variant_ref_sink(options[0].def);
+ if (!options[0].def) {
+ options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE);
+ g_variant_ref_sink(options[0].def);
+ }
return options;
}
if (!o || !o->options)
return NULL;
- return o->options(FALSE);
+ return o->options();
}
/**
if (!o || !o->options)
return;
- for (opt = o->options(TRUE); opt->id; opt++) {
+ for (opt = o->options(); opt->id; opt++) {
if (opt->def) {
g_variant_unref(opt->def);
opt->def = NULL;
op = g_malloc(sizeof(struct sr_output));
op->module = o;
op->sdi = sdi;
+
if (op->module->init && op->module->init(op, options) != SR_OK) {
g_free(op);
op = NULL;
{ 0 }
};
-static struct sr_option *get_options(gboolean cached)
+static struct sr_option *get_options(void)
{
- if (cached)
- return options;
-
- options[0].def = g_variant_new_double(0);
- g_variant_ref_sink(options[0].def);
+ if (!options[0].def) {
+ options[0].def = g_variant_new_double(0);
+ g_variant_ref_sink(options[0].def);
+ }
return options;
}