[Mplayer-cvslog] CVS: main/libao2 ao_alsa9.c,1.8,1.9
Zoltan Ponekker
pontscho at mplayer.dev.hu
Wed Oct 3 20:10:07 CEST 2001
Update of /cvsroot/mplayer/main/libao2
In directory mplayer:/var/tmp.root/cvs-serv25578/libao2
Modified Files:
ao_alsa9.c
Log Message:
alsa9 pecs by joy_ping <joy at pingfm.org>
Index: ao_alsa9.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_alsa9.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ao_alsa9.c 23 Jun 2001 18:59:54 -0000 1.8
+++ ao_alsa9.c 3 Oct 2001 18:09:51 -0000 1.9
@@ -41,10 +41,10 @@
static snd_pcm_hw_params_t *alsa_hwparams;
static snd_pcm_sw_params_t *alsa_swparams;
static char *alsa_device;
-#define ALSA_DEVICE_SIZE 48
+#define ALSA_DEVICE_SIZE 48 /* war 48 */
-static int alsa_fragsize = 8192; /* 4096 */
-static int alsa_fragcount = 8;
+static int alsa_fragsize = 8192; /* 4096 war 8192*/
+static int alsa_fragcount = 8; /* war 8 */
/* to set/get/query special features/parameters */
static int control(int cmd, int arg)
@@ -69,12 +69,12 @@
return(CONTROL_UNKNOWN);
}
-#undef start
-#define buffersize
-#undef buffertime
+#undef start /* war undef */
+#define buffersize
+#undef buffertime /* war undef? */
#define set_period
-#undef sw_params
-#undef set_start_mode
+#define sw_params /* war undef */
+#undef set_start_mode /* war undef */
/*
open & setup audio device
@@ -86,7 +86,7 @@
int cards = -1;
snd_pcm_info_t *alsa_info;
- printf("alsa-init: Don't use this buggy driver, ALSA-0.9.x emulates OSS very well...\n");
+ printf("alsa-init: Don't use this buggy driver, ALSA-0.9.x emulates OSS very well... modified by me\n");
printf("alsa-init: requested format: %d Hz, %d channels, %s\n", rate_hz,
channels, audio_out_format_name(format));
@@ -94,8 +94,7 @@
alsa_handler = NULL;
if (verbose)
- printf("alsa-init: compiled for ALSA-%s (%d)\n", SND_LIB_VERSION_STR,
- SND_LIB_VERSION);
+ printf("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR);
if ((err = snd_card_next(&cards)) < 0 || cards < 0)
{
@@ -103,8 +102,9 @@
return(0);
}
- ao_samplerate = rate_hz;
+ ao_samplerate = rate_hz; /*war rate_hz */
ao_bps = channels; /* really this is bytes per frame so bad varname */
+ /* ao_bps = channels */
ao_format = format;
ao_channels = channels;
ao_outburst = OUTBURST;
@@ -217,13 +217,14 @@
return(0);
}
- if ((err = snd_pcm_hw_params_set_rate(alsa_handler, alsa_hwparams,
- ao_samplerate, 0)) < 0)
- {
- printf("alsa-init: unable to set samplerate: %s\n",
- snd_strerror(err));
- return(0);
- }
+ if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams, ao_samplerate, 0)) < 0)
+/* war nur snd_pcm_hw_params_set_rate */
+ {
+ printf("alsa-init: unable to set samplerate-2: %s\n",
+ snd_strerror(err));
+ //snd_pcm_hw_params_dump(alsa_hwparams, errlog);
+ return(0);
+ }
#ifdef set_period
{
@@ -257,10 +258,9 @@
#ifdef buffertime
{
- int alsa_buffer_time = 60;
+ int alsa_buffer_time = 60; /* war 60 */
- if ((err = snd_pcm_hw_params_set_buffer_time_near(alsa_handler, alsa_hwparams,
- alsa_buffer_time, 0)) < 0)
+ if ((err = snd_pcm_hw_params_set_buffer_time_near(alsa_handler, alsa_hwparams, alsa_buffer_time, 0)) < 0)
{
printf("alsa-init: unable to set buffer time near: %s\n",
snd_strerror(err));
@@ -268,8 +268,8 @@
} else
alsa_buffer_time = err;
- if ((err = snd_pcm_hw_params_set_period_time_near(alsa_handler, alsa_hwparams,
- alsa_buffer_time/ao_bps, 0)) < 0)
+ if ((err = snd_pcm_hw_params_set_period_time_near(alsa_handler, alsa_hwparams, alsa_buffer_time/ao_bps, 0)) < 0)
+ /* war alsa_buffer_time/ao_bps */
{
printf("alsa-init: unable to set period time: %s\n",
snd_strerror(err));
@@ -451,8 +451,10 @@
{
int got_len;
- if ((got_len = snd_pcm_writei(alsa_handler, data, (len/ao_bps))) != (len/ao_bps))
- {
+ got_len = snd_pcm_writei(alsa_handler, data, len / 4);
+
+ // war: if ((got_len = snd_pcm_writei(alsa_handler, data, (len/ao_bps))) != (len/ao_bps)) {
+
if (got_len == -EPIPE) /* underrun? */
{
printf("alsa-play: alsa underrun, resetting stream\n");
@@ -468,7 +470,6 @@
return(0);
}
return(len); /* 2nd write was ok */
- }
}
return(len);
}
More information about the MPlayer-cvslog
mailing list