summaryrefslogtreecommitdiff
path: root/test/run_encoder.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-11-07 09:20:12 +0100
committerMax Kellermann <max@musicpd.org>2016-11-07 09:25:51 +0100
commitd8b6aff23aa01fb26dfe52a0e0c6fbd485b87f39 (patch)
treedd935d5b843dcf7a921e789253993c1d258bb2c5 /test/run_encoder.cxx
parentb8aac3f8fc27dbdc503aeb078b4d57f6a5a70266 (diff)
encoder: migrate from class Error to C++ exceptions
Diffstat (limited to 'test/run_encoder.cxx')
-rw-r--r--test/run_encoder.cxx20
1 files changed, 3 insertions, 17 deletions
diff --git a/test/run_encoder.cxx b/test/run_encoder.cxx
index 78dd093eb..6c5fd272f 100644
--- a/test/run_encoder.cxx
+++ b/test/run_encoder.cxx
@@ -26,7 +26,6 @@
#include "AudioParser.hxx"
#include "config/Block.hxx"
#include "fs/io/StdioOutputStream.hxx"
-#include "util/Error.hxx"
#include "Log.hxx"
#include <memory>
@@ -66,7 +65,6 @@ int main(int argc, char **argv)
block.AddBlockParam("quality", "5.0", -1);
try {
- Error error;
std::unique_ptr<PreparedEncoder> p_encoder(encoder_init(*plugin, block));
/* open the encoder */
@@ -75,11 +73,7 @@ int main(int argc, char **argv)
if (argc > 2)
audio_format = ParseAudioFormat(argv[2], false);
- std::unique_ptr<Encoder> encoder(p_encoder->Open(audio_format, error));
- if (encoder == nullptr) {
- LogError(error, "Failed to open encoder");
- return EXIT_FAILURE;
- }
+ std::unique_ptr<Encoder> encoder(p_encoder->Open(audio_format));
StdioOutputStream os(stdout);
@@ -89,19 +83,11 @@ int main(int argc, char **argv)
ssize_t nbytes;
while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
- if (!encoder->Write(buffer, nbytes, error)) {
- LogError(error, "encoder_write() failed");
- return EXIT_FAILURE;
- }
-
+ encoder->Write(buffer, nbytes);
EncoderToOutputStream(os, *encoder);
}
- if (!encoder->End(error)) {
- LogError(error, "encoder_flush() failed");
- return EXIT_FAILURE;
- }
-
+ encoder->End();
EncoderToOutputStream(os, *encoder);
return EXIT_SUCCESS;