These methods always succeed. Add missing documentation of the public
register_writer_node() function while we're at it.
}
/* Open an instance of the alsa writer. */
}
/* 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));
{
wn->private_data = para_calloc(sizeof(struct private_alsa_write_data));
}
static void alsa_write_pre_select(struct sched *s, struct task *t)
}
static void alsa_write_pre_select(struct sched *s, struct task *t)
-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;
{
struct private_file_write_data *pfwd = para_calloc(sizeof(*pfwd));
wn->private_data = pfwd;
pfwd->fd = -1;
}
static int prepare_output_file(struct writer_node *wn)
}
static int prepare_output_file(struct writer_node *wn)
-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;
+ wn->private_data = powd;
}
__malloc static void *oss_parse_config_or_die(const char *options)
}
__malloc static void *oss_parse_config_or_die(const char *options)
#define ENDIAN_FLAGS 0
#endif
#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);
{
struct private_osx_write_data *powd = para_calloc(sizeof(*powd));
wn->private_data = powd;
init_buffers(wn);
}
static int core_audio_init(struct writer_node *wn)
}
static int core_audio_init(struct writer_node *wn)
/**
* Open one instance of this writer.
*
/**
* 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.
*
/**
* Prepare the fd sets for select.
*
+/**
+ * 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]);
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]);
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);
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);
wn->task.post_select = w->post_select;
wn->task.pre_select = w->pre_select;
register_task(&wn->task);
wn->task.post_select = w->post_select;
wn->task.pre_select = w->pre_select;
register_task(&wn->task);