- return 1;
-}
-
-/* Open an instance of the alsa writer. */
-static int alsa_open_nobtr(struct writer_node *wn)
-{
- struct alsa_write_args_info *conf = wn->conf;
- struct writer_node_group *wng = wn->wng;
- struct private_alsa_write_data *pad = para_calloc(sizeof(*pad));
-
- wn->private_data = pad;
- if (!conf->samplerate_given && wng->samplerate)
- pad->samplerate = *wng->samplerate;
- else
- pad->samplerate = conf->samplerate_arg;
- if (!conf->channels_given && wng->channels)
- pad->channels = *wng->channels;
- else
- pad->channels = conf->channels_arg;
- PARA_INFO_LOG("%d channel(s), %dHz\n", pad->channels, pad->samplerate);
- return 1;
-}
-
-static int alsa_open_btr(struct writer_node *wn)
-{
- struct private_alsa_write_data *pad = para_calloc(sizeof(*pad));
-
- wn->private_data = pad;
- return 1;
-}
-static int alsa_open(struct writer_node *wn)
-{
- if (wn->btrn)
- return alsa_open_btr(wn);
- return alsa_open_nobtr(wn);
-}
-
-static int alsa_write_pre_select(struct sched *s, struct writer_node *wn)
-{
- struct private_alsa_write_data *pad = wn->private_data;
- struct writer_node_group *wng = wn->wng;
- struct timeval tv;
- snd_pcm_sframes_t avail, underrun;
-
- if (!pad->handle)
- return 1;
- if (wn->btrn) {
- int ret = btr_node_status(wn->btrn, wn->min_iqs, BTR_NT_LEAF);
- if (ret == 0)
- return 1;
- if (ret < 0) {
- underrun = 10;
- goto timeout;
+ err = snd_output_buffer_open(&log);
+ if (err == 0) {
+ char *buf;
+ PARA_INFO_LOG("dumping alsa configuration\n");
+ snd_pcm_dump(pad->handle, log);
+ snd_output_buffer_string(log, &buf);
+ for (;;) {
+ char *p = strchr(buf, '\n');
+ if (!p) /* omit last output line, it's empty */
+ break;
+ *p = '\0';
+ PARA_INFO_LOG("%s\n", buf);
+ buf = p + 1;