|
MPD
0.20.18
|
A bridge between the DecoderClient interface and the MPD core (DecoderControl, MusicPipe etc.). More...
#include <Bridge.hxx>
Public Member Functions | |
| DecoderBridge (DecoderControl &_dc, bool _initial_seek_pending, Tag *_tag) | |
| ~DecoderBridge () | |
| gcc_pure bool | CheckCancelRead () const noexcept |
| Should be read operation be cancelled? That is the case when the player thread has sent a command such as "STOP". More... | |
| MusicChunk * | GetChunk () noexcept |
| Returns the current chunk the decoder writes to, or allocates a new chunk if there is none. More... | |
| void | FlushChunk () |
| Flushes the current chunk. More... | |
| void | Ready (AudioFormat audio_format, bool seekable, SignedSongTime duration) override |
| Notify the client that it has finished initialization and that it has read the song's meta data. More... | |
| DecoderCommand | GetCommand () noexcept override |
| Determines the pending decoder command. More... | |
| void | CommandFinished () override |
| Called by the decoder when it has performed the requested command (dc->command). More... | |
| SongTime | GetSeekTime () noexcept override |
| Call this when you have received the DecoderCommand::SEEK command. More... | |
| uint64_t | GetSeekFrame () noexcept override |
| Call this when you have received the DecoderCommand::SEEK command. More... | |
| void | SeekError () override |
| Call this instead of CommandFinished() when seeking has failed. More... | |
| InputStreamPtr | OpenUri (const char *uri) override |
| Open a new InputStream and wait until it's ready. More... | |
| size_t | Read (InputStream &is, void *buffer, size_t length) override |
| Blocking read from the input stream. More... | |
| void | SubmitTimestamp (double t) override |
| Sets the time stamp for the next data chunk [seconds]. More... | |
| DecoderCommand | SubmitData (InputStream *is, const void *data, size_t length, uint16_t kbit_rate) override |
| This function is called by the decoder plugin when it has successfully decoded block of input data. More... | |
| DecoderCommand | SubmitTag (InputStream *is, Tag &&tag) override |
| This function is called by the decoder plugin when it has successfully decoded a tag. More... | |
| void | SubmitReplayGain (const ReplayGainInfo *replay_gain_info) override |
| Set replay gain values for the following chunks. More... | |
| void | SubmitMixRamp (MixRampInfo &&mix_ramp) override |
| Store MixRamp tags. More... | |
Public Member Functions inherited from DecoderClient | |
| DecoderCommand | SubmitData (InputStream &is, const void *data, size_t length, uint16_t kbit_rate) |
| DecoderCommand | SubmitTag (InputStream &is, Tag &&tag) |
Data Fields | |
| DecoderControl & | dc |
| PcmConvert * | convert = nullptr |
| For converting input data to the configured audio format. More... | |
| double | timestamp = 0 |
| The time stamp of the next data chunk, in seconds. More... | |
| uint64_t | absolute_frame = 0 |
| The time stamp of the next data chunk, in PCM frames. More... | |
| bool | initial_seek_pending |
| Is the initial seek (to the start position of the sub-song) pending, or has it been performed already? More... | |
| bool | initial_seek_running = false |
| Is the initial seek currently running? During this time, the decoder command is SEEK. More... | |
| bool | seeking = false |
| This flag is set by GetSeekTime(), and checked by CommandFinished(). More... | |
| Tag * | song_tag |
| The tag from the song object. More... | |
| Tag * | stream_tag = nullptr |
| the last tag received from the stream More... | |
| Tag * | decoder_tag = nullptr |
| the last tag received from the decoder plugin More... | |
| MusicChunk * | current_chunk = nullptr |
| the chunk currently being written to More... | |
| ReplayGainInfo | replay_gain_info |
| unsigned | replay_gain_serial = 0 |
| A positive serial number for checking if replay gain info has changed since the last check. More... | |
| std::exception_ptr | error |
| An error has occurred (in DecoderAPI.cxx), and the plugin will be asked to stop. More... | |
A bridge between the DecoderClient interface and the MPD core (DecoderControl, MusicPipe etc.).
Definition at line 37 of file Bridge.hxx.
|
inline |
Definition at line 107 of file Bridge.hxx.
| DecoderBridge::~DecoderBridge | ( | ) |
|
noexcept |
Should be read operation be cancelled? That is the case when the player thread has sent a command such as "STOP".
Caller must lock the DecoderControl object.
|
overridevirtual |
Called by the decoder when it has performed the requested command (dc->command).
This function resets dc->command and wakes up the player thread.
Implements DecoderClient.
| void DecoderBridge::FlushChunk | ( | ) |
Flushes the current chunk.
Caller must not lock the DecoderControl object.
|
noexcept |
Returns the current chunk the decoder writes to, or allocates a new chunk if there is none.
|
overridevirtualnoexcept |
Determines the pending decoder command.
Implements DecoderClient.
|
overridevirtualnoexcept |
Call this when you have received the DecoderCommand::SEEK command.
Implements DecoderClient.
|
overridevirtualnoexcept |
Call this when you have received the DecoderCommand::SEEK command.
Implements DecoderClient.
|
overridevirtual |
Open a new InputStream and wait until it's ready.
Throws StopDecoder if DecoderCommand::STOP was received.
Throws std::runtime_error on error.
Implements DecoderClient.
|
overridevirtual |
Blocking read from the input stream.
| is | the input stream to read from |
| buffer | the destination buffer |
| length | the maximum number of bytes to read |
Implements DecoderClient.
|
overridevirtual |
Notify the client that it has finished initialization and that it has read the song's meta data.
| audio_format | the audio format which is going to be sent to SubmitData() |
| seekable | true if the song is seekable |
| duration | the total duration of this song; negative if unknown |
Implements DecoderClient.
|
overridevirtual |
Call this instead of CommandFinished() when seeking has failed.
Implements DecoderClient.
|
overridevirtual |
This function is called by the decoder plugin when it has successfully decoded block of input data.
| is | an input stream which is buffering while we are waiting for the player |
| data | the source buffer |
| length | the number of bytes in the buffer |
Implements DecoderClient.
|
overridevirtual |
Store MixRamp tags.
Implements DecoderClient.
|
overridevirtual |
Set replay gain values for the following chunks.
| replay_gain_info | the replay_gain_info object; may be nullptr to invalidate the previous replay gain values |
Implements DecoderClient.
|
overridevirtual |
This function is called by the decoder plugin when it has successfully decoded a tag.
| is | an input stream which is buffering while we are waiting for the player |
| tag | the tag to send |
Implements DecoderClient.
|
overridevirtual |
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.
Implements DecoderClient.
| uint64_t DecoderBridge::absolute_frame = 0 |
The time stamp of the next data chunk, in PCM frames.
Definition at line 55 of file Bridge.hxx.
| PcmConvert* DecoderBridge::convert = nullptr |
For converting input data to the configured audio format.
nullptr means no conversion necessary.
Definition at line 45 of file Bridge.hxx.
| MusicChunk* DecoderBridge::current_chunk = nullptr |
the chunk currently being written to
Definition at line 91 of file Bridge.hxx.
| DecoderControl& DecoderBridge::dc |
Definition at line 39 of file Bridge.hxx.
| Tag* DecoderBridge::decoder_tag = nullptr |
the last tag received from the decoder plugin
Definition at line 88 of file Bridge.hxx.
| std::exception_ptr DecoderBridge::error |
An error has occurred (in DecoderAPI.cxx), and the plugin will be asked to stop.
Definition at line 105 of file Bridge.hxx.
| bool DecoderBridge::initial_seek_pending |
Is the initial seek (to the start position of the sub-song) pending, or has it been performed already?
Definition at line 61 of file Bridge.hxx.
| bool DecoderBridge::initial_seek_running = false |
Is the initial seek currently running? During this time, the decoder command is SEEK.
This flag is set by decoder_get_virtual_command(), when the virtual SEEK command is generated for the first time.
Definition at line 69 of file Bridge.hxx.
| ReplayGainInfo DecoderBridge::replay_gain_info |
Definition at line 93 of file Bridge.hxx.
| unsigned DecoderBridge::replay_gain_serial = 0 |
A positive serial number for checking if replay gain info has changed since the last check.
Definition at line 99 of file Bridge.hxx.
| bool DecoderBridge::seeking = false |
This flag is set by GetSeekTime(), and checked by CommandFinished().
It is used to clean up after seeking.
Definition at line 75 of file Bridge.hxx.
| Tag* DecoderBridge::song_tag |
The tag from the song object.
This is only used for local files, because we expect the stream server to send us a new tag each time we play it.
Definition at line 82 of file Bridge.hxx.
| Tag* DecoderBridge::stream_tag = nullptr |
the last tag received from the stream
Definition at line 85 of file Bridge.hxx.
| double DecoderBridge::timestamp = 0 |
The time stamp of the next data chunk, in seconds.
Definition at line 50 of file Bridge.hxx.
1.8.14