Commit 91743426 authored by Max Kellermann's avatar Max Kellermann

output/httpd: implement "pause"

Send silence to all connected clients while paused, to avoid connection interruption.
parent a77506ae
......@@ -59,6 +59,7 @@ ver 0.16 (20??/??/??)
- jack: support more than two audio channels
- httpd: bind port when output is enabled
- httpd: added name/genre/website configuration
- httpd: implement "pause"
- oss: 24 bit support via OSS4
- win32: new output plugin for Windows Wave
- wildcards allowed in audio_format configuration
......
......@@ -499,6 +499,24 @@ httpd_output_play(void *data, const void *chunk, size_t size, GError **error)
return size;
}
static bool
httpd_output_pause(void *data)
{
struct httpd_output *httpd = data;
g_mutex_lock(httpd->mutex);
bool has_clients = httpd->clients != NULL;
g_mutex_unlock(httpd->mutex);
if (has_clients) {
static const char silence[1020];
return httpd_output_play(data, silence, sizeof(silence), NULL);
} else {
g_usleep(100000);
return true;
}
}
static void
httpd_send_metadata(gpointer data, gpointer user_data)
{
......@@ -587,5 +605,6 @@ const struct audio_output_plugin httpd_output_plugin = {
.close = httpd_output_close,
.send_tag = httpd_output_tag,
.play = httpd_output_play,
.pause = httpd_output_pause,
.cancel = httpd_output_cancel,
};
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