From 5db0fbd95ec8790cd1a133bb57f701c5c9f970c0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 9 Nov 2014 11:45:04 +0100 Subject: audio/out: consistently use double return type for get_delay ao_get_delay() returns double, but the get_delay callback still returned float. --- audio/out/ao_alsa.c | 10 +++++----- audio/out/ao_coreaudio_exclusive.c | 4 ++-- audio/out/ao_dsound.c | 6 ++---- audio/out/ao_null.c | 2 +- audio/out/ao_openal.c | 4 ++-- audio/out/ao_oss.c | 8 ++++---- audio/out/ao_pulse.c | 6 +++--- audio/out/ao_rsound.c | 2 +- audio/out/ao_sndio.c | 2 +- audio/out/internal.h | 2 +- audio/out/pull.c | 2 +- audio/out/push.c | 4 ++-- 12 files changed, 25 insertions(+), 27 deletions(-) (limited to 'audio/out') diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index 31c4ff6831..8d85a0a660 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -54,7 +54,7 @@ struct priv { snd_pcm_format_t alsa_fmt; int can_pause; snd_pcm_sframes_t prepause_frames; - float delay_before_pause; + double delay_before_pause; int buffersize; // in frames int outburst; // in frames @@ -84,7 +84,7 @@ struct priv { MP_WARN(ao, "%s: %s\n", (message), snd_strerror(err)); \ } while (0) -static float get_delay(struct ao *ao); +static double get_delay(struct ao *ao); static void uninit(struct ao *ao); /* to set/get/query special features/parameters */ @@ -586,7 +586,7 @@ static void audio_pause(struct ao *ao) if (snd_pcm_delay(p->alsa, &p->prepause_frames) < 0 || p->prepause_frames < 0) p->prepause_frames = 0; - p->delay_before_pause = p->prepause_frames / (float)ao->samplerate; + p->delay_before_pause = p->prepause_frames / (double)ao->samplerate; err = snd_pcm_drop(p->alsa); CHECK_ALSA_ERROR("pcm drop error"); @@ -697,7 +697,7 @@ alsa_error: } /* delay in seconds between first and last sample in buffer */ -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { struct priv *p = ao->priv; snd_pcm_sframes_t delay; @@ -713,7 +713,7 @@ static float get_delay(struct ao *ao) snd_pcm_forward(p->alsa, -delay); delay = 0; } - return (float)delay / (float)ao->samplerate; + return delay / (double)ao->samplerate; } #define MAX_POLL_FDS 20 diff --git a/audio/out/ao_coreaudio_exclusive.c b/audio/out/ao_coreaudio_exclusive.c index 49560a2e80..af77409534 100644 --- a/audio/out/ao_coreaudio_exclusive.c +++ b/audio/out/ao_coreaudio_exclusive.c @@ -581,12 +581,12 @@ static int get_space(struct ao *ao) return mp_ring_available(p->buffer) / ao->sstride; } -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { // FIXME: should also report the delay of coreaudio itself (hardware + // internal buffers) struct priv *p = ao->priv; - return mp_ring_buffered(p->buffer) / (float)ao->bps; + return mp_ring_buffered(p->buffer) / (double)ao->bps; } static void uninit(struct ao *ao) diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c index 96cded6989..b5d8c61bcc 100644 --- a/audio/out/ao_dsound.c +++ b/audio/out/ao_dsound.c @@ -104,8 +104,6 @@ struct priv { struct ao_device_list *listing; ///temporary during list_devs() }; -static float get_delay(struct ao *ao); - /***************************************************************************************/ /** @@ -678,12 +676,12 @@ static int play(struct ao *ao, void **data, int samples, int flags) \brief get the delay between the first and last sample in the buffer \return delay in seconds */ -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { struct priv *p = ao->priv; int space = check_free_buffer_size(ao); - return (float)(p->buffer_size - space) / (float)ao->bps; + return (p->buffer_size - space) / (double)ao->bps; } #define OPT_BASE_STRUCT struct priv diff --git a/audio/out/ao_null.c b/audio/out/ao_null.c index f12cbdede5..8fe783f76d 100644 --- a/audio/out/ao_null.c +++ b/audio/out/ao_null.c @@ -176,7 +176,7 @@ static int play(struct ao *ao, void **data, int samples, int flags) return accepted; } -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { struct priv *priv = ao->priv; diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c index 52b94299f0..b864bb8a8f 100644 --- a/audio/out/ao_openal.c +++ b/audio/out/ao_openal.c @@ -293,12 +293,12 @@ static int play(struct ao *ao, void **data, int samples, int flags) return num * CHUNK_SAMPLES; } -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { ALint queued; unqueue_buffers(); alGetSourcei(sources[0], AL_BUFFERS_QUEUED, &queued); - return queued * CHUNK_SAMPLES / (float)ao->samplerate; + return queued * CHUNK_SAMPLES / (double)ao->samplerate; } #define OPT_BASE_STRUCT struct priv diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index 08266d96ce..5dc1ea9830 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -546,7 +546,7 @@ static int play(struct ao *ao, void **data, int samples, int flags) } // return: delay in seconds between first and last sample in buffer -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { struct priv *p = ao->priv; if (p->audio_fd < 0) { @@ -560,18 +560,18 @@ static float get_delay(struct ao *ao) #ifdef SNDCTL_DSP_GETODELAY int r = 0; if (ioctl(p->audio_fd, SNDCTL_DSP_GETODELAY, &r) != -1) - return ((float)r) / (float)ao->bps; + return r / (double)ao->bps; #endif p->audio_delay_method = 1; // fallback if not supported } if (p->audio_delay_method == 1) { audio_buf_info zz = {0}; if (ioctl(p->audio_fd, SNDCTL_DSP_GETOSPACE, &zz) != -1) { - return ((float)(p->buffersize - zz.bytes)) / (float)ao->bps; + return (p->buffersize - zz.bytes) / (double)ao->bps; } p->audio_delay_method = 0; // fallback if not supported } - return ((float)p->buffersize) / (float)ao->bps; + return p->buffersize / (double)ao->bps; } diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index f9fe64d84d..ae708df59e 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -530,7 +530,7 @@ static int get_space(struct ao *ao) return space / ao->sstride; } -static float get_delay_hackfixed(struct ao *ao) +static double get_delay_hackfixed(struct ao *ao) { /* This code basically does what pa_stream_get_latency() _should_ * do, but doesn't due to multiple known bugs in PulseAudio (at @@ -585,7 +585,7 @@ static float get_delay_hackfixed(struct ao *ao) return latency / 1e6; } -static float get_delay_pulse(struct ao *ao) +static double get_delay_pulse(struct ao *ao) { struct priv *priv = ao->priv; pa_usec_t latency = (pa_usec_t) -1; @@ -603,7 +603,7 @@ static float get_delay_pulse(struct ao *ao) } // Return the current latency in seconds -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { struct priv *priv = ao->priv; if (priv->cfg_latency_hacks) { diff --git a/audio/out/ao_rsound.c b/audio/out/ao_rsound.c index fe187144a6..26a0e2108b 100644 --- a/audio/out/ao_rsound.c +++ b/audio/out/ao_rsound.c @@ -153,7 +153,7 @@ static int play(struct ao *ao, void **data, int samples, int flags) return rsd_write(priv->rd, data[0], samples * ao->sstride) / ao->sstride; } -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { struct priv *priv = ao->priv; return rsd_delay_ms(priv->rd) / 1000.0; diff --git a/audio/out/ao_sndio.c b/audio/out/ao_sndio.c index c528d5729d..2daa63f4ed 100644 --- a/audio/out/ao_sndio.c +++ b/audio/out/ao_sndio.c @@ -282,7 +282,7 @@ static int get_space(struct ao *ao) /* * return: delay in seconds between first and last sample in buffer */ -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { struct priv *p = ao->priv; diff --git a/audio/out/internal.h b/audio/out/internal.h index fbea763306..4d18adef78 100644 --- a/audio/out/internal.h +++ b/audio/out/internal.h @@ -135,7 +135,7 @@ struct ao_driver { // push based: see ao_play() int (*play)(struct ao *ao, void **data, int samples, int flags); // push based: see ao_get_delay() - float (*get_delay)(struct ao *ao); + double (*get_delay)(struct ao *ao); // push based: block until all queued audio is played (optional) void (*drain)(struct ao *ao); // Optional. Return true if audio has stopped in any way. diff --git a/audio/out/pull.c b/audio/out/pull.c index 002b74fed6..f559e7d7ea 100644 --- a/audio/out/pull.c +++ b/audio/out/pull.c @@ -147,7 +147,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) // it takes until the last sample in the buffer reaches the speakers. This is // used for audio/video synchronization, so it's very important to implement // this correctly. -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { struct ao_pull_state *p = ao->api_priv; diff --git a/audio/out/push.c b/audio/out/push.c index 5872b01913..5bbc7d808f 100644 --- a/audio/out/push.c +++ b/audio/out/push.c @@ -93,11 +93,11 @@ static double unlocked_get_delay(struct ao *ao) return driver_delay + mp_audio_buffer_seconds(p->buffer); } -static float get_delay(struct ao *ao) +static double get_delay(struct ao *ao) { struct ao_push_state *p = ao->api_priv; pthread_mutex_lock(&p->lock); - float delay = unlocked_get_delay(ao); + double delay = unlocked_get_delay(ao); pthread_mutex_unlock(&p->lock); return delay; } -- cgit v1.2.3