summaryrefslogtreecommitdiff
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-09-08 20:31:06 +0200
committerMax Kellermann <max@musicpd.org>2016-09-08 20:56:05 +0200
commit845901ab015660e2999f01c4f112d274295c7417 (patch)
tree8d0843fdd0b8e6a306a65c34fee304e4c6aabf6c /src/decoder
parent25f736026457197c8b50e4378177dc4136a3c512 (diff)
decoder/Internal: convert error from Error to std::exception_ptr
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/DecoderAPI.cxx4
-rw-r--r--src/decoder/DecoderInternal.hxx5
-rw-r--r--src/decoder/DecoderThread.cxx8
3 files changed, 9 insertions, 8 deletions
diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx
index 401be32f2..87bbd0b13 100644
--- a/src/decoder/DecoderAPI.cxx
+++ b/src/decoder/DecoderAPI.cxx
@@ -77,7 +77,7 @@ decoder_initialized(Decoder &decoder,
if (!decoder.convert->Open(dc.in_audio_format,
dc.out_audio_format,
error))
- decoder.error = std::move(error);
+ decoder.error = std::make_exception_ptr(std::move(error));
}
const ScopeLock protect(dc.mutex);
@@ -140,7 +140,7 @@ gcc_pure
static DecoderCommand
decoder_get_virtual_command(Decoder &decoder)
{
- if (decoder.error.IsDefined())
+ if (decoder.error)
/* an error has occurred: stop the decoder plugin */
return DecoderCommand::STOP;
diff --git a/src/decoder/DecoderInternal.hxx b/src/decoder/DecoderInternal.hxx
index 36cbcbf5d..b7df55bf1 100644
--- a/src/decoder/DecoderInternal.hxx
+++ b/src/decoder/DecoderInternal.hxx
@@ -21,7 +21,8 @@
#define MPD_DECODER_INTERNAL_HXX
#include "ReplayGainInfo.hxx"
-#include "util/Error.hxx"
+
+#include <exception>
class PcmConvert;
struct MusicChunk;
@@ -91,7 +92,7 @@ struct Decoder {
* An error has occurred (in DecoderAPI.cxx), and the plugin
* will be asked to stop.
*/
- Error error;
+ std::exception_ptr error;
Decoder(DecoderControl &_dc, bool _initial_seek_pending, Tag *_tag)
:dc(_dc),
diff --git a/src/decoder/DecoderThread.cxx b/src/decoder/DecoderThread.cxx
index 3acb8112d..bb8ef13dc 100644
--- a/src/decoder/DecoderThread.cxx
+++ b/src/decoder/DecoderThread.cxx
@@ -211,7 +211,7 @@ decoder_run_stream_plugin(Decoder &decoder, InputStream &is,
if (!decoder_check_plugin(plugin, is, suffix))
return false;
- decoder.error.Clear();
+ decoder.error = std::exception_ptr();
tried_r = true;
return decoder_stream_decode(plugin, decoder, is);
@@ -300,7 +300,7 @@ TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
if (!plugin.SupportsSuffix(suffix))
return false;
- decoder.error.Clear();
+ decoder.error = std::exception_ptr();
DecoderControl &dc = decoder.dc;
@@ -398,10 +398,10 @@ decoder_run_song(DecoderControl &dc,
}
- if (decoder.error.IsDefined()) {
+ if (decoder.error) {
/* copy the Error from struct Decoder to
DecoderControl */
- throw std::move(decoder.error);
+ std::rethrow_exception(decoder.error);
} else if (success)
dc.state = DecoderState::STOP;
else {