25 #ifndef MPD_OUTPUT_HTTPD_INTERNAL_H
26 #define MPD_OUTPUT_HTTPD_INTERNAL_H
37 #include <boost/intrusive/list.hpp>
72 size_t unflushed_input;
115 std::queue<Page *, std::list<Page *>> pages;
137 boost::intrusive::constant_time_size<true>> clients;
149 unsigned clients_max;
159 #if CLANG_OR_GCC_VERSION(4,7)
195 return !clients.empty();
203 const std::lock_guard<Mutex> protect(mutex);
221 std::chrono::steady_clock::duration
Delay() const noexcept;
248 size_t Play(const
void *chunk,
size_t size);
253 virtual
void RunDeferred() override;
255 void OnAccept(
int fd,
SocketAddress address,
int uid) override;
char const * name
The configured name.
void Close()
Caller must lock the mutex.
void SendTag(const Tag &tag)
gcc_pure bool HasClients() const noexcept
Check whether there is at least one client.
EventLoop & GetEventLoop()
const char * content_type
The MIME type produced by the #encoder.
The meta information about a song file.
void Open()
Throws #std::runtime_error on error.
An OO wrapper for struct sockaddr.
char const * website
The configured website address.
An event loop that polls for events on file/socket descriptors.
gcc_pure std::chrono::steady_clock::duration Delay() const noexcept
void BroadcastPage(Page *page)
Broadcasts a page struct to all clients.
A socket that accepts incoming stream connections (e.g.
const class Domain httpd_output_domain
void SendHeader(HttpdClient &client) const
Sends the encoder header to the client.
Defer execution of an event into an EventLoop.
size_t Play(const void *chunk, size_t size)
void EncodeAndPlay(const void *chunk, size_t size)
Throws #std::runtime_error on error.
static C & ContainerCast(A &a, A C::*member)
Cast the given pointer to a struct member to its parent structure.
HttpdOutput(EventLoop &_loop, const ConfigBlock &block)
char const * genre
The configured genre.
void BroadcastFromEncoder()
Broadcasts data from the encoder to all clients.
gcc_pure bool LockHasClients() const noexcept
Check whether there is at least one client.
Mutex mutex
This mutex protects the listener socket and the client list.
Page * ReadPage()
Reads data from the encoder (as much as available) and returns it as a new #page object.
static HttpdOutput * Cast(AudioOutput *ao)
Cond cond
This condition gets signalled when an item is removed from #pages.
void RemoveClient(HttpdClient &client)
Removes a client from the httpd_output.clients linked list.
void OpenEncoder(AudioFormat &audio_format)
Caller must lock the mutex.
A dynamically allocated buffer which keeps track of its reference count.