aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/jack_output_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-14 22:47:25 +0200
committerMax Kellermann <max@duempel.org>2012-08-14 22:47:25 +0200
commitc9aaabb5d4467047514d291ff652d516a7025486 (patch)
tree3d466fa89607471a5da30bde82b247a45672d485 /src/output/jack_output_plugin.c
parent335d5d5d72acb310e7853c64c1d2ca1404f9f62f (diff)
downloadmpd-c9aaabb5d4467047514d291ff652d516a7025486.tar.gz
mpd-c9aaabb5d4467047514d291ff652d516a7025486.tar.xz
mpd-c9aaabb5d4467047514d291ff652d516a7025486.zip
output/jack: implement method delay()
Eliminate the g_usleep() call.
Diffstat (limited to 'src/output/jack_output_plugin.c')
-rw-r--r--src/output/jack_output_plugin.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/output/jack_output_plugin.c b/src/output/jack_output_plugin.c
index a24cb8557..d5c8ca412 100644
--- a/src/output/jack_output_plugin.c
+++ b/src/output/jack_output_plugin.c
@@ -608,6 +608,16 @@ mpd_jack_close(G_GNUC_UNUSED struct audio_output *ao)
mpd_jack_stop(jd);
}
+static unsigned
+mpd_jack_delay(struct audio_output *ao)
+{
+ struct jack_data *jd = (struct jack_data *)ao;
+
+ return jd->base.pause && jd->pause && !jd->shutdown
+ ? 1000
+ : 0;
+}
+
static inline jack_default_audio_sample_t
sample_16_to_jack(int16_t sample)
{
@@ -727,10 +737,6 @@ mpd_jack_pause(struct audio_output *ao)
jd->pause = true;
- /* due to a MPD API limitation, we have to sleep a little bit
- here, to avoid hogging the CPU */
- g_usleep(50000);
-
return true;
}
@@ -742,6 +748,7 @@ const struct audio_output_plugin jack_output_plugin = {
.enable = mpd_jack_enable,
.disable = mpd_jack_disable,
.open = mpd_jack_open,
+ .delay = mpd_jack_delay,
.play = mpd_jack_play,
.pause = mpd_jack_pause,
.close = mpd_jack_close,