From 7b0900081349f8a603a8315948826faf9600039d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sat, 22 Feb 2003 17:53:01 +0000 Subject: [PATCH] Removed snd_pcm_hwdiff() function --- include/pcm.h | 1 - src/Versions | 1 - src/pcm/pcm.c | 44 -------------------------------------------- src/pcm/pcm_dmix.c | 2 +- src/pcm/pcm_hw.c | 4 ++-- src/pcm/pcm_local.h | 1 - src/pcm/pcm_plugin.c | 2 +- 7 files changed, 4 insertions(+), 51 deletions(-) diff --git a/include/pcm.h b/include/pcm.h index e2121886..49279172 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -410,7 +410,6 @@ int snd_pcm_drain(snd_pcm_t *pcm); int snd_pcm_pause(snd_pcm_t *pcm, int enable); snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm); int snd_pcm_hwsync(snd_pcm_t *pcm); -int snd_pcm_hwdiff(snd_pcm_t *pcm, snd_pcm_uframes_t *diff, snd_pcm_uframes_t *old_pos); int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp); int snd_pcm_resume(snd_pcm_t *pcm); snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm); diff --git a/src/Versions b/src/Versions index ea45321a..b9dd7407 100644 --- a/src/Versions +++ b/src/Versions @@ -83,7 +83,6 @@ ALSA_0.9.0rc4 { ALSA_0.9.0rc8 { global: - snd_pcm_hwdiff; snd_pcm_forward; } ALSA_0.9.0rc4; diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index b53c43c7..c4b31c39 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -400,12 +400,6 @@ only when the stream is in the running or draining (playback only) state. Note that this function does not update the current r/w pointer for applications, so the function \link ::snd_pcm_avail_update \endlink must be called afterwards before any read/write begin+commit operations. -

-To determine the processed frames by hardware, the function \link ::snd_pcm_hwdiff \endlink -might be used. Note that this function returns cached value which is synchronized with -hardware using the \link ::snd_pcm_hwsync \endlink function. The application may -manage the right r/w pointer via \link ::snd_pcm_rewind \endlink and -\link ::snd_pcm_forward \endlink functions. \section pcm_action Managing the stream state @@ -874,44 +868,6 @@ int snd_pcm_hwsync(snd_pcm_t *pcm) return pcm->fast_ops->hwsync(pcm->fast_op_arg); } -/** - * \brief Return count of processed frames by hardware from last call - * \param pcm PCM handle - * \param diff Difference between last position and current - * \param old_pos Old position on entry, actual position on exit - * \return 0 on success otherwise a negative error code - * - * The old_ptr parameter is in range 0 ... (boundary - 1). It contains - * count_of_ring_buffer_crosses * buffer_size + offset in the ring buffer. - * Using this value is not intented - * - * Note this function does not obtain the real position from hardware. - * The function \link ::snd_pcm_hwsync \endlink have to be called - * before to obtain the real hardware position. - */ -#ifndef DOXYGEN -int INTERNAL(snd_pcm_hwdiff)(snd_pcm_t *pcm, snd_pcm_uframes_t *diff, snd_pcm_uframes_t *old_pos) -#else -int snd_pcm_hwdiff(snd_pcm_t *pcm, snd_pcm_uframes_t *diff, snd_pcm_uframes_t *old_pos) -#endif -{ - snd_pcm_uframes_t d, hw_ptr; - - assert(pcm && diff && old_pos); - assert(pcm->setup); - assert(*old_pos < pcm->boundary); - hw_ptr = *pcm->hw.ptr; - if (hw_ptr < *old_pos) { - d = (pcm->boundary - *old_pos) + hw_ptr; - } else { - d = hw_ptr - *old_pos; - } - *diff = d; - *old_pos = hw_ptr; - return 0; -} -default_symbol_version(__snd_pcm_hwdiff, snd_pcm_hwdiff, ALSA_0.9.0rc8); - /** * \brief Obtain delay for a running PCM handle * \param pcm PCM handle diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index 588b3020..0dcfaac8 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -1096,7 +1096,7 @@ static snd_pcm_sframes_t snd_pcm_dmix_forward(snd_pcm_t *pcm, snd_pcm_uframes_t avail = snd_pcm_mmap_avail(pcm); if (avail < 0) return 0; - if (frames > avail) + if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_forward(pcm, frames); return frames; diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index ef27ea84..a3a97507 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -533,7 +533,7 @@ static snd_pcm_sframes_t snd_pcm_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t fr avail = snd_pcm_mmap_avail(pcm); if (avail < 0) return 0; - if (frames > avail) + if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_forward(pcm, frames); return frames; @@ -715,7 +715,7 @@ static int snd_pcm_hw_close(snd_pcm_t *pcm) } static snd_pcm_sframes_t snd_pcm_hw_mmap_commit(snd_pcm_t *pcm, - snd_pcm_uframes_t offset, + snd_pcm_uframes_t offset ATTRIBUTE_UNUSED, snd_pcm_uframes_t size) { snd_pcm_hw_t *hw = pcm->private_data; diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index bc85ebc4..5873b1bd 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -550,7 +550,6 @@ int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); #ifdef INTERNAL -int INTERNAL(snd_pcm_hwdiff)(snd_pcm_t *pcm, snd_pcm_uframes_t *diff, snd_pcm_uframes_t *old_pos); snd_pcm_sframes_t INTERNAL(snd_pcm_forward)(snd_pcm_t *pcm, snd_pcm_uframes_t frames); int INTERNAL(snd_pcm_hw_params_get_access)(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access); diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c index 51e56475..ce713055 100644 --- a/src/pcm/pcm_plugin.c +++ b/src/pcm/pcm_plugin.c @@ -325,7 +325,7 @@ snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frame sframes = frames; snd_atomic_write_begin(&plugin->watom); sframes = snd_pcm_forward(plugin->slave, (snd_pcm_uframes_t) sframes); - if (sframes < 0) { + if ((snd_pcm_sframes_t) sframes < 0) { snd_atomic_write_end(&plugin->watom); return sframes; } -- 2.47.1