diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-04 21:42:22 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-04 21:42:22 +0000 |
commit | 4d31c3c53d9217e5432d7cc53c1b631dedf6e99f (patch) | |
tree | 4cf5102d2b03805c56c6a46f4674dcc6bfb2c8fc /libao2 | |
parent | c4fba71daf31f13cd2f44f09b289ceaf6365f8fd (diff) |
The enclosed patch should fix problems associated with playing 8-bit wide
audio samples (or anything other than 16-bit samples, for that matter)
using the alsa9 ao driver.
patch by "R.L. Horn" <eastcheap@fastmail.fm>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8347 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_alsa1x.c | 9 | ||||
-rw-r--r-- | libao2/ao_alsa9.c | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/libao2/ao_alsa1x.c b/libao2/ao_alsa1x.c index 92ffb033b5..5ed8f41ece 100644 --- a/libao2/ao_alsa1x.c +++ b/libao2/ao_alsa1x.c @@ -853,10 +853,10 @@ static int play_normal(void* data, int len) //bytes_per_sample is always 4 for 2 chn S16_LE int num_frames = len / bytes_per_sample; - signed short *output_samples=data; + char *output_samples = (char *)data; snd_pcm_sframes_t res = 0; - //printf("alsa-play: frames=%i, len=%i",num_frames,len); + //fprintf(stderr,"alsa-play: frames=%i, len=%i\n",num_frames,len); if (!alsa_handler) { printf("alsa-play: device configuration error"); @@ -891,7 +891,10 @@ static int play_normal(void* data, int len) } if (res > 0) { - output_samples += ao_data.channels * res; + + /* output_samples += ao_data.channels * res; */ + output_samples += res * bytes_per_sample; + num_frames -= res; } diff --git a/libao2/ao_alsa9.c b/libao2/ao_alsa9.c index 92ffb033b5..5ed8f41ece 100644 --- a/libao2/ao_alsa9.c +++ b/libao2/ao_alsa9.c @@ -853,10 +853,10 @@ static int play_normal(void* data, int len) //bytes_per_sample is always 4 for 2 chn S16_LE int num_frames = len / bytes_per_sample; - signed short *output_samples=data; + char *output_samples = (char *)data; snd_pcm_sframes_t res = 0; - //printf("alsa-play: frames=%i, len=%i",num_frames,len); + //fprintf(stderr,"alsa-play: frames=%i, len=%i\n",num_frames,len); if (!alsa_handler) { printf("alsa-play: device configuration error"); @@ -891,7 +891,10 @@ static int play_normal(void* data, int len) } if (res > 0) { - output_samples += ao_data.channels * res; + + /* output_samples += ao_data.channels * res; */ + output_samples += res * bytes_per_sample; + num_frames -= res; } |