diff options
author | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2005-07-31 14:39:39 +0000 |
---|---|---|
committer | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2005-07-31 14:39:39 +0000 |
commit | 18c5ecf77162abf61b191b30127c47a3c050aac4 (patch) | |
tree | 0209d1e45aac22b05e5d5171d1d2f71015f0a88e | |
parent | 8d23812f7faeb1ab1f397ebf0fdc21593d9b37fd (diff) | |
download | xine-lib-18c5ecf77162abf61b191b30127c47a3c050aac4.tar.gz xine-lib-18c5ecf77162abf61b191b30127c47a3c050aac4.tar.bz2 |
Summary: For alsa-lib version 1.0.9 or above, we can detect if the hardware can do resampling or not.
If resampling is not supported in hardware, old alsa normally does software resampling, but the current alsa-lib software resampling is not very good quality, so as we can detect if the software resampler is being used, we can choose to use our own high quality resampler.
TODO: This requires the addition of a new ./configure detection option HAS_ALSA_1_0_9
CVS patchset: 7702
CVS date: 2005/07/31 14:39:39
-rw-r--r-- | src/audio_out/audio_alsa_out.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 5f1823325..a121fe89f 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,13 +26,16 @@ * (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk> * * - * $Id: audio_alsa_out.c,v 1.153 2004/12/27 16:55:39 hadess Exp $ + * $Id: audio_alsa_out.c,v 1.154 2005/07/31 14:39:39 jcdutton Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif +/* TODO: Make ./configure define this */ +// #define HAS_ALSA_1_0_9 + #include <stdio.h> #include <stdarg.h> #include <errno.h> @@ -471,6 +474,10 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int this->num_channels, err, snd_strerror(err)); goto close; } +#ifdef HAS_ALSA_1_0_9 + /* Restrict a configuration space to contain only real hardware rates */ + err = snd_pcm_hw_params_set_rate_resample(this->audio_fd, params, 0); +#endif /* set the stream rate [Hz] */ dir=0; err = snd_pcm_hw_params_set_rate_near(this->audio_fd, params, &rate, &dir); |