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
This commit is contained in:
arpi 2002-12-04 21:42:22 +00:00
parent c4fba71daf
commit 4d31c3c53d
2 changed files with 12 additions and 6 deletions

View File

@ -853,10 +853,10 @@ static int play_normal(void* data, int len)
//bytes_per_sample is always 4 for 2 chn S16_LE //bytes_per_sample is always 4 for 2 chn S16_LE
int num_frames = len / bytes_per_sample; int num_frames = len / bytes_per_sample;
signed short *output_samples=data; char *output_samples = (char *)data;
snd_pcm_sframes_t res = 0; 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) { if (!alsa_handler) {
printf("alsa-play: device configuration error"); printf("alsa-play: device configuration error");
@ -891,7 +891,10 @@ static int play_normal(void* data, int len)
} }
if (res > 0) { if (res > 0) {
output_samples += ao_data.channels * res;
/* output_samples += ao_data.channels * res; */
output_samples += res * bytes_per_sample;
num_frames -= res; num_frames -= res;
} }

View File

@ -853,10 +853,10 @@ static int play_normal(void* data, int len)
//bytes_per_sample is always 4 for 2 chn S16_LE //bytes_per_sample is always 4 for 2 chn S16_LE
int num_frames = len / bytes_per_sample; int num_frames = len / bytes_per_sample;
signed short *output_samples=data; char *output_samples = (char *)data;
snd_pcm_sframes_t res = 0; 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) { if (!alsa_handler) {
printf("alsa-play: device configuration error"); printf("alsa-play: device configuration error");
@ -891,7 +891,10 @@ static int play_normal(void* data, int len)
} }
if (res > 0) { if (res > 0) {
output_samples += ao_data.channels * res;
/* output_samples += ao_data.channels * res; */
output_samples += res * bytes_per_sample;
num_frames -= res; num_frames -= res;
} }