[xiph-cvs] cvs commit: ao/src/plugins/alsa09 ao_alsa09.c
Warren Dukes
shank at xiph.org
Sun Oct 12 19:12:33 PDT 2003
shank 03/10/12 22:12:33
Modified: src/plugins/alsa09 ao_alsa09.c
Log:
use new alsa 0.9 api, not the depracated alsa calls
Revision Changes Path
1.20 +26 -14 ao/src/plugins/alsa09/ao_alsa09.c
Index: ao_alsa09.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/alsa09/ao_alsa09.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ao_alsa09.c 11 Oct 2003 20:05:32 -0000 1.19
+++ ao_alsa09.c 13 Oct 2003 02:12:32 -0000 1.20
@@ -25,6 +25,9 @@
*
*/
+#define ALSA_PCM_NEW_HW_PARAMS_API
+#define ALSA_PCM_NEW_SW_PARAMS_API
+
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -85,12 +88,12 @@
typedef struct ao_alsa_internal
{
snd_pcm_t *pcm_handle;
- int buffer_time;
- int period_time;
- int buffer_size;
- int period_size;
+ unsigned int buffer_time;
+ unsigned int period_time;
+ snd_pcm_uframes_t buffer_size;
+ snd_pcm_uframes_t period_size;
int sample_size;
- int bitformat;
+ snd_pcm_format_t bitformat;
char *dev;
char *cmd;
ao_alsa_writei_t * writei;
@@ -213,6 +216,7 @@
snd_pcm_hw_params_t *params;
snd_pcm_access_mask_t *access;
int err;
+ unsigned int rate = format->rate;
/* allocate the hardware parameter structure */
snd_pcm_hw_params_alloca(¶ms);
@@ -246,7 +250,7 @@
/* set the number of channels */
internal->cmd = "snd_pcm_hw_params_set_channels";
err = snd_pcm_hw_params_set_channels(internal->pcm_handle,
- params, format->channels);
+ params, (unsigned int)format->channels);
if (err < 0)
return err;
@@ -256,29 +260,29 @@
/* set the sample rate */
internal->cmd = "snd_pcm_hw_params_set_rate_near";
err = snd_pcm_hw_params_set_rate_near(internal->pcm_handle,
- params, format->rate, 0);
+ params, &rate, 0);
if (err < 0)
return err;
/* set the length of the hardware sample buffer in milliseconds */
internal->cmd = "snd_pcm_hw_params_set_buffer_time_near";
err = snd_pcm_hw_params_set_buffer_time_near(internal->pcm_handle,
- params, internal->buffer_time, 0);
+ params, &(internal->buffer_time), 0);
if (err < 0)
return err;
/* save the buffer time in case alsa overrode it */
- internal->buffer_time = err;
+ /*internal->buffer_time = err;*/
/* calculate a period time of one half sample time */
- if ((internal->period_time == 0) && (format->rate > 0))
+ if ((internal->period_time == 0) && (rate > 0))
internal->period_time =
- 1000000 * AO_ALSA_SAMPLE_XFER / format->rate;
+ 1000000 * AO_ALSA_SAMPLE_XFER / rate;
/* set the time per hardware sample transfer */
internal->cmd = "snd_pcm_hw_params_set_period_time_near";
err = snd_pcm_hw_params_set_period_time_near(internal->pcm_handle,
- params, internal->period_time, 0);
+ params, &(internal->period_time), 0);
if (err < 0)
return err;
@@ -289,10 +293,18 @@
return err;
/* save the period size in bytes for posterity */
- internal->period_size = snd_pcm_hw_params_get_period_size(params, 0);
+ internal->cmd = "snd_pcm_hw_get_period_size";
+ err = snd_pcm_hw_params_get_period_size(params,
+ &(internal->period_size), 0);
+ if (err < 0)
+ return err;
/* save the buffer size in bytes for posterity */
- internal->buffer_size = snd_pcm_hw_params_get_buffer_size(params);
+ internal->cmd = "snd_pcm_hw_get_period_size";
+ err = snd_pcm_hw_params_get_buffer_size(params,
+ &(internal->buffer_size));
+ if (err < 0)
+ return err;
return 1;
}
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list