diff options
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_alsa.c | 5 | ||||
-rw-r--r-- | libao2/ao_oss.c | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index d6b9175f52..f47b4fbf3d 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -783,8 +783,11 @@ static void reset(void) static int play(void* data, int len, int flags) { - int num_frames = len / bytes_per_sample; + int num_frames; snd_pcm_sframes_t res = 0; + if (!(flags & AOPLAY_FINAL_CHUNK)) + len = len / ao_data.outburst * ao_data.outburst; + num_frames = len / bytes_per_sample; //mp_msg(MSGT_AO,MSGL_ERR,"alsa-play: frames=%i, len=%i\n",num_frames,len); diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 0ff87efadd..b4e5ab49b8 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -425,8 +425,19 @@ ac3_retry: } ao_data.bps=ao_data.channels; - if(ao_data.format != AF_FORMAT_U8 && ao_data.format != AF_FORMAT_S8) + switch (ao_data.format & AF_FORMAT_BITS_MASK) { + case AF_FORMAT_8BIT: + break; + case AF_FORMAT_16BIT: ao_data.bps*=2; + break; + case AF_FORMAT_24BIT: + ao_data.bps*=3; + break; + case AF_FORMAT_32BIT: + ao_data.bps*=4; + break; + } ao_data.outburst-=ao_data.outburst % ao_data.bps; // round down ao_data.bps*=ao_data.samplerate; |