pcm/Convert: migrate from class Error to C++ exceptions
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
#include "pcm/PcmConvert.hxx"
|
||||
#include "util/Manual.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "AudioFormat.hxx"
|
||||
#include "poison.h"
|
||||
|
||||
@@ -88,9 +87,7 @@ ConvertFilter::Set(const AudioFormat &_out_audio_format)
|
||||
/* optimized special case: no-op */
|
||||
return;
|
||||
|
||||
Error error;
|
||||
if (!state.Open(in_audio_format, _out_audio_format, error))
|
||||
throw std::runtime_error(error.GetMessage());
|
||||
state.Open(in_audio_format, _out_audio_format);
|
||||
|
||||
out_audio_format = _out_audio_format;
|
||||
}
|
||||
@@ -125,12 +122,7 @@ ConvertFilter::FilterPCM(ConstBuffer<void> src)
|
||||
/* optimized special case: no-op */
|
||||
return src;
|
||||
|
||||
Error error;
|
||||
auto result = state.Convert(src, error);
|
||||
if (result.IsNull())
|
||||
throw std::runtime_error(error.GetMessage());
|
||||
|
||||
return result;
|
||||
return state.Convert(src);
|
||||
}
|
||||
|
||||
const struct filter_plugin convert_filter_plugin = {
|
||||
|
@@ -76,9 +76,7 @@ public:
|
||||
mixer(_mixer), base(_base), mode(REPLAY_GAIN_OFF) {
|
||||
info.Clear();
|
||||
|
||||
Error error;
|
||||
if (!pv.Open(out_audio_format.format, error))
|
||||
throw std::runtime_error(error.GetMessage());
|
||||
pv.Open(out_audio_format.format);
|
||||
}
|
||||
|
||||
void SetInfo(const ReplayGainInfo *_info) {
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include "pcm/Volume.hxx"
|
||||
#include "AudioFormat.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/Error.hxx"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -35,9 +34,7 @@ class VolumeFilter final : public Filter {
|
||||
public:
|
||||
explicit VolumeFilter(const AudioFormat &audio_format)
|
||||
:Filter(audio_format) {
|
||||
Error error;
|
||||
if (!pv.Open(out_audio_format.format, error))
|
||||
throw std::runtime_error(error.GetMessage());
|
||||
pv.Open(out_audio_format.format);
|
||||
}
|
||||
|
||||
unsigned GetVolume() const {
|
||||
|
Reference in New Issue
Block a user