}
/* Open an instance of the alsa writer. */
-static int alsa_open(struct writer_node *wn)
+static void alsa_open(struct writer_node *wn)
{
wn->private_data = para_calloc(sizeof(struct private_alsa_write_data));
- return 1;
}
static void alsa_write_pre_select(struct sched *s, struct task *t)
return result;
}
-static int file_write_open(struct writer_node *wn)
+static void file_write_open(struct writer_node *wn)
{
struct private_file_write_data *pfwd = para_calloc(sizeof(*pfwd));
wn->private_data = pfwd;
pfwd->fd = -1;
- return 0;
}
static int prepare_output_file(struct writer_node *wn)
btr_remove_node(btrn);
}
-static int oss_open(struct writer_node *wn)
+static void oss_open(struct writer_node *wn)
{
- struct private_oss_write_data *powd;
+ struct private_oss_write_data *powd = para_calloc(sizeof(*powd));
- powd = para_calloc(sizeof(*powd));
- wn->private_data = powd;
powd->fd = -1;
- return 1;
+ wn->private_data = powd;
}
__malloc static void *oss_parse_config_or_die(const char *options)
#define ENDIAN_FLAGS 0
#endif
-static int osx_write_open(struct writer_node *wn)
+static void osx_write_open(struct writer_node *wn)
{
struct private_osx_write_data *powd = para_calloc(sizeof(*powd));
wn->private_data = powd;
init_buffers(wn);
- return 0;
}
static int core_audio_init(struct writer_node *wn)
/**
* Open one instance of this writer.
*
- * This function should perform any work necessary to write the incoming
- * stream. To this aim, it may allocate its private data structure and store
- * a pointer to that structure via the given writer_node parameter.
+ * Perform any preparations needed to write the incoming stream.
+ * Usually this function just allocates its private data structure and
+ * stores a pointer to that structure in the ->private data of the
+ * given parameter. This function must either succeed or terminate the
+ * process.
*/
- int (*open)(struct writer_node *);
+ void (*open)(struct writer_node *);
/**
* Prepare the fd sets for select.
*
return NULL;
}
+/**
+ * Open a writer node and register the corresponding task.
+ *
+ * \param wn The writer node to open.
+ * \param parent The parent btr node (the source for the writer node).
+ *
+ * The configuration of the writer node stored in \p wn->conf must be
+ * initialized before this function may be called.
+ */
void register_writer_node(struct writer_node *wn, struct btr_node *parent)
{
struct writer *w = writers + wn->writer_num;
char *name = make_message("%s writer", writer_names[wn->writer_num]);
- int ret;
wn->btrn = btr_new_node(&(struct btr_node_description)
EMBRACE(.name = name, .parent = parent,
.handler = w->execute, .context = wn));
strcpy(wn->task.status, name);
free(name);
- ret = w->open(wn);
+ w->open(wn);
wn->task.post_select = w->post_select;
wn->task.pre_select = w->pre_select;
register_task(&wn->task);