diff options
author | Max Kellermann <max@duempel.org> | 2009-01-22 16:06:47 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-22 16:06:47 +0100 |
commit | d47be76ce09ab3de9dfd5989ea65ca305c723f73 (patch) | |
tree | 70814b384b7adcc3b8d4934f197c570e3cd11254 /src | |
parent | 0122510f2c85ab00bf5b591d25986188cdc33d7f (diff) | |
download | mpd-d47be76ce09ab3de9dfd5989ea65ca305c723f73.tar.gz mpd-d47be76ce09ab3de9dfd5989ea65ca305c723f73.tar.xz mpd-d47be76ce09ab3de9dfd5989ea65ca305c723f73.zip |
null: added option to disable timer synchronization
The null plugin synchronizes the playback so it will happen in real
time. This patch adds a configuration option which disables this: the
playback will then be as fast as possible. This can be useful to
profile MPD.
Diffstat (limited to 'src')
-rw-r--r-- | src/output/null_plugin.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/output/null_plugin.c b/src/output/null_plugin.c index a1eb0196f..7530a20cc 100644 --- a/src/output/null_plugin.c +++ b/src/output/null_plugin.c @@ -24,6 +24,8 @@ #include <assert.h> struct null_data { + bool sync; + Timer *timer; }; @@ -34,6 +36,7 @@ null_init(G_GNUC_UNUSED struct audio_output *audio_output, { struct null_data *nd = g_new(struct null_data, 1); + nd->sync = config_get_block_bool(param, "sync", true); nd->timer = NULL; return nd; @@ -54,7 +57,8 @@ null_open(void *data, struct audio_format *audio_format) { struct null_data *nd = data; - nd->timer = timer_new(audio_format); + if (nd->sync) + nd->timer = timer_new(audio_format); return true; } @@ -76,6 +80,9 @@ null_play(void *data, G_GNUC_UNUSED const char *chunk, size_t size) struct null_data *nd = data; Timer *timer = nd->timer; + if (!nd->sync) + return true; + if (!timer->started) timer_start(timer); else @@ -91,6 +98,9 @@ null_cancel(void *data) { struct null_data *nd = data; + if (!nd->sync) + return; + timer_reset(nd->timer); } |