]> git.alsa-project.org Git - alsa-tools.git/commitdiff
Fixed big-endian support
authorJaroslav Kysela <perex@perex.cz>
Wed, 8 Jan 2003 11:30:04 +0000 (11:30 +0000)
committerJaroslav Kysela <perex@perex.cz>
Wed, 8 Jan 2003 11:30:04 +0000 (11:30 +0000)
ac3dec/ac3spdif.c
ac3dec/output.c

index 77b19ca2007b62f6a43f38b601c26ada06be0698..29c1c611f387663291afb6c09354810a56eb58fb 100644 (file)
@@ -154,7 +154,7 @@ output_spdif(uint8_t *data_start, uint8_t *data_end, int quiet)
         done_banner = 1;
       }
       
-#ifndef WORDS_BIGENDIAN
+#ifndef _a_b_c_d_e_f /* WORDS_BIGENDIAN */
       // extract_ac3 seems to write swabbed data
       swab(&buf[10], &buf[10], syncinfo.frame_size * 2 - 2);
 #endif
index 38b92a23e725d44c571116e8100aa22e4565f1cd..142f67512476150649c95a6fbce1543545bed2f9 100644 (file)
@@ -41,6 +41,7 @@ int output_open(output_t *output)
        char devstr[128];
        snd_pcm_hw_params_t *params;
        unsigned int rate, buffer_time, period_time, tmp;
+       snd_pcm_format_t format = output->bits == 16 ? SND_PCM_FORMAT_S16 : SND_PCM_FORMAT_U8;
        int err, step;
        snd_pcm_hw_params_alloca(&params);
 
@@ -76,6 +77,7 @@ int output_open(output_t *output)
                                sprintf(devstr, "iec958:AES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x", s[0], s[1], s[2], s[3]);
                                if (out_config.card)
                                        sprintf(devstr + strlen(devstr), ",CARD=%s", out_config.card);
+                               format = SND_PCM_FORMAT_S16_LE;
                        } else {
                                if (out_config.card)
                                        sprintf(devstr, "plughw:%s", out_config.card);
@@ -114,29 +116,29 @@ int output_open(output_t *output)
        err = snd_pcm_hw_params_set_access(pcm, params,
                                           SND_PCM_ACCESS_RW_INTERLEAVED);
        if (err < 0) {
-               fprintf(stderr, "Access type not available");
+               fprintf(stderr, "Access type not available\n");
                goto __close;
        }
-       err = snd_pcm_hw_params_set_format(pcm, params, output->bits == 16 ? SND_PCM_FORMAT_S16_LE : SND_PCM_FORMAT_U8);
+       err = snd_pcm_hw_params_set_format(pcm, params, format);
        if (err < 0) {
-               fprintf(stderr, "Sample format non available");
+               fprintf(stderr, "Sample format non available\n");
                goto __close;
        }
        err = snd_pcm_hw_params_set_channels(pcm, params, output->channels);
        if (err < 0) {
-               fprintf(stderr, "Channels count non available");
+               fprintf(stderr, "Channels count non available\n");
                goto __close;
        }
        rate = output->rate;
        err = snd_pcm_hw_params_set_rate_near(pcm, params, &rate, 0);
        if (err < 0) {
-               fprintf(stderr, "Rate not available");
+               fprintf(stderr, "Rate not available\n");
                goto __close;
        }
        buffer_time = 500000;
        err = snd_pcm_hw_params_set_buffer_time_near(pcm, params, &buffer_time, 0);
        if (err < 0) {
-               fprintf(stderr, "Buffer time not available");
+               fprintf(stderr, "Buffer time not available\n");
                goto __close;
        }
        step = 2;
@@ -146,7 +148,7 @@ int output_open(output_t *output)
                tmp = period_time;
                err = snd_pcm_hw_params_set_period_time_near(pcm, params, &tmp, 0);
                if (err < 0) {
-                       fprintf(stderr, "Period time not available");
+                       fprintf(stderr, "Period time not available\n");
                        goto __close;
                }
                if (tmp == period_time) {