Commit d47be76c authored by Max Kellermann's avatar Max Kellermann

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.
parent 0122510f
...@@ -11,6 +11,7 @@ ver 0.15 - (200?/??/??) ...@@ -11,6 +11,7 @@ ver 0.15 - (200?/??/??)
- mikmod disabled by default, due to severe security issues in libmikmod - mikmod disabled by default, due to severe security issues in libmikmod
* audio outputs: * audio outputs:
- shout: enlarged buffer size to 32 kB - shout: enlarged buffer size to 32 kB
- null: allow disabling synchronization
* commands: * commands:
- "playlistinfo" supports a range now - "playlistinfo" supports a range now
- added "sticker database", command "sticker", which allows clients - added "sticker database", command "sticker", which allows clients
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <assert.h> #include <assert.h>
struct null_data { struct null_data {
bool sync;
Timer *timer; Timer *timer;
}; };
...@@ -34,6 +36,7 @@ null_init(G_GNUC_UNUSED struct audio_output *audio_output, ...@@ -34,6 +36,7 @@ null_init(G_GNUC_UNUSED struct audio_output *audio_output,
{ {
struct null_data *nd = g_new(struct null_data, 1); struct null_data *nd = g_new(struct null_data, 1);
nd->sync = config_get_block_bool(param, "sync", true);
nd->timer = NULL; nd->timer = NULL;
return nd; return nd;
...@@ -54,6 +57,7 @@ null_open(void *data, struct audio_format *audio_format) ...@@ -54,6 +57,7 @@ null_open(void *data, struct audio_format *audio_format)
{ {
struct null_data *nd = data; struct null_data *nd = data;
if (nd->sync)
nd->timer = timer_new(audio_format); nd->timer = timer_new(audio_format);
return true; return true;
...@@ -76,6 +80,9 @@ null_play(void *data, G_GNUC_UNUSED const char *chunk, size_t size) ...@@ -76,6 +80,9 @@ null_play(void *data, G_GNUC_UNUSED const char *chunk, size_t size)
struct null_data *nd = data; struct null_data *nd = data;
Timer *timer = nd->timer; Timer *timer = nd->timer;
if (!nd->sync)
return true;
if (!timer->started) if (!timer->started)
timer_start(timer); timer_start(timer);
else else
...@@ -91,6 +98,9 @@ null_cancel(void *data) ...@@ -91,6 +98,9 @@ null_cancel(void *data)
{ {
struct null_data *nd = data; struct null_data *nd = data;
if (!nd->sync)
return;
timer_reset(nd->timer); timer_reset(nd->timer);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment