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

decoder/Client: add `noexcept`

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