diff options
author | Max Kellermann <max@musicpd.org> | 2016-11-10 11:45:17 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-11-10 12:55:08 +0100 |
commit | cfd51db2292aa9ff0b33d2a7ac50a78cafec6015 (patch) | |
tree | 4026d81758898f259622d5cce49f8b052237eaff /src/decoder/plugins/DsfDecoderPlugin.cxx | |
parent | 12f11c97ae9e5b1b6367e4a5c49713fdd4984b89 (diff) |
CheckAudioFormat: migrate from class Error to C++ exceptions
Diffstat (limited to 'src/decoder/plugins/DsfDecoderPlugin.cxx')
-rw-r--r-- | src/decoder/plugins/DsfDecoderPlugin.cxx | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/decoder/plugins/DsfDecoderPlugin.cxx b/src/decoder/plugins/DsfDecoderPlugin.cxx index 47d8d004d..8dce68a3a 100644 --- a/src/decoder/plugins/DsfDecoderPlugin.cxx +++ b/src/decoder/plugins/DsfDecoderPlugin.cxx @@ -33,7 +33,6 @@ #include "input/InputStream.hxx" #include "CheckAudioFormat.hxx" #include "util/bit_reverse.h" -#include "util/Error.hxx" #include "system/ByteOrder.hxx" #include "DsdLib.hxx" #include "tag/TagHandler.hxx" @@ -307,14 +306,10 @@ dsf_stream_decode(Decoder &decoder, InputStream &is) if (!dsf_read_metadata(&decoder, is, &metadata)) return; - Error error; - AudioFormat audio_format; - if (!audio_format_init_checked(audio_format, metadata.sample_rate / 8, - SampleFormat::DSD, - metadata.channels, error)) { - LogError(error); - return; - } + auto audio_format = CheckAudioFormat(metadata.sample_rate / 8, + SampleFormat::DSD, + metadata.channels); + /* Calculate song time from DSD chunk size and sample frequency */ const auto n_blocks = metadata.n_blocks; auto songtime = SongTime::FromScale<uint64_t>(n_blocks * DSF_BLOCK_SIZE, @@ -339,12 +334,9 @@ dsf_scan_stream(InputStream &is, if (!dsf_read_metadata(nullptr, is, &metadata)) return false; - AudioFormat audio_format; - if (!audio_format_init_checked(audio_format, metadata.sample_rate / 8, - SampleFormat::DSD, - metadata.channels, IgnoreError())) - /* refuse to parse files which we cannot play anyway */ - return false; + auto audio_format = CheckAudioFormat(metadata.sample_rate / 8, + SampleFormat::DSD, + metadata.channels); /* calculate song time and add as tag */ const auto n_blocks = metadata.n_blocks; |