Commit 8006911a authored by Max Kellermann's avatar Max Kellermann

decoder/Client: add `noexcept`

parent 61e58287
......@@ -272,7 +272,7 @@ DecoderBridge::GetCommand() noexcept
}
void
DecoderBridge::CommandFinished()
DecoderBridge::CommandFinished() noexcept
{
const std::lock_guard<Mutex> protect(dc.mutex);
......@@ -335,7 +335,7 @@ DecoderBridge::GetSeekFrame() noexcept
}
void
DecoderBridge::SeekError()
DecoderBridge::SeekError() noexcept
{
assert(dc.pipe != nullptr);
......@@ -411,7 +411,7 @@ try {
}
void
DecoderBridge::SubmitTimestamp(FloatDuration t)
DecoderBridge::SubmitTimestamp(FloatDuration t) noexcept
{
assert(t.count() >= 0);
......@@ -422,7 +422,7 @@ DecoderBridge::SubmitTimestamp(FloatDuration t)
DecoderCommand
DecoderBridge::SubmitData(InputStream *is,
const void *data, size_t length,
uint16_t kbit_rate)
uint16_t kbit_rate) noexcept
{
assert(dc.state == DecoderState::DECODE);
assert(dc.pipe != nullptr);
......@@ -539,7 +539,7 @@ DecoderBridge::SubmitData(InputStream *is,
}
DecoderCommand
DecoderBridge::SubmitTag(InputStream *is, Tag &&tag)
DecoderBridge::SubmitTag(InputStream *is, Tag &&tag) noexcept
{
DecoderCommand cmd;
......@@ -575,7 +575,7 @@ DecoderBridge::SubmitTag(InputStream *is, Tag &&tag)
}
void
DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info)
DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info) noexcept
{
if (new_replay_gain_info != nullptr) {
static unsigned serial;
......@@ -607,7 +607,7 @@ DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info)
}
void
DecoderBridge::SubmitMixRamp(MixRampInfo &&mix_ramp)
DecoderBridge::SubmitMixRamp(MixRampInfo &&mix_ramp) noexcept
{
dc.SetMixRamp(std::move(mix_ramp));
}
......@@ -139,19 +139,19 @@ public:
void Ready(AudioFormat audio_format,
bool seekable, SignedSongTime duration) override;
DecoderCommand GetCommand() noexcept override;
void CommandFinished() override;
void CommandFinished() noexcept override;
SongTime GetSeekTime() noexcept override;
uint64_t GetSeekFrame() noexcept override;
void SeekError() override;
void SeekError() noexcept override;
InputStreamPtr OpenUri(const char *uri) override;
size_t Read(InputStream &is, void *buffer, size_t length) override;
void SubmitTimestamp(FloatDuration t) override;
void SubmitTimestamp(FloatDuration t) noexcept override;
DecoderCommand SubmitData(InputStream *is,
const void *data, size_t length,
uint16_t kbit_rate) override;
DecoderCommand SubmitTag(InputStream *is, Tag &&tag) override ;
void SubmitReplayGain(const ReplayGainInfo *replay_gain_info) override;
void SubmitMixRamp(MixRampInfo &&mix_ramp) override;
uint16_t kbit_rate) noexcept override;
DecoderCommand SubmitTag(InputStream *is, Tag &&tag) noexcept override;
void SubmitReplayGain(const ReplayGainInfo *replay_gain_info) noexcept override;
void SubmitMixRamp(MixRampInfo &&mix_ramp) noexcept override;
private:
/**
......
......@@ -64,7 +64,7 @@ public:
* (dc->command). This function resets dc->command and wakes up the
* player thread.
*/
virtual void CommandFinished() = 0;
virtual void CommandFinished() noexcept = 0;
/**
* Call this when you have received the DecoderCommand::SEEK command.
......@@ -86,7 +86,7 @@ public:
* Call this instead of CommandFinished() when seeking has
* failed.
*/
virtual void SeekError() = 0;
virtual void SeekError() noexcept = 0;
/**
* Open a new #InputStream and wait until it's ready.
......@@ -114,7 +114,7 @@ public:
* use this function if it thinks that adding to the time stamp based
* on the buffer size won't work.
*/
virtual void SubmitTimestamp(FloatDuration t) = 0;
virtual void SubmitTimestamp(FloatDuration t) noexcept = 0;
/**
* This function is called by the decoder plugin when it has
......@@ -129,11 +129,11 @@ public:
*/
virtual DecoderCommand SubmitData(InputStream *is,
const void *data, size_t length,
uint16_t kbit_rate) = 0;
uint16_t kbit_rate) noexcept = 0;
DecoderCommand SubmitData(InputStream &is,
const void *data, size_t length,
uint16_t kbit_rate) {
uint16_t kbit_rate) noexcept {
return SubmitData(&is, data, length, kbit_rate);
}
......@@ -147,9 +147,9 @@ public:
* @return the current command, or DecoderCommand::NONE if there is no
* command pending
*/
virtual DecoderCommand SubmitTag(InputStream *is, Tag &&tag) = 0 ;
virtual DecoderCommand SubmitTag(InputStream *is, Tag &&tag) noexcept = 0 ;
DecoderCommand SubmitTag(InputStream &is, Tag &&tag) {
DecoderCommand SubmitTag(InputStream &is, Tag &&tag) noexcept {
return SubmitTag(&is, std::move(tag));
}
......@@ -159,12 +159,12 @@ public:
* @param replay_gain_info the replay_gain_info object; may be nullptr
* to invalidate the previous replay gain values
*/
virtual void SubmitReplayGain(const ReplayGainInfo *replay_gain_info) = 0;
virtual void SubmitReplayGain(const ReplayGainInfo *replay_gain_info) noexcept = 0;
/**
* Store MixRamp tags.
*/
virtual void SubmitMixRamp(MixRampInfo &&mix_ramp) = 0;
virtual void SubmitMixRamp(MixRampInfo &&mix_ramp) noexcept = 0;
};
#endif
......@@ -64,7 +64,7 @@ ChromaprintDecoderClient::Ready(AudioFormat audio_format, bool, SignedSongTime)
DecoderCommand
ChromaprintDecoderClient::SubmitData(InputStream *,
const void *_data, size_t length,
uint16_t)
uint16_t) noexcept
{
if (length > remaining_bytes)
remaining_bytes = 0;
......
......@@ -57,7 +57,7 @@ public:
: DecoderCommand::STOP;
}
void CommandFinished() override {}
void CommandFinished() noexcept override {}
SongTime GetSeekTime() noexcept override {
return SongTime::zero();
......@@ -67,23 +67,23 @@ public:
return 0;
}
void SeekError() override {}
void SeekError() noexcept override {}
//InputStreamPtr OpenUri(const char *) override;
size_t Read(InputStream &is, void *buffer, size_t length) override;
void SubmitTimestamp(FloatDuration) override {}
void SubmitTimestamp(FloatDuration) noexcept override {}
DecoderCommand SubmitData(InputStream *is,
const void *data, size_t length,
uint16_t kbit_rate) override;
uint16_t kbit_rate) noexcept override;
DecoderCommand SubmitTag(InputStream *, Tag &&) override {
DecoderCommand SubmitTag(InputStream *, Tag &&) noexcept override {
return GetCommand();
}
void SubmitReplayGain(const ReplayGainInfo *) override {}
void SubmitMixRamp(MixRampInfo &&) override {}
void SubmitReplayGain(const ReplayGainInfo *) noexcept override {}
void SubmitMixRamp(MixRampInfo &&) noexcept override {}
};
#endif
......@@ -48,7 +48,7 @@ DumpDecoderClient::GetCommand() noexcept
}
void
DumpDecoderClient::CommandFinished()
DumpDecoderClient::CommandFinished() noexcept
{
}
......@@ -65,7 +65,7 @@ DumpDecoderClient::GetSeekFrame() noexcept
}
void
DumpDecoderClient::SeekError()
DumpDecoderClient::SeekError() noexcept
{
}
......@@ -86,14 +86,14 @@ DumpDecoderClient::Read(InputStream &is, void *buffer, size_t length)
}
void
DumpDecoderClient::SubmitTimestamp(gcc_unused FloatDuration t)
DumpDecoderClient::SubmitTimestamp(gcc_unused FloatDuration t) noexcept
{
}
DecoderCommand
DumpDecoderClient::SubmitData(gcc_unused InputStream *is,
const void *data, size_t datalen,
gcc_unused uint16_t kbit_rate)
gcc_unused uint16_t kbit_rate) noexcept
{
if (kbit_rate != prev_kbit_rate) {
prev_kbit_rate = kbit_rate;
......@@ -106,7 +106,7 @@ DumpDecoderClient::SubmitData(gcc_unused InputStream *is,
DecoderCommand
DumpDecoderClient::SubmitTag(gcc_unused InputStream *is,
Tag &&tag)
Tag &&tag) noexcept
{
fprintf(stderr, "TAG: duration=%f\n", tag.duration.ToDoubleS());
......@@ -117,7 +117,7 @@ DumpDecoderClient::SubmitTag(gcc_unused InputStream *is,
}
static void
DumpReplayGainTuple(const char *name, const ReplayGainTuple &tuple)
DumpReplayGainTuple(const char *name, const ReplayGainTuple &tuple) noexcept
{
if (tuple.IsDefined())
fprintf(stderr, "replay_gain[%s]: gain=%f peak=%f\n",
......@@ -125,21 +125,21 @@ DumpReplayGainTuple(const char *name, const ReplayGainTuple &tuple)
}
static void
DumpReplayGainInfo(const ReplayGainInfo &info)
DumpReplayGainInfo(const ReplayGainInfo &info) noexcept
{
DumpReplayGainTuple("album", info.album);
DumpReplayGainTuple("track", info.track);
}
void
DumpDecoderClient::SubmitReplayGain(const ReplayGainInfo *rgi)
DumpDecoderClient::SubmitReplayGain(const ReplayGainInfo *rgi) noexcept
{
if (rgi != nullptr)
DumpReplayGainInfo(*rgi);
}
void
DumpDecoderClient::SubmitMixRamp(gcc_unused MixRampInfo &&mix_ramp)
DumpDecoderClient::SubmitMixRamp(gcc_unused MixRampInfo &&mix_ramp) noexcept
{
fprintf(stderr, "MixRamp: start='%s' end='%s'\n",
mix_ramp.GetStart(), mix_ramp.GetEnd());
......
......@@ -43,19 +43,19 @@ public:
void Ready(AudioFormat audio_format,
bool seekable, SignedSongTime duration) override;
DecoderCommand GetCommand() noexcept override;
void CommandFinished() override;
void CommandFinished() noexcept override;
SongTime GetSeekTime() noexcept override;
uint64_t GetSeekFrame() noexcept override;
void SeekError() override;
void SeekError() noexcept override;
InputStreamPtr OpenUri(const char *uri) override;
size_t Read(InputStream &is, void *buffer, size_t length) override;
void SubmitTimestamp(FloatDuration t) override;
void SubmitTimestamp(FloatDuration t) noexcept override;
DecoderCommand SubmitData(InputStream *is,
const void *data, size_t length,
uint16_t kbit_rate) override;
DecoderCommand SubmitTag(InputStream *is, Tag &&tag) override ;
void SubmitReplayGain(const ReplayGainInfo *replay_gain_info) override;
void SubmitMixRamp(MixRampInfo &&mix_ramp) override;
uint16_t kbit_rate) noexcept override;
DecoderCommand SubmitTag(InputStream *is, Tag &&tag) noexcept override;
void SubmitReplayGain(const ReplayGainInfo *replay_gain_info) noexcept override;
void SubmitMixRamp(MixRampInfo &&mix_ramp) noexcept override;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment