MPD  0.20.6
Public Member Functions | Static Public Member Functions | Data Fields
HttpdOutput Class Referencefinal

#include <HttpdInternal.hxx>

Inheritance diagram for HttpdOutput:
[legend]
Collaboration diagram for HttpdOutput:
[legend]

Public Member Functions

 HttpdOutput (EventLoop &_loop, const ConfigBlock &block)
 
 ~HttpdOutput ()
 
 operator AudioOutput * ()
 
void Bind ()
 
void Unbind ()
 
void OpenEncoder (AudioFormat &audio_format)
 Caller must lock the mutex. More...
 
void Open (AudioFormat &audio_format)
 Caller must lock the mutex. More...
 
void Close ()
 Caller must lock the mutex. More...
 
gcc_pure bool HasClients () const
 Check whether there is at least one client. More...
 
gcc_pure bool LockHasClients () const
 Check whether there is at least one client. More...
 
void AddClient (int fd)
 
void RemoveClient (HttpdClient &client)
 Removes a client from the httpd_output.clients linked list. More...
 
void SendHeader (HttpdClient &client) const
 Sends the encoder header to the client. More...
 
gcc_pure std::chrono::steady_clock::duration Delay () const
 
PageReadPage ()
 Reads data from the encoder (as much as available) and returns it as a new #page object. More...
 
void BroadcastPage (Page *page)
 Broadcasts a page struct to all clients. More...
 
void BroadcastFromEncoder ()
 Broadcasts data from the encoder to all clients. More...
 
void EncodeAndPlay (const void *chunk, size_t size)
 Throws #std::runtime_error on error. More...
 
void SendTag (const Tag &tag)
 
size_t Play (const void *chunk, size_t size)
 
void CancelAllClients ()
 

Static Public Member Functions

static HttpdOutputCast (AudioOutput *ao)
 

Data Fields

const char * content_type
 The MIME type produced by the #encoder. More...
 
Mutex mutex
 This mutex protects the listener socket and the client list. More...
 
Cond cond
 This condition gets signalled when an item is removed from #pages. More...
 
char const * name
 The configured name. More...
 
char const * genre
 The configured genre. More...
 
char const * website
 The configured website address. More...
 

Detailed Description

Definition at line 51 of file HttpdInternal.hxx.

Constructor & Destructor Documentation

HttpdOutput::HttpdOutput ( EventLoop _loop,
const ConfigBlock block 
)
HttpdOutput::~HttpdOutput ( )

Member Function Documentation

void HttpdOutput::AddClient ( int  fd)
void HttpdOutput::Bind ( )
void HttpdOutput::BroadcastFromEncoder ( )

Broadcasts data from the encoder to all clients.

void HttpdOutput::BroadcastPage ( Page page)

Broadcasts a page struct to all clients.

Mutext must not be locked.

void HttpdOutput::CancelAllClients ( )
static HttpdOutput* HttpdOutput::Cast ( AudioOutput ao)
inlinestatic

Definition at line 162 of file HttpdInternal.hxx.

void HttpdOutput::Close ( )

Caller must lock the mutex.

gcc_pure std::chrono::steady_clock::duration HttpdOutput::Delay ( ) const
void HttpdOutput::EncodeAndPlay ( const void *  chunk,
size_t  size 
)

Throws #std::runtime_error on error.

gcc_pure bool HttpdOutput::HasClients ( ) const
inline

Check whether there is at least one client.

Caller must lock the mutex.

Definition at line 194 of file HttpdInternal.hxx.

gcc_pure bool HttpdOutput::LockHasClients ( ) const
inline

Check whether there is at least one client.

Definition at line 202 of file HttpdInternal.hxx.

void HttpdOutput::Open ( AudioFormat audio_format)

Caller must lock the mutex.

void HttpdOutput::OpenEncoder ( AudioFormat audio_format)

Caller must lock the mutex.

Throws #std::runtime_error on error.

HttpdOutput::operator AudioOutput * ( )
inline

Definition at line 155 of file HttpdInternal.hxx.

size_t HttpdOutput::Play ( const void *  chunk,
size_t  size 
)
Page* HttpdOutput::ReadPage ( )

Reads data from the encoder (as much as available) and returns it as a new #page object.

void HttpdOutput::RemoveClient ( HttpdClient client)

Removes a client from the httpd_output.clients linked list.

void HttpdOutput::SendHeader ( HttpdClient client) const

Sends the encoder header to the client.

This is called right after the response headers have been sent.

void HttpdOutput::SendTag ( const Tag tag)
void HttpdOutput::Unbind ( )

Field Documentation

Cond HttpdOutput::cond

This condition gets signalled when an item is removed from #pages.

Definition at line 90 of file HttpdInternal.hxx.

const char* HttpdOutput::content_type

The MIME type produced by the #encoder.

Definition at line 78 of file HttpdInternal.hxx.

char const* HttpdOutput::genre

The configured genre.

Definition at line 125 of file HttpdInternal.hxx.

Mutex HttpdOutput::mutex
mutable

This mutex protects the listener socket and the client list.

Definition at line 84 of file HttpdInternal.hxx.

char const* HttpdOutput::name

The configured name.

Definition at line 121 of file HttpdInternal.hxx.

char const* HttpdOutput::website

The configured website address.

Definition at line 129 of file HttpdInternal.hxx.


The documentation for this class was generated from the following file: