{
struct private_alsa_write_data *pad = para_calloc(sizeof(*pad));
- sprintf(wn->task.status, "alsa writer");
wn->private_data = pad;
return 1;
}
return;
}
if (!pad->handle) {
- char *buf;
struct alsa_write_args_info *conf = wn->conf;
if (bytes == 0) /* no data available */
return;
pad->samplerate = conf->samplerate_arg;
pad->channels = conf->channels_arg;
if (!conf->samplerate_given) { /* config option trumps btr_exec */
- /* ask parent btr nodes */
- buf = NULL;
- ret = btr_exec_up(btrn, "samplerate", &buf);
- PARA_CRIT_LOG("ret: %d\n", ret);
- if (ret >= 0) {
- int32_t rate;
-
- ret = para_atoi32(buf, &rate);
- free(buf);
- if (ret < 0) /* should not happen */
- goto err;
- pad->samplerate = rate;
- }
+ int32_t rate;
+ ret = get_btr_samplerate(btrn, &rate);
+ if (ret < 0)
+ goto err;
+ pad->samplerate = rate;
}
if (!conf->channels_given) {
- buf = NULL;
- ret = btr_exec_up(btrn, "channels", &buf);
- if (ret >= 0) {
- int32_t ch;
-
- ret = para_atoi32(buf, &ch);
- freep(&buf);
- if (ret < 0)
- goto err;
- pad->channels = ch;
- }
+ int32_t ch;
+ ret = get_btr_channels(btrn, &ch);
+ if (ret < 0)
+ goto err;
+ pad->channels = ch;
}
PARA_INFO_LOG("%d channel(s), %dHz\n", pad->channels, pad->samplerate);
ret = 1;