aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/HttpdInternal.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/output/HttpdInternal.hxx')
-rw-r--r--src/output/HttpdInternal.hxx86
1 files changed, 72 insertions, 14 deletions
diff --git a/src/output/HttpdInternal.hxx b/src/output/HttpdInternal.hxx
index e948afa1b..1c2fdfb16 100644
--- a/src/output/HttpdInternal.hxx
+++ b/src/output/HttpdInternal.hxx
@@ -122,21 +122,79 @@ struct HttpdOutput {
* at the same time.
*/
guint clients_max, clients_cnt;
-};
-/**
- * Removes a client from the httpd_output.clients linked list.
- */
-void
-httpd_output_remove_client(struct HttpdOutput *httpd,
- HttpdClient *client);
+ bool Bind(GError **error_r);
+ void Unbind();
-/**
- * Sends the encoder header to the client. This is called right after
- * the response headers have been sent.
- */
-void
-httpd_output_send_header(struct HttpdOutput *httpd,
- HttpdClient *client);
+ /**
+ * Caller must lock the mutex.
+ */
+ bool OpenEncoder(struct audio_format *audio_format,
+ GError **error_r);
+
+ /**
+ * Caller must lock the mutex.
+ */
+ bool Open(struct audio_format *audio_format, GError **error_r);
+
+ /**
+ * Caller must lock the mutex.
+ */
+ void Close();
+
+ /**
+ * Check whether there is at least one client.
+ *
+ * Caller must lock the mutex.
+ */
+ gcc_pure
+ bool HasClients() const {
+ return !clients.empty();
+ }
+
+ /**
+ * Check whether there is at least one client.
+ */
+ gcc_pure
+ bool LockHasClients() const {
+ const ScopeLock protect(mutex);
+ return HasClients();
+ }
+
+ void AddClient(int fd);
+
+ /**
+ * Removes a client from the httpd_output.clients linked list.
+ */
+ void RemoveClient(HttpdClient &client);
+
+ /**
+ * Sends the encoder header to the client. This is called
+ * right after the response headers have been sent.
+ */
+ void SendHeader(HttpdClient &client) const;
+
+ /**
+ * Reads data from the encoder (as much as available) and
+ * returns it as a new #page object.
+ */
+ page *ReadPage();
+
+ /**
+ * Broadcasts a page struct to all clients.
+ *
+ * Mutext must not be locked.
+ */
+ void BroadcastPage(struct page *page);
+
+ /**
+ * Broadcasts data from the encoder to all clients.
+ */
+ void BroadcastFromEncoder();
+
+ bool EncodeAndPlay(const void *chunk, size_t size, GError **error_r);
+
+ void SendTag(const struct tag *tag);
+};
#endif