- struct alsa_write_args_info *conf = wn->conf;
- struct private_alsa_write_data *pad = para_calloc(sizeof(*pad));
- int ret;
- char *buf = NULL;
-
- sprintf(wn->task.status, "alsa writer");
- wn->private_data = pad;
-
- /* defaults */
- pad->samplerate = conf->samplerate_arg;
- pad->channels = conf->channels_arg;
-
- if (!conf->samplerate_given) { /* config option trumps btr_exec */
- /* ask parent btr nodes */
- ret = btr_exec_up(wn->btrn, "samplerate", &buf);
- if (ret >= 0) {
- int32_t rate;
- ret = para_atoi32(buf, &rate);
- if (ret < 0) /* should not happen */
- goto out;
- pad->samplerate = rate;
- }
- freep(&buf);
- }
-
- if (!conf->channels_given) {
- ret = btr_exec_up(wn->btrn, "channels", &buf);
- if (ret >= 0) {
- int32_t ch;
- ret = para_atoi32(buf, &ch);
- if (ret < 0)
- goto out;
- pad->channels = ch;
- }
- freep(&buf);
- }
- PARA_INFO_LOG("%d channel(s), %dHz\n", pad->channels, pad->samplerate);
- ret = 1;
-out:
- freep(&buf);
- if (ret < 0)
- free(pad);
- return ret;
-}
-static int alsa_open(struct writer_node *wn)
-{
- struct alsa_write_args_info *conf = wn->conf;
-
- if (conf->buffer_tree_given)
- return alsa_open_btr(wn);
- else
- return alsa_open_nobtr(wn);
-
-}
-
-static int alsa_write_pre_select(struct sched *s, struct writer_node *wn)
-{
- struct alsa_write_args_info *conf = wn->conf;