filter/Filter: add "noexcept"

This commit is contained in:
Max Kellermann 2018-01-01 19:23:01 +01:00
parent 3bb9c704de
commit e387d94ff1
4 changed files with 12 additions and 10 deletions

View File

@ -30,25 +30,25 @@ class Filter {
protected: protected:
AudioFormat out_audio_format; AudioFormat out_audio_format;
explicit Filter(AudioFormat _out_audio_format) explicit Filter(AudioFormat _out_audio_format) noexcept
:out_audio_format(_out_audio_format) { :out_audio_format(_out_audio_format) {
assert(out_audio_format.IsValid()); assert(out_audio_format.IsValid());
} }
public: public:
virtual ~Filter() {} virtual ~Filter() noexcept {}
/** /**
* Returns the #AudioFormat produced by FilterPCM(). * Returns the #AudioFormat produced by FilterPCM().
*/ */
const AudioFormat &GetOutAudioFormat() const { const AudioFormat &GetOutAudioFormat() const noexcept {
return out_audio_format; return out_audio_format;
} }
/** /**
* Reset the filter's state, e.g. drop/flush buffers. * Reset the filter's state, e.g. drop/flush buffers.
*/ */
virtual void Reset() { virtual void Reset() noexcept {
} }
/** /**

View File

@ -49,7 +49,7 @@ public:
:Filter(_filter->GetOutAudioFormat()), :Filter(_filter->GetOutAudioFormat()),
filter(std::move(_filter)), convert(std::move(_convert)) {} filter(std::move(_filter)), convert(std::move(_convert)) {}
void Reset() override { void Reset() noexcept override {
filter->Reset(); filter->Reset();
if (convert) if (convert)

View File

@ -36,7 +36,8 @@ class ChainFilter final : public Filter {
const char *name; const char *name;
std::unique_ptr<Filter> filter; std::unique_ptr<Filter> filter;
Child(const char *_name, std::unique_ptr<Filter> _filter) Child(const char *_name,
std::unique_ptr<Filter> _filter) noexcept
:name(_name), filter(std::move(_filter)) {} :name(_name), filter(std::move(_filter)) {}
}; };
@ -46,7 +47,8 @@ public:
explicit ChainFilter(AudioFormat _audio_format) explicit ChainFilter(AudioFormat _audio_format)
:Filter(_audio_format) {} :Filter(_audio_format) {}
void Append(const char *name, std::unique_ptr<Filter> filter) { void Append(const char *name,
std::unique_ptr<Filter> filter) noexcept {
assert(out_audio_format.IsValid()); assert(out_audio_format.IsValid());
out_audio_format = filter->GetOutAudioFormat(); out_audio_format = filter->GetOutAudioFormat();
assert(out_audio_format.IsValid()); assert(out_audio_format.IsValid());
@ -55,7 +57,7 @@ public:
} }
/* virtual methods from class Filter */ /* virtual methods from class Filter */
void Reset() override; void Reset() noexcept override;
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override; ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override;
}; };
@ -114,7 +116,7 @@ PreparedChainFilter::Open(AudioFormat &in_audio_format)
} }
void void
ChainFilter::Reset() ChainFilter::Reset() noexcept
{ {
for (auto &child : children) for (auto &child : children)
child.filter->Reset(); child.filter->Reset();

View File

@ -50,7 +50,7 @@ public:
void Set(const AudioFormat &_out_audio_format); void Set(const AudioFormat &_out_audio_format);
void Reset() override { void Reset() noexcept override {
state.Reset(); state.Reset();
} }