MPD: decoder/Client.hxx Source File

MPD 0.20.15

Client.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MPD_DECODER_CLIENT_HXX
21 #define MPD_DECODER_CLIENT_HXX
22
23 #include "check.h"
24 #include "DecoderCommand.hxx"
25 #include "Chrono.hxx"
26 #include "input/Ptr.hxx"
27 #include "Compiler.h"
28
29 #include <stdint.h>
30
31 struct AudioFormat;
32 struct Tag;
33 struct ReplayGainInfo;
34 class MixRampInfo;
35
39 class DecoderClient {
40 public:
51 virtual void Ready(AudioFormat audio_format,
52 bool seekable, SignedSongTime duration) = 0;
53
60 gcc_pure
61 virtual DecoderCommand GetCommand() noexcept = 0;
62
68 virtual void CommandFinished() = 0;
69
75 gcc_pure
76 virtual SongTime GetSeekTime() noexcept = 0;
77
83 gcc_pure
84 virtual uint64_t GetSeekFrame() noexcept = 0;
85
90 virtual void SeekError() = 0;
91
99 virtual InputStreamPtr OpenUri(const char *uri) = 0;
100
110 virtual size_t Read(InputStream &is, void *buffer, size_t length) = 0;
111
118 virtual void SubmitTimestamp(double t) = 0;
119
131 virtual DecoderCommand SubmitData(InputStream *is,
132 const void *data, size_t length,
133 uint16_t kbit_rate) = 0;
134
135 DecoderCommand SubmitData(InputStream &is,
136 const void *data, size_t length,
137 uint16_t kbit_rate) {
138 return SubmitData(&is, data, length, kbit_rate);
139 }
140
151 virtual DecoderCommand SubmitTag(InputStream *is, Tag &&tag) = 0 ;
152
153 DecoderCommand SubmitTag(InputStream &is, Tag &&tag) {
154 return SubmitTag(&is, std::move(tag));
155 }
156
163 virtual void SubmitReplayGain(const ReplayGainInfo *replay_gain_info) = 0;
164
168 virtual void SubmitMixRamp(MixRampInfo &&mix_ramp) = 0;
169 };
170
171 #endif
DecoderClient::SubmitTag
DecoderCommand SubmitTag(InputStream &is, Tag &&tag)
Definition: Client.hxx:153
check.h
DecoderClient::GetSeekFrame
virtual gcc_pure uint64_t GetSeekFrame() noexcept=0
Call this when you have received the DecoderCommand::SEEK command.
DecoderClient
An interface between the decoder plugin and the MPD core.
Definition: Client.hxx:39
DecoderClient::SubmitReplayGain
virtual void SubmitReplayGain(const ReplayGainInfo *replay_gain_info)=0
Set replay gain values for the following chunks.
AudioFormat
This structure describes the format of a raw PCM stream.
Definition: AudioFormat.hxx:37
Chrono.hxx
Tag
The meta information about a song file.
Definition: Tag.hxx:34
SongTime
A time stamp within a song.
Definition: Chrono.hxx:31
DecoderClient::SeekError
virtual void SeekError()=0
Call this instead of CommandFinished() when seeking has failed.
InputStream
Definition: InputStream.hxx:36
DecoderClient::GetSeekTime
virtual gcc_pure SongTime GetSeekTime() noexcept=0
Call this when you have received the DecoderCommand::SEEK command.
DecoderClient::SubmitData
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...
MixRampInfo
Definition: MixRampInfo.hxx:28
DecoderClient::SubmitTimestamp
virtual void SubmitTimestamp(double t)=0
Sets the time stamp for the next data chunk [seconds].
DecoderClient::Ready
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&#39;s meta data...
DecoderCommand.hxx
DecoderClient::OpenUri
virtual InputStreamPtr OpenUri(const char *uri)=0
Open a new InputStream and wait until it&#39;s ready.
Ptr.hxx
Compiler.h
ReplayGainInfo
Definition: ReplayGainInfo.hxx:46
DecoderClient::Read
virtual size_t Read(InputStream &is, void *buffer, size_t length)=0
Blocking read from the input stream.
InputStreamPtr
std::unique_ptr< InputStream > InputStreamPtr
Definition: Ptr.hxx:25
DecoderClient::SubmitMixRamp
virtual void SubmitMixRamp(MixRampInfo &&mix_ramp)=0
Store MixRamp tags.
DecoderClient::SubmitTag
virtual DecoderCommand SubmitTag(InputStream *is, Tag &&tag)=0
This function is called by the decoder plugin when it has successfully decoded a tag.
DecoderClient::GetCommand
virtual gcc_pure DecoderCommand GetCommand() noexcept=0
Determines the pending decoder command.
DecoderCommand
DecoderCommand
Definition: DecoderCommand.hxx:25
SignedSongTime
A variant of SongTime that is based on a signed integer.
Definition: Chrono.hxx:115
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
DecoderClient::CommandFinished
virtual void CommandFinished()=0
Called by the decoder when it has performed the requested command (dc->command).
DecoderClient::SubmitData
DecoderCommand SubmitData(InputStream &is, const void *data, size_t length, uint16_t kbit_rate)
Definition: Client.hxx:135
uri
const Storage const char * uri
Definition: DatabasePlaylist.hxx:31