]> git.alsa-project.org Git - alsa-tools.git/commitdiff
Updated to latest alsa-lib PCM API
authorJaroslav Kysela <perex@perex.cz>
Thu, 19 Sep 2002 16:20:08 +0000 (16:20 +0000)
committerJaroslav Kysela <perex@perex.cz>
Thu, 19 Sep 2002 16:20:08 +0000 (16:20 +0000)
ac3dec/config.h.in
ac3dec/output.c

index e40f81a46fcaed06337aee2bc44508aac8fb715e..07050cc0463f229e9f4ebc044e2dbc6acdc61c13 100644 (file)
 /* Version number of package */
 #undef VERSION
 
-
-/* Architecture defines */
+/* Using i386 architecture */
 #undef __i386__
+
+/* Using Alpha architecture */
 #undef __alpha__
+
+/* Using SPARC architecture */
+#undef __sparc__
+
+/* Using PowerPC architecture */
 #undef __ppc__
-#undef __sparc__ 
 
-/* Big-Endian */
-#undef WORDS_BIGENDIAN
+/* Using IA-64 architecture */
+#undef __ia64__
+
index 5d5494f5f5756c2c21a86c8df0ed971db9bf184a..afa979284adf43ff49b40c9a81d2c01a53a7f32b 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#define ALSA_PCM_NEW_HW_PARAMS_API
 #include <alsa/asoundlib.h>
 
 typedef signed short sint_16;
@@ -38,8 +39,7 @@ int output_open(output_t *output)
        const char *pcm_name = output->pcm_name;
        char devstr[128];
        snd_pcm_hw_params_t *params;
-       snd_pcm_sframes_t buffer_time;
-       snd_pcm_sframes_t period_time, tmp;
+       unsigned int rate, buffer_time, period_time, tmp;
        int err, step;
        snd_pcm_hw_params_alloca(&params);
 
@@ -126,14 +126,15 @@ int output_open(output_t *output)
                fprintf(stderr, "Channels count non available");
                goto __close;
        }
-       err = snd_pcm_hw_params_set_rate_near(pcm, params, output->rate, 0);
+       rate = output->rate;
+       err = snd_pcm_hw_params_set_rate_near(pcm, params, &rate, 0);
        if (err < 0) {
                fprintf(stderr, "Rate not available");
                goto __close;
        }
-       buffer_time = snd_pcm_hw_params_set_buffer_time_near(pcm, params,
-                                                            500000, 0);
-       if (buffer_time < 0) {
+       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");
                goto __close;
        }
@@ -141,19 +142,19 @@ int output_open(output_t *output)
        period_time = 10000 * 2;
        do {
                period_time /= 2;
-               tmp = snd_pcm_hw_params_set_period_time_near(pcm, params,
-                                                            period_time, 0);
+               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");
+                       goto __close;
+               }
                if (tmp == period_time) {
                        period_time /= 3;
-                       tmp = snd_pcm_hw_params_set_period_time_near(pcm, params,
-                                                                    period_time, 0);
+                       tmp = period_time;
+                       err = snd_pcm_hw_params_set_period_time_near(pcm, params, &tmp, 0);
                        if (tmp == period_time)
                                period_time = 10000 * 2;
                }
-               if (period_time < 0) {
-                       fprintf(stderr, "Period time not available");
-                       goto __close;
-               }
        } while (buffer_time == period_time && period_time > 10000);
        if (buffer_time == period_time) {
                fprintf(stderr, "Buffer time and period time match, could not use\n");