alsa: Use new get_btr_* functions.
authorAndre Noll <maan@systemlinux.org>
Tue, 5 Jan 2010 05:05:11 +0000 (06:05 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 5 Jan 2010 05:05:11 +0000 (06:05 +0100)
alsa_write.c

index 67c845d..016d8ab 100644 (file)
@@ -152,7 +152,6 @@ static int alsa_open_btr(struct writer_node *wn)
 {
        struct private_alsa_write_data *pad = para_calloc(sizeof(*pad));
 
-       sprintf(wn->task.status, "alsa writer");
        wn->private_data = pad;
        return 1;
 }
@@ -325,7 +324,6 @@ again:
                return;
        }
        if (!pad->handle) {
-               char *buf;
                struct alsa_write_args_info *conf = wn->conf;
                if (bytes == 0) /* no data available */
                        return;
@@ -334,32 +332,18 @@ again:
                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;