diff options
author | al3x <al3x@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-06-14 18:29:05 +0000 |
---|---|---|
committer | al3x <al3x@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-06-14 18:29:05 +0000 |
commit | 2d2e0932a099944cb3b4d94386ebcc26893f2e0a (patch) | |
tree | 046d57d218f6310f724708b5b27f6c3cc3bcced4 /libao2 | |
parent | 0674db5afcb61efd2dd210cebb6b92db143aca29 (diff) |
hacked to work seek/pause/resume/uninit
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1130 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_alsa1x.c | 19 | ||||
-rw-r--r-- | libao2/ao_alsa9.c | 19 |
2 files changed, 34 insertions, 4 deletions
diff --git a/libao2/ao_alsa1x.c b/libao2/ao_alsa1x.c index 2cced63040..979f93c869 100644 --- a/libao2/ao_alsa1x.c +++ b/libao2/ao_alsa1x.c @@ -198,7 +198,7 @@ static int init(int rate_hz, int channels, int format, int flags) return(0); } - if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams, + if ((err = snd_pcm_hw_params_set_rate(alsa_handler, alsa_hwparams, ao_samplerate, 0)) < 0) { printf("alsa-init: unable to set samplerate: %s\n", @@ -336,11 +336,13 @@ static void uninit() return; } +#ifdef start if ((err = snd_pcm_reset(alsa_handler)) < 0) { printf("alsa-uninit: pcm reset error: %s\n", snd_strerror(err)); return; } +#endif if ((err = snd_pcm_close(alsa_handler)) < 0) { @@ -359,11 +361,13 @@ static void audio_pause() return; } +#ifdef reset if ((err = snd_pcm_reset(alsa_handler)) < 0) { printf("alsa-pause: pcm reset error: %s\n", snd_strerror(err)); return; } +#endif } static void audio_resume() @@ -376,11 +380,13 @@ static void audio_resume() return; } +#ifdef start if ((err = snd_pcm_start(alsa_handler)) < 0) { printf("alsa-resume: pcm start error: %s\n", snd_strerror(err)); return; } +#endif } /* stop playing and empty buffers (for seeking/pause) */ @@ -394,11 +400,13 @@ static void reset() return; } +#ifdef start if ((err = snd_pcm_reset(alsa_handler)) < 0) { printf("alsa-reset: pcm reset error: %s\n", snd_strerror(err)); return; } +#endif if ((err = snd_pcm_prepare(alsa_handler)) < 0) { @@ -406,11 +414,13 @@ static void reset() return; } +#ifdef start if ((err = snd_pcm_start(alsa_handler)) < 0) { printf("alsa-reset: pcm start error: %s\n", snd_strerror(err)); return; } +#endif } /* @@ -473,6 +483,9 @@ static int get_space() } snd_pcm_status_free(status); + + if (ret < 0) + ret = 0; return(ret); } @@ -506,6 +519,8 @@ static int get_delay() } snd_pcm_status_free(status); + + if (ret < 0) + ret = 0; return(ret); } - diff --git a/libao2/ao_alsa9.c b/libao2/ao_alsa9.c index 2cced63040..979f93c869 100644 --- a/libao2/ao_alsa9.c +++ b/libao2/ao_alsa9.c @@ -198,7 +198,7 @@ static int init(int rate_hz, int channels, int format, int flags) return(0); } - if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams, + if ((err = snd_pcm_hw_params_set_rate(alsa_handler, alsa_hwparams, ao_samplerate, 0)) < 0) { printf("alsa-init: unable to set samplerate: %s\n", @@ -336,11 +336,13 @@ static void uninit() return; } +#ifdef start if ((err = snd_pcm_reset(alsa_handler)) < 0) { printf("alsa-uninit: pcm reset error: %s\n", snd_strerror(err)); return; } +#endif if ((err = snd_pcm_close(alsa_handler)) < 0) { @@ -359,11 +361,13 @@ static void audio_pause() return; } +#ifdef reset if ((err = snd_pcm_reset(alsa_handler)) < 0) { printf("alsa-pause: pcm reset error: %s\n", snd_strerror(err)); return; } +#endif } static void audio_resume() @@ -376,11 +380,13 @@ static void audio_resume() return; } +#ifdef start if ((err = snd_pcm_start(alsa_handler)) < 0) { printf("alsa-resume: pcm start error: %s\n", snd_strerror(err)); return; } +#endif } /* stop playing and empty buffers (for seeking/pause) */ @@ -394,11 +400,13 @@ static void reset() return; } +#ifdef start if ((err = snd_pcm_reset(alsa_handler)) < 0) { printf("alsa-reset: pcm reset error: %s\n", snd_strerror(err)); return; } +#endif if ((err = snd_pcm_prepare(alsa_handler)) < 0) { @@ -406,11 +414,13 @@ static void reset() return; } +#ifdef start if ((err = snd_pcm_start(alsa_handler)) < 0) { printf("alsa-reset: pcm start error: %s\n", snd_strerror(err)); return; } +#endif } /* @@ -473,6 +483,9 @@ static int get_space() } snd_pcm_status_free(status); + + if (ret < 0) + ret = 0; return(ret); } @@ -506,6 +519,8 @@ static int get_delay() } snd_pcm_status_free(status); + + if (ret < 0) + ret = 0; return(ret); } - |