decoder/Bridge: add `noexcept`

This commit is contained in:
Max Kellermann 2019-07-05 08:35:39 +02:00
parent 94c9fafe16
commit 4650a903b4
8 changed files with 25 additions and 16 deletions

View File

@ -83,7 +83,8 @@ private:
/* virtual methods from class DecoderClient */
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) noexcept override;
/* virtual methods from class InputStreamHandler */
void OnInputStreamReady() noexcept override {
@ -285,7 +286,8 @@ GetChromaprintCommand::OpenUri(const char *uri2)
}
size_t
GetChromaprintCommand::Read(InputStream &is, void *buffer, size_t length)
GetChromaprintCommand::Read(InputStream &is,
void *buffer, size_t length) noexcept
{
/* overriding ChromaprintDecoderClient's implementation to
make it cancellable */

View File

@ -255,7 +255,7 @@ DecoderBridge::UpdateStreamTag(InputStream *is) noexcept
void
DecoderBridge::Ready(const AudioFormat audio_format,
bool seekable, SignedSongTime duration)
bool seekable, SignedSongTime duration) noexcept
{
assert(convert == nullptr);
assert(stream_tag == nullptr);
@ -401,7 +401,7 @@ DecoderBridge::OpenUri(const char *uri)
}
size_t
DecoderBridge::Read(InputStream &is, void *buffer, size_t length)
DecoderBridge::Read(InputStream &is, void *buffer, size_t length) noexcept
try {
assert(buffer != nullptr);
assert(dc.state == DecoderState::START ||

View File

@ -161,14 +161,15 @@ public:
/* virtual methods from DecoderClient */
void Ready(AudioFormat audio_format,
bool seekable, SignedSongTime duration) override;
bool seekable, SignedSongTime duration) noexcept override;
DecoderCommand GetCommand() noexcept override;
void CommandFinished() noexcept override;
SongTime GetSeekTime() noexcept override;
uint64_t GetSeekFrame() noexcept override;
void SeekError() noexcept 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) noexcept override;
void SubmitTimestamp(FloatDuration t) noexcept override;
DecoderCommand SubmitData(InputStream *is,
const void *data, size_t length,

View File

@ -48,7 +48,8 @@ public:
* unknown
*/
virtual void Ready(AudioFormat audio_format,
bool seekable, SignedSongTime duration) = 0;
bool seekable,
SignedSongTime duration) noexcept = 0;
/**
* Determines the pending decoder command.
@ -106,7 +107,8 @@ public:
* @return the number of bytes read, or 0 if one of the following
* occurs: end of file; error; command (like SEEK or STOP).
*/
virtual size_t Read(InputStream &is, void *buffer, size_t length) = 0;
virtual size_t Read(InputStream &is,
void *buffer, size_t length) noexcept = 0;
/**
* Sets the time stamp for the next data chunk [seconds]. The MPD

View File

@ -44,7 +44,8 @@ ChromaprintDecoderClient::Finish()
}
void
ChromaprintDecoderClient::Ready(AudioFormat audio_format, bool, SignedSongTime)
ChromaprintDecoderClient::Ready(AudioFormat audio_format, bool,
SignedSongTime) noexcept
{
/* feed the first two minutes into libchromaprint */
remaining_bytes = audio_format.TimeToSize(std::chrono::minutes(2));
@ -87,7 +88,8 @@ ChromaprintDecoderClient::SubmitData(InputStream *,
}
size_t
ChromaprintDecoderClient::Read(InputStream &is, void *buffer, size_t length)
ChromaprintDecoderClient::Read(InputStream &is,
void *buffer, size_t length) noexcept
{
try {
return is.LockRead(buffer, length);

View File

@ -68,7 +68,7 @@ public:
/* virtual methods from DecoderClient */
void Ready(AudioFormat audio_format,
bool seekable, SignedSongTime duration) override;
bool seekable, SignedSongTime duration) noexcept override;
DecoderCommand GetCommand() noexcept override {
return !error && remaining_bytes > 0
@ -90,7 +90,8 @@ public:
//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) noexcept override;
void SubmitTimestamp(FloatDuration) noexcept override {}
DecoderCommand SubmitData(InputStream *is,

View File

@ -29,7 +29,7 @@
void
DumpDecoderClient::Ready(const AudioFormat audio_format,
gcc_unused bool seekable,
SignedSongTime duration)
SignedSongTime duration) noexcept
{
assert(!initialized);
assert(audio_format.IsValid());
@ -76,7 +76,7 @@ DumpDecoderClient::OpenUri(const char *uri)
}
size_t
DumpDecoderClient::Read(InputStream &is, void *buffer, size_t length)
DumpDecoderClient::Read(InputStream &is, void *buffer, size_t length) noexcept
{
try {
return is.LockRead(buffer, length);

View File

@ -41,14 +41,15 @@ public:
/* virtual methods from DecoderClient */
void Ready(AudioFormat audio_format,
bool seekable, SignedSongTime duration) override;
bool seekable, SignedSongTime duration) noexcept override;
DecoderCommand GetCommand() noexcept override;
void CommandFinished() noexcept override;
SongTime GetSeekTime() noexcept override;
uint64_t GetSeekFrame() noexcept override;
void SeekError() noexcept 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) noexcept override;
void SubmitTimestamp(FloatDuration t) noexcept override;
DecoderCommand SubmitData(InputStream *is,
const void *data, size_t length,