MPD  0.20.18
Public Member Functions
DecoderClient Class Referenceabstract

An interface between the decoder plugin and the MPD core. More...

#include <Client.hxx>

Inheritance diagram for DecoderClient:
[legend]

Public Member Functions

virtual void Ready (AudioFormat audio_format, bool seekable, SignedSongTime duration)=0
 Notify the client that it has finished initialization and that it has read the song's meta data. More...
 
virtual gcc_pure DecoderCommand GetCommand () noexcept=0
 Determines the pending decoder command. More...
 
virtual void CommandFinished ()=0
 Called by the decoder when it has performed the requested command (dc->command). More...
 
virtual gcc_pure SongTime GetSeekTime () noexcept=0
 Call this when you have received the DecoderCommand::SEEK command. More...
 
virtual gcc_pure uint64_t GetSeekFrame () noexcept=0
 Call this when you have received the DecoderCommand::SEEK command. More...
 
virtual void SeekError ()=0
 Call this instead of CommandFinished() when seeking has failed. More...
 
virtual InputStreamPtr OpenUri (const char *uri)=0
 Open a new InputStream and wait until it's ready. More...
 
virtual size_t Read (InputStream &is, void *buffer, size_t length)=0
 Blocking read from the input stream. More...
 
virtual void SubmitTimestamp (double t)=0
 Sets the time stamp for the next data chunk [seconds]. More...
 
virtual DecoderCommand SubmitData (InputStream *is, const void *data, size_t length, uint16_t kbit_rate)=0
 This function is called by the decoder plugin when it has successfully decoded block of input data. More...
 
DecoderCommand SubmitData (InputStream &is, const void *data, size_t length, uint16_t kbit_rate)
 
virtual DecoderCommand SubmitTag (InputStream *is, Tag &&tag)=0
 This function is called by the decoder plugin when it has successfully decoded a tag. More...
 
DecoderCommand SubmitTag (InputStream &is, Tag &&tag)
 
virtual void SubmitReplayGain (const ReplayGainInfo *replay_gain_info)=0
 Set replay gain values for the following chunks. More...
 
virtual void SubmitMixRamp (MixRampInfo &&mix_ramp)=0
 Store MixRamp tags. More...
 

Detailed Description

An interface between the decoder plugin and the MPD core.

Definition at line 39 of file Client.hxx.

Member Function Documentation

◆ CommandFinished()

virtual void DecoderClient::CommandFinished ( )
pure virtual

Called by the decoder when it has performed the requested command (dc->command).

This function resets dc->command and wakes up the player thread.

Implemented in DecoderBridge.

◆ GetCommand()

virtual gcc_pure DecoderCommand DecoderClient::GetCommand ( )
pure virtualnoexcept

Determines the pending decoder command.

Returns
the current command, or DecoderCommand::NONE if there is no command pending

Implemented in DecoderBridge.

◆ GetSeekFrame()

virtual gcc_pure uint64_t DecoderClient::GetSeekFrame ( )
pure virtualnoexcept

Call this when you have received the DecoderCommand::SEEK command.

Returns
the destination position for the seek in frames

Implemented in DecoderBridge.

◆ GetSeekTime()

virtual gcc_pure SongTime DecoderClient::GetSeekTime ( )
pure virtualnoexcept

Call this when you have received the DecoderCommand::SEEK command.

Returns
the destination position for the seek in milliseconds

Implemented in DecoderBridge.

◆ OpenUri()

virtual InputStreamPtr DecoderClient::OpenUri ( const char *  uri)
pure virtual

Open a new InputStream and wait until it's ready.

Throws StopDecoder if DecoderCommand::STOP was received.

Throws std::runtime_error on error.

Implemented in DecoderBridge.

◆ Read()

virtual size_t DecoderClient::Read ( InputStream is,
void *  buffer,
size_t  length 
)
pure virtual

Blocking read from the input stream.

Parameters
isthe input stream to read from
bufferthe destination buffer
lengththe maximum number of bytes to read
Returns
the number of bytes read, or 0 if one of the following occurs: end of file; error; command (like SEEK or STOP).

Implemented in DecoderBridge.

◆ Ready()

virtual void DecoderClient::Ready ( AudioFormat  audio_format,
bool  seekable,
SignedSongTime  duration 
)
pure virtual

Notify the client that it has finished initialization and that it has read the song's meta data.

Parameters
audio_formatthe audio format which is going to be sent to SubmitData()
seekabletrue if the song is seekable
durationthe total duration of this song; negative if unknown

Implemented in DecoderBridge.

◆ SeekError()

virtual void DecoderClient::SeekError ( )
pure virtual

Call this instead of CommandFinished() when seeking has failed.

Implemented in DecoderBridge.

◆ SubmitData() [1/2]

virtual DecoderCommand DecoderClient::SubmitData ( InputStream is,
const void *  data,
size_t  length,
uint16_t  kbit_rate 
)
pure virtual

This function is called by the decoder plugin when it has successfully decoded block of input data.

Parameters
isan input stream which is buffering while we are waiting for the player
datathe source buffer
lengththe number of bytes in the buffer
Returns
the current command, or DecoderCommand::NONE if there is no command pending

Implemented in DecoderBridge.

◆ SubmitData() [2/2]

DecoderCommand DecoderClient::SubmitData ( InputStream is,
const void *  data,
size_t  length,
uint16_t  kbit_rate 
)
inline

Definition at line 135 of file Client.hxx.

◆ SubmitMixRamp()

virtual void DecoderClient::SubmitMixRamp ( MixRampInfo &&  mix_ramp)
pure virtual

Store MixRamp tags.

Implemented in DecoderBridge.

◆ SubmitReplayGain()

virtual void DecoderClient::SubmitReplayGain ( const ReplayGainInfo replay_gain_info)
pure virtual

Set replay gain values for the following chunks.

Parameters
replay_gain_infothe replay_gain_info object; may be nullptr to invalidate the previous replay gain values

Implemented in DecoderBridge.

◆ SubmitTag() [1/2]

virtual DecoderCommand DecoderClient::SubmitTag ( InputStream is,
Tag &&  tag 
)
pure virtual

This function is called by the decoder plugin when it has successfully decoded a tag.

Parameters
isan input stream which is buffering while we are waiting for the player
tagthe tag to send
Returns
the current command, or DecoderCommand::NONE if there is no command pending

Implemented in DecoderBridge.

◆ SubmitTag() [2/2]

DecoderCommand DecoderClient::SubmitTag ( InputStream is,
Tag &&  tag 
)
inline

Definition at line 153 of file Client.hxx.

◆ SubmitTimestamp()

virtual void DecoderClient::SubmitTimestamp ( double  t)
pure virtual

Sets the time stamp for the next data chunk [seconds].

The MPD core automatically counts it up, and a decoder plugin only needs to use this function if it thinks that adding to the time stamp based on the buffer size won't work.

Implemented in DecoderBridge.


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