void **filter_conf;
/** the number of filters that should be activated for this audio format */
unsigned int num_writers;
- /** pointer to the array of writers to be activated */
- struct writer **writers;
+ /** Array of writer numbers to be activated. */
+ int *writer_nums;
/** pointer to the array of writer configurations */
void **writer_conf;
/** do not start receiver/filters/writer before this time */
}
for (i = 0; i < a->num_writers; i++) {
s->wng->writer_nodes[i].conf = a->writer_conf[i];
- s->wng->writer_nodes[i].writer = a->writers[i];
+ s->wng->writer_nodes[i].writer_num = a->writer_nums[i];
}
ret = wng_open(s->wng);
if (ret < 0)
FOR_EACH_AUDIO_FORMAT(i) {
a = &afi[i];
a->writer_conf = para_malloc(nw * sizeof(void *));
- a->writers = para_malloc(nw * sizeof(struct writer *));
+ a->writer_nums = para_malloc(nw * sizeof(int));
a->num_writers = 0;
}
for (i = 0; i < conf.writer_given; i++) {
ret = writer_num;
goto out;
}
- a->writers[nw] = &writers[writer_num];
+ a->writer_nums[nw] = writer_num;
a->writer_conf[nw] = wconf;
PARA_INFO_LOG("%s writer #%d: %s\n", audio_formats[ret],
nw, writer_names[writer_num]);
* Describes one running instance of a writer.
*/
struct writer_node {
- /** Points to the writer structure associated with this node. */
- struct writer *writer; /* FIXME: Should better be only the number. */
+ /** The number of this writer. */
+ int writer_num;
/** Writer-specific data. */
void *private_data;
/** Pointer to the group this node belongs to. */
FOR_EACH_WRITER_NODE(i, g) {
struct writer_node *wn = &g->writer_nodes[i];
- if (!wn->writer->pre_select)
+ struct writer *w = writers + wn->writer_num;
+ if (!w->pre_select)
continue;
- t->error = wn->writer->pre_select(s, wn);
+ t->error = w->pre_select(s, wn);
if (t->error < 0)
return;
}
FOR_EACH_WRITER_NODE(i, g) {
struct writer_node *wn = &g->writer_nodes[i];
- t->error = wn->writer->post_select(s, wn);
+ struct writer *w = writers + wn->writer_num;
+ t->error = w->post_select(s, wn);
if (t->error < 0)
return;
if (!i)
PARA_NOTICE_LOG("opening wng %p with %d writer(s)\n", g, g->num_writers);
FOR_EACH_WRITER_NODE(i, g) {
struct writer_node *wn = &g->writer_nodes[i];
+ struct writer *w = writers + wn->writer_num;
wn->wng = g;
- ret = wn->writer->open(wn);
+ ret = w->open(wn);
if (ret < 0)
goto err_out;
}
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
while (i > 0) {
struct writer_node *wn = &g->writer_nodes[--i];
- wn->writer->close(wn);
+ struct writer *w = writers + wn->writer_num;
+ w->close(wn);
}
free(g->writer_nodes);
g->num_writers = 0;
PARA_NOTICE_LOG("closing wng with %d writer(s)\n", g->num_writers);
FOR_EACH_WRITER_NODE(i, g) {
struct writer_node *wn = &g->writer_nodes[i];
- wn->writer->close(wn);
+ struct writer *w = writers + wn->writer_num;
+ w->close(wn);
}
free(g->writer_nodes);
free(g);
struct writer_node_group *setup_default_wng(void)
{
struct writer_node_group *wng = wng_new(1);
- wng->writer_nodes[0].writer = &writers[DEFAULT_WRITER];
+ wng->writer_nodes[0].writer_num = DEFAULT_WRITER;
PARA_INFO_LOG("using default writer: %s %p\n",
writer_names[DEFAULT_WRITER], writers[DEFAULT_WRITER].parse_config);
wng->writer_nodes[0].conf = writers[DEFAULT_WRITER].parse_config("");