MPD  0.20.15
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 noexcept
 Check whether there is at least one client. More...
 
gcc_pure bool LockHasClients () const noexcept
 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 noexcept
 
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 ()
 
EventLoopGetEventLoop ()
 

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::HttpdOutput ( EventLoop _loop,
const ConfigBlock block 
)

◆ ~HttpdOutput()

HttpdOutput::~HttpdOutput ( )

Member Function Documentation

◆ AddClient()

void HttpdOutput::AddClient ( int  fd)

◆ Bind()

void HttpdOutput::Bind ( )

◆ BroadcastFromEncoder()

void HttpdOutput::BroadcastFromEncoder ( )

Broadcasts data from the encoder to all clients.

◆ BroadcastPage()

void HttpdOutput::BroadcastPage ( Page page)

Broadcasts a page struct to all clients.

Mutext must not be locked.

◆ CancelAllClients()

void HttpdOutput::CancelAllClients ( )

◆ Cast()

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

Definition at line 162 of file HttpdInternal.hxx.

◆ Close()

void HttpdOutput::Close ( )

Caller must lock the mutex.

◆ Delay()

gcc_pure std::chrono::steady_clock::duration HttpdOutput::Delay ( ) const
noexcept

◆ EncodeAndPlay()

void HttpdOutput::EncodeAndPlay ( const void *  chunk,
size_t  size 
)

Throws #std::runtime_error on error.

◆ GetEventLoop()

EventLoop& DeferredMonitor::GetEventLoop
inline

Definition at line 46 of file DeferredMonitor.hxx.

◆ HasClients()

gcc_pure bool HttpdOutput::HasClients ( ) const
inlinenoexcept

Check whether there is at least one client.

Caller must lock the mutex.

Definition at line 194 of file HttpdInternal.hxx.

◆ LockHasClients()

gcc_pure bool HttpdOutput::LockHasClients ( ) const
inlinenoexcept

Check whether there is at least one client.

Definition at line 202 of file HttpdInternal.hxx.

◆ Open()

void HttpdOutput::Open ( AudioFormat audio_format)

Caller must lock the mutex.

◆ OpenEncoder()

void HttpdOutput::OpenEncoder ( AudioFormat audio_format)

Caller must lock the mutex.

Throws #std::runtime_error on error.

◆ operator AudioOutput *()

HttpdOutput::operator AudioOutput * ( )
inline

Definition at line 155 of file HttpdInternal.hxx.

◆ Play()

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

◆ ReadPage()

Page* HttpdOutput::ReadPage ( )

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

◆ RemoveClient()

void HttpdOutput::RemoveClient ( HttpdClient client)

Removes a client from the httpd_output.clients linked list.

◆ SendHeader()

void HttpdOutput::SendHeader ( HttpdClient client) const

Sends the encoder header to the client.

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

◆ SendTag()

void HttpdOutput::SendTag ( const Tag tag)

◆ Unbind()

void HttpdOutput::Unbind ( )

Field Documentation

◆ cond

Cond HttpdOutput::cond

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

Definition at line 90 of file HttpdInternal.hxx.

◆ content_type

const char* HttpdOutput::content_type

The MIME type produced by the #encoder.

Definition at line 78 of file HttpdInternal.hxx.

◆ genre

char const* HttpdOutput::genre

The configured genre.

Definition at line 125 of file HttpdInternal.hxx.

◆ mutex

Mutex HttpdOutput::mutex
mutable

This mutex protects the listener socket and the client list.

Definition at line 84 of file HttpdInternal.hxx.

◆ name

char const* HttpdOutput::name

The configured name.

Definition at line 121 of file HttpdInternal.hxx.

◆ website

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: