At Tue, 23 May 2006 17:47:47 +0100,
Christoph Burger-Scheidlin wrote:
> 
> Hi
> 
> I am trying to get the a52 plugin to work with my Soundblaster Extigy. The 
> Extigy has a second device that accepts an S/PDIF formatted AC3 stream. If I 
> set the speaker arrangement in xine to passthrough and this device (hw:2,2 
> Extigy is card 2) I get proper surround sound.
> 
> As far as I understand it, the a52 plugin takes its input and produces an 
> appropriate stream. Unfortunately, it seems that the output is predetermined 
> to be iec958:{CARD=$CARD}, but if try to use the device, like
> 
> pcm.myout {
>       type a52
>       card 2
> }
> 
> then I get the following error:
> ALSA lib confmisc.c:1105:(snd_func_refer) Unable to find 
> definition 'cards.USB-Audio.pcm.iec958.0:CARD=2,AES0=6,AES1=130,AES2=0,AES3=2'
> ALSA lib conf.c:3479:(_snd_config_evaluate) function snd_func_refer returned 
> error: No such file or directory
> ALSA lib conf.c:3947:(snd_config_expand) Evaluate error: No such file or 
> directory
> ALSA lib pcm.c:2146:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 
> 0x82 AES2 0x0 AES3 0x2  CARD 2}
> aplay: main:547: audio open error: No such file or directory
> 
> Does anyone know how I can get the output of the a52 plugin redirected to 
> hw:2,2?

Not quite easy for usb-audio since no default SPDIF setting is
defined.

You can give an explicit slave PCM string by the patch below.
Use like

        pcm.myout {
                type a52
                slavepcm "hw:2,2"
        }


Takashi
diff -r 7f6ce705ff68 a52/pcm_a52.c
--- a/a52/pcm_a52.c     Fri May 12 15:35:23 2006 +0200
+++ b/a52/pcm_a52.c     Tue May 23 19:51:08 2006 +0200
@@ -562,6 +562,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
        snd_config_iterator_t i, next;
        int err;
        const char *card = NULL;
+       const char *pcm_string = NULL;
        unsigned int rate = 48000;
        unsigned int bitrate = 448;
        unsigned int channels = 6;
@@ -594,6 +595,13 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
                        }
                        continue;
                }
+               if (strcmp(id, "slavepcm") == 0) {
+                       if (snd_config_get_string(n, &pcm_string) < 0) {
+                               SNDERR("a52 slavepcm must be a string");
+                               return -EINVAL;
+                       }
+                       continue;
+               }
                if (strcmp(id, "rate") == 0) {
                        long val;
                        if (snd_config_get_integer(n, &val) < 0) {
@@ -675,16 +683,19 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
                goto error;
        }
 
-       snprintf(devstr, sizeof(devstr),
-                "plug:iec958:{AES0 0x%x AES1 0x%x AES2 0x%x AES3 0x%x %s%s}",
-                IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO |
-                IEC958_AES0_CON_NOT_COPYRIGHT,
-                IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
-                0, rate == 48000 ? IEC958_AES3_CON_FS_48000 : 
IEC958_AES3_CON_FS_44100,
-                card ? " CARD " : "",
-                card ? card : "");
-
-       err = snd_pcm_open(&rec->slave, devstr, stream, mode);
+       if (! pcm_string) {
+               snprintf(devstr, sizeof(devstr),
+                        "plug:iec958:{AES0 0x%x AES1 0x%x AES2 0x%x AES3 0x%x 
%s%s}",
+                        IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO |
+                        IEC958_AES0_CON_NOT_COPYRIGHT,
+                        IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
+                        0, rate == 48000 ? IEC958_AES3_CON_FS_48000 : 
IEC958_AES3_CON_FS_44100,
+                        card ? " CARD " : "",
+                        card ? card : "");
+               pcm_string = devstr;
+       }
+
+       err = snd_pcm_open(&rec->slave, pcm_string, stream, mode);
        if (err < 0)
                goto error;
 

Reply via email to