diff options
author | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2002-07-02 00:11:56 +0000 |
---|---|---|
committer | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2002-07-02 00:11:56 +0000 |
commit | 362bc3bebf030ee7b9485ac922ee4566c527dca7 (patch) | |
tree | bebdc9353447642da198a19f25693dde3ee17a1a | |
parent | 2aba2456be6e9d7c4adaa0aaa7b0b7aba48cd3a0 (diff) | |
download | xine-lib-362bc3bebf030ee7b9485ac922ee4566c527dca7.tar.gz xine-lib-362bc3bebf030ee7b9485ac922ee4566c527dca7.tar.bz2 |
Some fixes to the recent changes made to audio_alsa_out.
CVS patchset: 2195
CVS date: 2002/07/02 00:11:56
-rw-r--r-- | src/audio_out/audio_alsa_out.c | 13 | ||||
-rw-r--r-- | src/xine-engine/audio_out.c | 7 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 0ac30a2e0..7e229b6be 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk> * * - * $Id: audio_alsa_out.c,v 1.67 2002/07/01 13:51:26 miguelfreitas Exp $ + * $Id: audio_alsa_out.c,v 1.68 2002/07/02 00:11:56 jcdutton Exp $ */ #ifdef HAVE_CONFIG_H @@ -283,17 +283,19 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int goto __close; } /* set the stream rate [Hz] */ + dir=0; err = snd_pcm_hw_params_set_rate_near(this->audio_fd, params, rate, &dir); - if (err < 0) { - printf ("audio_alsa_out: rate not available\n"); - goto __close; - } + if (err < 0) { + printf ("audio_alsa_out: rate not available\n"); + goto __close; + } this->output_sample_rate = (uint32_t)err; if (this->input_sample_rate != this->output_sample_rate) { printf ("audio_alsa_out: audio rate : %d requested, %d provided by device/sec\n", this->input_sample_rate, this->output_sample_rate); } /* set the ring-buffer time [us] (large enough for x us|y samples ...) */ + dir=0; err = snd_pcm_hw_params_set_buffer_time_near(this->audio_fd, params, 500000, &dir); if (err < 0) { printf ("audio_alsa_out: buffer time not available\n"); @@ -303,6 +305,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int /* set the period time [us] (interrupt very x us|y samples ...) */ #warning "FIXME: 256 samples div 48kHz are less than 5ms. When ALSA resamples->BOOM" for (period_size = 256; period_size < buffer_size; period_size *= 2) { + dir=0; err = snd_pcm_hw_params_set_period_size_near(this->audio_fd, params, period_size, &dir); if (err < 0) { diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 9767ba26b..d8dc863ab 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.60 2002/07/01 13:51:27 miguelfreitas Exp $ + * $Id: audio_out.c,v 1.61 2002/07/02 00:11:56 jcdutton Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -589,9 +589,10 @@ static int ao_open(ao_instance_t *this, printf("audio_out: will resample audio from %d to %d\n", this->input.rate, this->output.rate); - this->frame_rate_factor = (double) this->output.rate / (double) this->input.rate; - this->audio_step = (uint32_t) 90000 * (uint32_t) 32768 / this->input.rate; + this->frame_rate_factor = ((double)(this->output.rate)) / ((double)(this->input.rate)); + /* FIXME: If this->frames_per_kpts line goes after this->audio_step line, xine crashes with FPE, when compiled with gcc 3.0.1!!! Why? */ this->frames_per_kpts = this->output.rate * 1024 / 90000; + this->audio_step = ( (uint32_t)(90000) * (uint32_t)(32768) )/ this->input.rate; #ifdef LOG printf ("audio_out : audio_step %d pts per 32768 frames\n", this->audio_step); #endif |