From f44a242258c282eb1407899a64571c39d010285b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 25 May 2013 19:56:52 +0200 Subject: Replace calls to usec_sleep() This is just dumb sed replacement to mp_sleep_us(). Also remove the now unused usec_sleep() wrapper. --- audio/out/ao_coreaudio.c | 4 ++-- audio/out/ao_dsound.c | 2 +- audio/out/ao_jack.c | 4 ++-- audio/out/ao_openal.c | 2 +- audio/out/ao_rsound.c | 2 +- core/input/input.c | 2 +- core/mplayer.c | 2 +- osdep/timer.c | 6 ------ osdep/timer.h | 3 --- stream/cache2.c | 4 ++-- stream/stream.c | 4 ++-- video/out/vo_x11.c | 2 +- video/out/vo_xv.c | 2 +- 13 files changed, 15 insertions(+), 24 deletions(-) diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index 083c50faff..bec849d8ca 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -1019,7 +1019,7 @@ static int AudioStreamChangeFormat( AudioStreamID i_stream_id, AudioStreamBasicD AudioStreamBasicDescription actual_format; int j; for (j = 0; !stream_format_changed && j < 50; ++j) - usec_sleep(10000); + mp_sleep_us(10000); if (stream_format_changed) stream_format_changed = 0; else @@ -1143,7 +1143,7 @@ static void uninit(int immed) if (!immed) { long long timeleft=(1000000LL*av_fifo_size(ao->buffer))/ao_data.bps; ao_msg(MSGT_AO,MSGL_DBG2, "%d bytes left @%d bps (%d usec)\n", av_fifo_size(ao->buffer), ao_data.bps, (int)timeleft); - usec_sleep((int)timeleft); + mp_sleep_us((int)timeleft); } if (!ao->b_digital) { diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c index 967084d3ae..f57d7cd96e 100644 --- a/audio/out/ao_dsound.c +++ b/audio/out/ao_dsound.c @@ -531,7 +531,7 @@ static void audio_resume(void) static void uninit(int immed) { if (!immed) - usec_sleep(get_delay() * 1000000); + mp_sleep_us(get_delay() * 1000000); reset(); DestroyBuffer(); diff --git a/audio/out/ao_jack.c b/audio/out/ao_jack.c index 1807a11c44..c93d07c2a2 100644 --- a/audio/out/ao_jack.c +++ b/audio/out/ao_jack.c @@ -311,10 +311,10 @@ err_out: // close audio device static void uninit(int immed) { if (!immed) - usec_sleep(get_delay() * 1000 * 1000); + mp_sleep_us(get_delay() * 1000 * 1000); // HACK, make sure jack doesn't loop-output dirty buffers reset(); - usec_sleep(100 * 1000); + mp_sleep_us(100 * 1000); jack_client_close(client); av_fifo_free(buffer); buffer = NULL; diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c index 08f8bc1978..c622c5f140 100644 --- a/audio/out/ao_openal.c +++ b/audio/out/ao_openal.c @@ -211,7 +211,7 @@ static void uninit(int immed) { ALint state; alGetSourcei(sources[0], AL_SOURCE_STATE, &state); while (state == AL_PLAYING) { - usec_sleep(10000); + mp_sleep_us(10000); alGetSourcei(sources[0], AL_SOURCE_STATE, &state); } } diff --git a/audio/out/ao_rsound.c b/audio/out/ao_rsound.c index 78ea2c63f5..1c0b534ab4 100644 --- a/audio/out/ao_rsound.c +++ b/audio/out/ao_rsound.c @@ -153,7 +153,7 @@ static void uninit(struct ao *ao, bool cut_audio) * guaranteed by backend drivers, so we approximate this behavior. */ if (!cut_audio) - usec_sleep(rsd_delay_ms(priv->rd) * 1000); + mp_sleep_us(rsd_delay_ms(priv->rd) * 1000); rsd_stop(priv->rd); rsd_free(priv->rd); diff --git a/core/input/input.c b/core/input/input.c index 3d8ba711b7..c9958753cd 100644 --- a/core/input/input.c +++ b/core/input/input.c @@ -1436,7 +1436,7 @@ static void read_events(struct input_ctx *ictx, int time) } #else if (time > 0) - usec_sleep(time * 1000); + mp_sleep_us(time * 1000); #endif diff --git a/core/mplayer.c b/core/mplayer.c index 8e077e248d..7aeb91f1b2 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -2029,7 +2029,7 @@ static double timing_sleep(struct MPContext *mpctx, double time_frame) struct MPOpts *opts = &mpctx->opts; double margin = opts->softsleep ? 0.011 : 0; while (time_frame > margin) { - usec_sleep(1000000 * (time_frame - margin)); + mp_sleep_us(1000000 * (time_frame - margin)); time_frame -= get_relative_time(mpctx); } if (opts->softsleep) { diff --git a/osdep/timer.c b/osdep/timer.c index c1efeff8b5..d8dd49b9f7 100644 --- a/osdep/timer.c +++ b/osdep/timer.c @@ -42,12 +42,6 @@ double mp_time_sec(void) return mp_time_us() / (double)(1000 * 1000); } -int usec_sleep(int usec_delay) -{ - mp_sleep_us(usec_delay); - return 0; -} - #if 0 #include diff --git a/osdep/timer.h b/osdep/timer.h index bdddf3d61a..8d5b553f2e 100644 --- a/osdep/timer.h +++ b/osdep/timer.h @@ -38,7 +38,4 @@ uint64_t mp_raw_time_us(void); // Sleep in microseconds. void mp_sleep_us(int64_t us); -// Legacy timer functions. These can wrap. -int usec_sleep(int usec_delay); - #endif /* MPLAYER_TIMER_H */ diff --git a/stream/cache2.c b/stream/cache2.c index 671bd85c53..302bf6ba17 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -441,9 +441,9 @@ static void cache_mainloop(cache_vars_t *s) { #endif if (sleep_count < INITIAL_FILL_USLEEP_COUNT) { sleep_count++; - usec_sleep(INITIAL_FILL_USLEEP_TIME); + mp_sleep_us(INITIAL_FILL_USLEEP_TIME); } else - usec_sleep(FILL_USLEEP_TIME); // idle + mp_sleep_us(FILL_USLEEP_TIME); // idle #if FORKED_CACHE sa.sa_handler = SIG_IGN; sigaction(SIGUSR1, &sa, NULL); diff --git a/stream/stream.c b/stream/stream.c index caf78851c3..27527a422c 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -295,7 +295,7 @@ static int stream_reconnect(stream_t *s) "Connection lost! Attempting to reconnect...\n"); if (retry) - usec_sleep(RECONNECT_SLEEP_MS * 1000); + mp_sleep_us(RECONNECT_SLEEP_MS * 1000); s->eof = 1; stream_reset(s); @@ -630,7 +630,7 @@ void stream_set_interrupt_callback(int (*cb)(struct input_ctx *, int), int stream_check_interrupt(int time) { if (!stream_check_interrupt_cb) { - usec_sleep(time * 1000); + mp_sleep_us(time * 1000); return 0; } return stream_check_interrupt_cb(stream_check_interrupt_ctx, time); diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index 845679c8f9..e7b595ff67 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -475,7 +475,7 @@ static void wait_for_completion(struct vo *vo, int max_outstanding) " for XShm completion events...\n"); ctx->Shm_Warned_Slow = 1; } - usec_sleep(1000); + mp_sleep_us(1000); vo_x11_check_events(vo); } } diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index d119125db4..0f02310473 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -685,7 +685,7 @@ static void wait_for_completion(struct vo *vo, int max_outstanding) " for XShm completion events...\n"); ctx->Shm_Warned_Slow = 1; } - usec_sleep(1000); + mp_sleep_us(1000); vo_x11_check_events(vo); } } -- cgit v1.2.3