]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Use defaults.pcm.file_format for the default file format of file plugin
authorTakashi Iwai <tiwai@suse.de>
Mon, 17 Mar 2008 15:11:57 +0000 (16:11 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 17 Mar 2008 15:11:57 +0000 (16:11 +0100)
Use "defaults.pcm.file_format" for the default file format of
file plugin.  It's set to "raw" as default for compatibility.

src/conf/alsa.conf
src/pcm/pcm_file.c

index 53baedf16f809d55d050b8e0916f5113e077a938..db6425976e79fdae354acdfe89441904d6deaff9 100644 (file)
@@ -96,6 +96,7 @@ defaults.pcm.iec958.device defaults.pcm.device
 defaults.pcm.modem.card defaults.pcm.card
 defaults.pcm.modem.device defaults.pcm.device
 # truncate files via file or tee PCM
+defaults.pcm.file_format       "raw"
 defaults.pcm.file_truncate     true
 defaults.rawmidi.card 0
 defaults.rawmidi.device 0
@@ -266,7 +267,10 @@ pcm.tee {
        }
        @args.FORMAT {
                type string
-               default raw
+               default {
+                       @func refer
+                       name defaults.pcm.file_format
+               }
        }
        type file
        slave.pcm $SLAVE
@@ -285,7 +289,10 @@ pcm.file {
        }
        @args.FORMAT {
                type string
-               default raw
+               default {
+                       @func refer
+                       name defaults.pcm.file_format
+               }
        }
        type file
        slave.pcm null
index 74bcbf52df5f6dafcee728a6ee100f4d514786fd..289a434c30e0173a33b64d119bf43b171c305908 100644 (file)
@@ -733,6 +733,17 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
                SNDERR("Unknown field %s", id);
                return -EINVAL;
        }
+       if (!format) {
+               snd_config_t *n;
+               /* read defaults */
+               if (snd_config_search(root, "defaults.pcm.file_format", &n) >= 0) {
+                       err = snd_config_get_string(n, &format);
+                       if (err < 0) {
+                               SNDERR("Invalid file format");
+                               return -EINVAL;
+                       }
+               }
+       }
        if (!slave) {
                SNDERR("slave is not defined");
                return -EINVAL;