pcm/Convert: migrate from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-09-05 12:19:20 +02:00
parent 860064c812
commit ae1eb9ccde
27 changed files with 197 additions and 305 deletions

View File

@@ -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 = {

View File

@@ -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) {

View File

@@ -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 {