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 
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 
132  const void *data, size_t length,
133  uint16_t kbit_rate) = 0;
134 
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 
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
DecoderCommand SubmitTag(InputStream &is, Tag &&tag)
Definition: Client.hxx:153
virtual gcc_pure uint64_t GetSeekFrame() noexcept=0
Call this when you have received the DecoderCommand::SEEK command.
An interface between the decoder plugin and the MPD core.
Definition: Client.hxx:39
virtual void SubmitReplayGain(const ReplayGainInfo *replay_gain_info)=0
Set replay gain values for the following chunks.
This structure describes the format of a raw PCM stream.
Definition: AudioFormat.hxx:37
The meta information about a song file.
Definition: Tag.hxx:34
A time stamp within a song.
Definition: Chrono.hxx:31
virtual void SeekError()=0
Call this instead of CommandFinished() when seeking has failed.
virtual gcc_pure SongTime GetSeekTime() noexcept=0
Call this when you have received the DecoderCommand::SEEK command.
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...
virtual void SubmitTimestamp(double t)=0
Sets the time stamp for the next data chunk [seconds].
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...
virtual InputStreamPtr OpenUri(const char *uri)=0
Open a new InputStream and wait until it&#39;s ready.
virtual size_t Read(InputStream &is, void *buffer, size_t length)=0
Blocking read from the input stream.
std::unique_ptr< InputStream > InputStreamPtr
Definition: Ptr.hxx:25
virtual void SubmitMixRamp(MixRampInfo &&mix_ramp)=0
Store MixRamp tags.
virtual DecoderCommand SubmitTag(InputStream *is, Tag &&tag)=0
This function is called by the decoder plugin when it has successfully decoded a tag.
virtual gcc_pure DecoderCommand GetCommand() noexcept=0
Determines the pending decoder command.
DecoderCommand
A variant of SongTime that is based on a signed integer.
Definition: Chrono.hxx:115
#define gcc_pure
Definition: Compiler.h:116
virtual void CommandFinished()=0
Called by the decoder when it has performed the requested command (dc->command).
DecoderCommand SubmitData(InputStream &is, const void *data, size_t length, uint16_t kbit_rate)
Definition: Client.hxx:135
const Storage const char * uri