CheckAudioFormat: migrate from class Error to C++ exceptions

This commit is contained in:
Max Kellermann 2016-11-10 11:45:17 +01:00
parent 12f11c97ae
commit cfd51db229
22 changed files with 98 additions and 212 deletions

View File

@ -20,61 +20,43 @@
#include "config.h" #include "config.h"
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "AudioFormat.hxx" #include "AudioFormat.hxx"
#include "util/Error.hxx" #include "util/RuntimeError.hxx"
#include "util/Domain.hxx"
#include <stdexcept>
#include <assert.h> #include <assert.h>
const Domain audio_format_domain("audio_format"); void
CheckSampleRate(unsigned long sample_rate)
bool
audio_check_sample_rate(unsigned long sample_rate, Error &error)
{ {
if (!audio_valid_sample_rate(sample_rate)) { if (!audio_valid_sample_rate(sample_rate))
error.Format(audio_format_domain, throw FormatRuntimeError("Invalid sample rate: %lu",
"Invalid sample rate: %lu", sample_rate); sample_rate);
return false;
}
return true;
} }
bool void
audio_check_sample_format(SampleFormat sample_format, Error &error) CheckSampleFormat(SampleFormat sample_format)
{ {
if (!audio_valid_sample_format(sample_format)) { if (!audio_valid_sample_format(sample_format))
error.Format(audio_format_domain, throw FormatRuntimeError("Invalid sample format: %u",
"Invalid sample format: %u", unsigned(sample_format));
unsigned(sample_format));
return false;
}
return true;
} }
bool void
audio_check_channel_count(unsigned channels, Error &error) CheckChannelCount(unsigned channels)
{ {
if (!audio_valid_channel_count(channels)) { if (!audio_valid_channel_count(channels))
error.Format(audio_format_domain, throw FormatRuntimeError("Invalid channel count: %u",
"Invalid channel count: %u", channels); channels);
return false;
}
return true;
} }
bool AudioFormat
audio_format_init_checked(AudioFormat &af, unsigned long sample_rate, CheckAudioFormat(unsigned long sample_rate,
SampleFormat sample_format, unsigned channels, SampleFormat sample_format, unsigned channels)
Error &error)
{ {
if (audio_check_sample_rate(sample_rate, error) && CheckSampleRate(sample_rate);
audio_check_sample_format(sample_format, error) && CheckSampleFormat(sample_format);
audio_check_channel_count(channels, error)) { CheckChannelCount(channels);
af = AudioFormat(sample_rate, sample_format, channels);
assert(af.IsValid()); return AudioFormat(sample_rate, sample_format, channels);
return true;
} else
return false;
} }

View File

@ -22,25 +22,23 @@
#include "AudioFormat.hxx" #include "AudioFormat.hxx"
class Error; void
CheckSampleRate(unsigned long sample_rate);
extern const class Domain audio_format_domain; void
CheckSampleFormat(SampleFormat sample_format);
bool void
audio_check_sample_rate(unsigned long sample_rate, Error &error); CheckChannelCount(unsigned sample_format);
bool
audio_check_sample_format(SampleFormat sample_format, Error &error);
bool
audio_check_channel_count(unsigned sample_format, Error &error);
/** /**
* Wrapper for audio_format_init(), which checks all attributes. * Check #AudioFormat attributes and construct an #AudioFormat
* instance.
*
* Throws #std::runtime_error on error.
*/ */
bool AudioFormat
audio_format_init_checked(AudioFormat &af, unsigned long sample_rate, CheckAudioFormat(unsigned long sample_rate,
SampleFormat sample_format, unsigned channels, SampleFormat sample_format, unsigned channels);
Error &error);
#endif #endif

View File

@ -23,7 +23,6 @@
#include "../DecoderAPI.hxx" #include "../DecoderAPI.hxx"
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -43,13 +42,8 @@ adplug_init(const ConfigBlock &block)
FormatDebug(adplug_domain, "adplug %s", FormatDebug(adplug_domain, "adplug %s",
CAdPlug::get_version().c_str()); CAdPlug::get_version().c_str());
Error error;
sample_rate = block.GetBlockValue("sample_rate", 48000u); sample_rate = block.GetBlockValue("sample_rate", 48000u);
if (!audio_check_sample_rate(sample_rate, error)) { CheckSampleRate(sample_rate);
LogError(error);
return false;
}
return true; return true;
} }

View File

@ -24,7 +24,6 @@
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -198,16 +197,10 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
AtScopeExit(fh) { afCloseFile(fh); }; AtScopeExit(fh) { afCloseFile(fh); };
Error error; const auto audio_format =
AudioFormat audio_format; CheckAudioFormat(afGetRate(fh, AF_DEFAULT_TRACK),
if (!audio_format_init_checked(audio_format, audiofile_setup_sample_format(fh),
afGetRate(fh, AF_DEFAULT_TRACK), afGetVirtualChannels(fh, AF_DEFAULT_TRACK));
audiofile_setup_sample_format(fh),
afGetVirtualChannels(fh, AF_DEFAULT_TRACK),
error)) {
LogError(error);
return;
}
const auto total_time = audiofile_get_duration(fh); const auto total_time = audiofile_get_duration(fh);

View File

@ -32,7 +32,6 @@
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "util/bit_reverse.h" #include "util/bit_reverse.h"
#include "util/Error.hxx"
#include "system/ByteOrder.hxx" #include "system/ByteOrder.hxx"
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
#include "DsdLib.hxx" #include "DsdLib.hxx"
@ -426,14 +425,9 @@ dsdiff_stream_decode(Decoder &decoder, InputStream &is)
if (!dsdiff_read_metadata(&decoder, is, &metadata, &chunk_header)) if (!dsdiff_read_metadata(&decoder, is, &metadata, &chunk_header))
return; return;
Error error; auto audio_format = CheckAudioFormat(metadata.sample_rate / 8,
AudioFormat audio_format; SampleFormat::DSD,
if (!audio_format_init_checked(audio_format, metadata.sample_rate / 8, metadata.channels);
SampleFormat::DSD,
metadata.channels, error)) {
LogError(error);
return;
}
/* calculate song time from DSD chunk size and sample frequency */ /* calculate song time from DSD chunk size and sample frequency */
offset_type chunk_size = metadata.chunk_size; offset_type chunk_size = metadata.chunk_size;
@ -466,12 +460,9 @@ dsdiff_scan_stream(InputStream &is,
if (!dsdiff_read_metadata(nullptr, is, &metadata, &chunk_header)) if (!dsdiff_read_metadata(nullptr, is, &metadata, &chunk_header))
return false; return false;
AudioFormat audio_format; auto audio_format = CheckAudioFormat(metadata.sample_rate / 8,
if (!audio_format_init_checked(audio_format, metadata.sample_rate / 8, SampleFormat::DSD,
SampleFormat::DSD, metadata.channels);
metadata.channels, IgnoreError()))
/* refuse to parse files which we cannot play anyway */
return false;
/* calculate song time and add as tag */ /* calculate song time and add as tag */
uint64_t n_frames = metadata.chunk_size / audio_format.channels; uint64_t n_frames = metadata.chunk_size / audio_format.channels;

View File

@ -33,7 +33,6 @@
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "util/bit_reverse.h" #include "util/bit_reverse.h"
#include "util/Error.hxx"
#include "system/ByteOrder.hxx" #include "system/ByteOrder.hxx"
#include "DsdLib.hxx" #include "DsdLib.hxx"
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
@ -307,14 +306,10 @@ dsf_stream_decode(Decoder &decoder, InputStream &is)
if (!dsf_read_metadata(&decoder, is, &metadata)) if (!dsf_read_metadata(&decoder, is, &metadata))
return; return;
Error error; auto audio_format = CheckAudioFormat(metadata.sample_rate / 8,
AudioFormat audio_format; SampleFormat::DSD,
if (!audio_format_init_checked(audio_format, metadata.sample_rate / 8, metadata.channels);
SampleFormat::DSD,
metadata.channels, error)) {
LogError(error);
return;
}
/* Calculate song time from DSD chunk size and sample frequency */ /* Calculate song time from DSD chunk size and sample frequency */
const auto n_blocks = metadata.n_blocks; const auto n_blocks = metadata.n_blocks;
auto songtime = SongTime::FromScale<uint64_t>(n_blocks * DSF_BLOCK_SIZE, 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)) if (!dsf_read_metadata(nullptr, is, &metadata))
return false; return false;
AudioFormat audio_format; auto audio_format = CheckAudioFormat(metadata.sample_rate / 8,
if (!audio_format_init_checked(audio_format, metadata.sample_rate / 8, SampleFormat::DSD,
SampleFormat::DSD, metadata.channels);
metadata.channels, IgnoreError()))
/* refuse to parse files which we cannot play anyway */
return false;
/* calculate song time and add as tag */ /* calculate song time and add as tag */
const auto n_blocks = metadata.n_blocks; const auto n_blocks = metadata.n_blocks;

View File

@ -273,8 +273,9 @@ faad_decoder_init(NeAACDecHandle decoder, DecoderBuffer &buffer,
buffer.Consume(nbytes); buffer.Consume(nbytes);
return audio_format_init_checked(audio_format, sample_rate, audio_format = CheckAudioFormat(sample_rate, SampleFormat::S16,
SampleFormat::S16, channels, error); channels);
return true;
} }
/** /**

View File

@ -40,7 +40,6 @@
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
#include "util/ConstBuffer.hxx" #include "util/ConstBuffer.hxx"
#include "util/Error.hxx"
#include "LogV.hxx" #include "LogV.hxx"
extern "C" { extern "C" {
@ -666,15 +665,9 @@ FfmpegDecode(Decoder &decoder, InputStream &input,
return; return;
} }
Error error; const auto audio_format = CheckAudioFormat(codec_params.sample_rate,
AudioFormat audio_format; sample_format,
if (!audio_format_init_checked(audio_format, codec_params.channels);
codec_params.sample_rate,
sample_format,
codec_params.channels, error)) {
LogError(error);
return;
}
/* the audio format must be read from AVCodecContext by now, /* the audio format must be read from AVCodecContext by now,
because avcodec_open() has been demonstrated to fill bogus because avcodec_open() has been demonstrated to fill bogus

View File

@ -58,12 +58,7 @@ FlacPcmImport::Open(unsigned sample_rate, unsigned bits_per_sample,
return false; return false;
} }
if (!audio_format_init_checked(audio_format, audio_format = CheckAudioFormat(sample_rate, sample_format, channels);
sample_rate,
sample_format,
channels, error))
return false;
return true; return true;
} }

View File

@ -39,9 +39,6 @@ class FlacPcmImport {
AudioFormat audio_format; AudioFormat audio_format;
public: public:
/**
* @return false on error
*/
bool Open(unsigned sample_rate, unsigned bits_per_sample, bool Open(unsigned sample_rate, unsigned bits_per_sample,
unsigned channels, Error &error); unsigned channels, Error &error);

View File

@ -22,7 +22,6 @@
#include "../DecoderAPI.hxx" #include "../DecoderAPI.hxx"
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -75,13 +74,8 @@ fluidsynth_mpd_log_function(int level, char *message, gcc_unused void *data)
static bool static bool
fluidsynth_init(const ConfigBlock &block) fluidsynth_init(const ConfigBlock &block)
{ {
Error error;
sample_rate = block.GetBlockValue("sample_rate", 48000u); sample_rate = block.GetBlockValue("sample_rate", 48000u);
if (!audio_check_sample_rate(sample_rate, error)) { CheckSampleRate(sample_rate);
LogError(error);
return false;
}
soundfont_path = block.GetBlockValue("soundfont", soundfont_path = block.GetBlockValue("soundfont",
"/usr/share/sounds/sf2/FluidR3_GM.sf2"); "/usr/share/sounds/sf2/FluidR3_GM.sf2");

View File

@ -29,7 +29,6 @@
#include "util/FormatString.hxx" #include "util/FormatString.hxx"
#include "util/AllocatedString.hxx" #include "util/AllocatedString.hxx"
#include "util/UriUtil.hxx" #include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -168,14 +167,9 @@ gme_file_decode(Decoder &decoder, Path path_fs)
/* initialize the MPD decoder */ /* initialize the MPD decoder */
Error error; const auto audio_format = CheckAudioFormat(GME_SAMPLE_RATE,
AudioFormat audio_format; SampleFormat::S16,
if (!audio_format_init_checked(audio_format, GME_SAMPLE_RATE, GME_CHANNELS);
SampleFormat::S16, GME_CHANNELS,
error)) {
LogError(error);
return;
}
decoder_initialized(decoder, audio_format, true, song_len); decoder_initialized(decoder, audio_format, true, song_len);

View File

@ -29,7 +29,6 @@
#include "tag/MixRamp.hxx" #include "tag/MixRamp.hxx"
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "util/StringCompare.hxx" #include "util/StringCompare.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -1051,19 +1050,10 @@ mp3_decode(Decoder &decoder, InputStream &input_stream)
data.AllocateBuffers(); data.AllocateBuffers();
Error error; decoder_initialized(decoder,
AudioFormat audio_format; CheckAudioFormat(data.frame.header.samplerate,
if (!audio_format_init_checked(audio_format, SampleFormat::S24_P32,
data.frame.header.samplerate, MAD_NCHANNELS(&data.frame.header)),
SampleFormat::S24_P32,
MAD_NCHANNELS(&data.frame.header),
error)) {
LogError(error);
delete tag;
return;
}
decoder_initialized(decoder, audio_format,
input_stream.IsSeekable(), input_stream.IsSeekable(),
data.total_time); data.total_time);

View File

@ -24,7 +24,6 @@
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "pcm/Traits.hxx" #include "pcm/Traits.hxx"
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include "util/Clamp.hxx" #include "util/Clamp.hxx"
@ -162,15 +161,9 @@ mpcdec_decode(Decoder &mpd_decoder, InputStream &is)
mpc_streaminfo info; mpc_streaminfo info;
mpc_demux_get_info(demux, &info); mpc_demux_get_info(demux, &info);
Error error; auto audio_format = CheckAudioFormat(info.sample_freq,
AudioFormat audio_format; mpcdec_sample_format,
if (!audio_format_init_checked(audio_format, info.sample_freq, info.channels);
mpcdec_sample_format,
info.channels, error)) {
LogError(error);
mpc_demux_exit(demux);
return;
}
ReplayGainInfo rgi; ReplayGainInfo rgi;
rgi.Clear(); rgi.Clear();

View File

@ -26,7 +26,6 @@
#include "tag/ReplayGain.hxx" #include "tag/ReplayGain.hxx"
#include "tag/MixRamp.hxx" #include "tag/MixRamp.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/StringView.hxx" #include "util/StringView.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -95,13 +94,7 @@ mpd_mpg123_open(mpg123_handle *handle, const char *path_fs,
return false; return false;
} }
Error error2; audio_format = CheckAudioFormat(rate, SampleFormat::S16, channels);
if (!audio_format_init_checked(audio_format, rate, SampleFormat::S16,
channels, error2)) {
LogError(error2);
return false;
}
return true; return true;
} }

View File

@ -32,7 +32,6 @@
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
#include "tag/TagBuilder.hxx" #include "tag/TagBuilder.hxx"
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "util/Error.hxx"
#include "util/RuntimeError.hxx" #include "util/RuntimeError.hxx"
#include "Log.hxx" #include "Log.hxx"

View File

@ -23,7 +23,7 @@
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "system/ByteOrder.hxx" #include "system/ByteOrder.hxx"
#include "util/Error.hxx" #include "util/Domain.hxx"
#include "util/ByteReverse.hxx" #include "util/ByteReverse.hxx"
#include "util/NumberParser.hxx" #include "util/NumberParser.hxx"
#include "util/MimeType.hxx" #include "util/MimeType.hxx"
@ -33,6 +33,8 @@
#include <string.h> #include <string.h>
static constexpr Domain pcm_decoder_domain("pcm_decoder");
static void static void
pcm_stream_decode(Decoder &decoder, InputStream &is) pcm_stream_decode(Decoder &decoder, InputStream &is)
{ {
@ -62,7 +64,6 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
{ {
const auto mime_parameters = ParseMimeTypeParameters(mime); const auto mime_parameters = ParseMimeTypeParameters(mime);
Error error;
/* MIME type parameters according to RFC 2586 */ /* MIME type parameters according to RFC 2586 */
auto i = mime_parameters.find("rate"); auto i = mime_parameters.find("rate");
@ -71,14 +72,16 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
char *endptr; char *endptr;
unsigned value = ParseUnsigned(s, &endptr); unsigned value = ParseUnsigned(s, &endptr);
if (endptr == s || *endptr != 0) { if (endptr == s || *endptr != 0) {
FormatWarning(audio_format_domain, FormatWarning(pcm_decoder_domain,
"Failed to parse sample rate: %s", "Failed to parse sample rate: %s",
s); s);
return; return;
} }
if (!audio_check_sample_rate(value, error)) { try {
LogError(error); CheckSampleRate(value);
} catch (const std::runtime_error &e) {
LogError(e);
return; return;
} }
@ -91,14 +94,16 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
char *endptr; char *endptr;
unsigned value = ParseUnsigned(s, &endptr); unsigned value = ParseUnsigned(s, &endptr);
if (endptr == s || *endptr != 0) { if (endptr == s || *endptr != 0) {
FormatWarning(audio_format_domain, FormatWarning(pcm_decoder_domain,
"Failed to parse sample rate: %s", "Failed to parse sample rate: %s",
s); s);
return; return;
} }
if (!audio_check_channel_count(value, error)) { try {
LogError(error); CheckChannelCount(value);
} catch (const std::runtime_error &e) {
LogError(e);
return; return;
} }
@ -107,7 +112,7 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
} }
if (audio_format.sample_rate == 0) { if (audio_format.sample_rate == 0) {
FormatWarning(audio_format_domain, FormatWarning(pcm_decoder_domain,
"Missing 'rate' parameter: %s", "Missing 'rate' parameter: %s",
mime); mime);
return; return;

View File

@ -27,7 +27,6 @@
#include "util/FormatString.hxx" #include "util/FormatString.hxx"
#include "util/AllocatedString.hxx" #include "util/AllocatedString.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/Error.hxx"
#include "system/ByteOrder.hxx" #include "system/ByteOrder.hxx"
#include "system/FatalError.hxx" #include "system/FatalError.hxx"
#include "Log.hxx" #include "Log.hxx"

View File

@ -23,7 +23,6 @@
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -201,14 +200,10 @@ sndfile_stream_decode(Decoder &decoder, InputStream &is)
return; return;
} }
Error error; const auto audio_format =
AudioFormat audio_format; CheckAudioFormat(info.samplerate,
if (!audio_format_init_checked(audio_format, info.samplerate, sndfile_sample_format(info),
sndfile_sample_format(info), info.channels);
info.channels, error)) {
LogError(error);
return;
}
decoder_initialized(decoder, audio_format, info.seekable, decoder_initialized(decoder, audio_format, info.seekable,
sndfile_duration(info)); sndfile_duration(info));

View File

@ -29,7 +29,6 @@
#include "input/Reader.hxx" #include "input/Reader.hxx"
#include "OggCodec.hxx" #include "OggCodec.hxx"
#include "pcm/Interleave.hxx" #include "pcm/Interleave.hxx"
#include "util/Error.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
@ -166,10 +165,7 @@ VorbisDecoder::SubmitInit()
{ {
assert(!dsp_initialized); assert(!dsp_initialized);
Error error; audio_format = CheckAudioFormat(vi.rate, sample_format, vi.channels);
if (!audio_format_init_checked(audio_format, vi.rate, sample_format,
vi.channels, error))
throw std::runtime_error(error.GetMessage());
frame_size = audio_format.GetFrameSize(); frame_size = audio_format.GetFrameSize();

View File

@ -25,7 +25,6 @@
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
#include "tag/ApeTag.hxx" #include "tag/ApeTag.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include "util/Alloc.hxx" #include "util/Alloc.hxx"
@ -149,15 +148,9 @@ wavpack_decode(Decoder &decoder, WavpackContext *wpc, bool can_seek)
wavpack_bits_to_sample_format(is_float, wavpack_bits_to_sample_format(is_float,
WavpackGetBytesPerSample(wpc)); WavpackGetBytesPerSample(wpc));
Error error; auto audio_format = CheckAudioFormat(WavpackGetSampleRate(wpc),
AudioFormat audio_format; sample_format,
if (!audio_format_init_checked(audio_format, WavpackGetNumChannels(wpc));
WavpackGetSampleRate(wpc),
sample_format,
WavpackGetNumChannels(wpc), error)) {
LogError(error);
return;
}
const format_samples_t format_samples = is_float const format_samples_t format_samples = is_float
? format_samples_float ? format_samples_float

View File

@ -21,7 +21,6 @@
#include "WildmidiDecoderPlugin.hxx" #include "WildmidiDecoderPlugin.hxx"
#include "../DecoderAPI.hxx" #include "../DecoderAPI.hxx"
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "fs/FileSystem.hxx" #include "fs/FileSystem.hxx"