]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
Accept integer for card option
authorTakashi Iwai <tiwai@suse.de>
Thu, 13 Apr 2006 10:43:41 +0000 (12:43 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 13 Apr 2006 10:43:41 +0000 (12:43 +0200)
Accept integer value for card option, as found in the example
in a52.txt.

a52/pcm_a52.c

index 1cc7b6f5bba52b206eae0a96d3d811cc820d2738..84706fed8685e5f0f6039c7b271490c0f1b2c350 100644 (file)
@@ -566,7 +566,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
        unsigned int bitrate = 448;
        unsigned int channels = 6;
        snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
-       char devstr[128];
+       char devstr[128], tmpcard[8];
        struct a52_ctx *rec;
        
        if (stream != SND_PCM_STREAM_PLAYBACK) {
@@ -583,8 +583,14 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
                        continue;
                if (strcmp(id, "card") == 0) {
                        if (snd_config_get_string(n, &card) < 0) {
-                               SNDERR("Invalid type for %s", id);
-                               return -EINVAL;
+                               long val;
+                               err = snd_config_get_integer(n, &val);
+                               if (err < 0) {
+                                       SNDERR("Invalid type for %s", id);
+                                       return -EINVAL;
+                               }
+                               snprintf(tmpcard, sizeof(tmpcard), "%ld", val);
+                               card = tmpcard;
                        }
                        continue;
                }