Mercurial > mplayer.hg
changeset 8346:368019e0153a
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>
author | arpi |
---|---|
date | Wed, 04 Dec 2002 21:42:22 +0000 |
parents | 6ba26d05c7a9 |
children | 03ee1d7deba5 |
files | libao2/ao_alsa1x.c libao2/ao_alsa9.c |
diffstat | 2 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/ao_alsa1x.c Wed Dec 04 21:33:36 2002 +0000 +++ b/libao2/ao_alsa1x.c Wed Dec 04 21:42:22 2002 +0000 @@ -853,10 +853,10 @@ //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 @@ } if (res > 0) { - output_samples += ao_data.channels * res; + + /* output_samples += ao_data.channels * res; */ + output_samples += res * bytes_per_sample; + num_frames -= res; }
--- a/libao2/ao_alsa9.c Wed Dec 04 21:33:36 2002 +0000 +++ b/libao2/ao_alsa9.c Wed Dec 04 21:42:22 2002 +0000 @@ -853,10 +853,10 @@ //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 @@ } if (res > 0) { - output_samples += ao_data.channels * res; + + /* output_samples += ao_data.channels * res; */ + output_samples += res * bytes_per_sample; + num_frames -= res; }