summaryrefslogtreecommitdiff
path: root/test/run_convert.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-10-28 21:46:20 +0200
committerMax Kellermann <max@musicpd.org>2016-10-28 22:36:04 +0200
commit13001c018c49931e258104c3e8fffa97fb3bb374 (patch)
tree0c12e356b016553c99739bb6cdffb9bbc9e50e58 /test/run_convert.cxx
parent1b39efb694fa1ff9924ef52e93c19b39a54e293f (diff)
AudioParser: throw exception on error
Diffstat (limited to 'test/run_convert.cxx')
-rw-r--r--test/run_convert.cxx20
1 files changed, 3 insertions, 17 deletions
diff --git a/test/run_convert.cxx b/test/run_convert.cxx
index a07e71f47..836eaadad 100644
--- a/test/run_convert.cxx
+++ b/test/run_convert.cxx
@@ -29,7 +29,6 @@
#include "pcm/PcmConvert.hxx"
#include "util/ConstBuffer.hxx"
#include "util/StaticFifoBuffer.hxx"
-#include "util/Error.hxx"
#include "Log.hxx"
#include <assert.h>
@@ -41,29 +40,16 @@
int
main(int argc, char **argv)
try {
- AudioFormat in_audio_format, out_audio_format;
-
if (argc != 3) {
fprintf(stderr,
"Usage: run_convert IN_FORMAT OUT_FORMAT <IN >OUT\n");
return 1;
}
- Error error;
- if (!audio_format_parse(in_audio_format, argv[1],
- false, error)) {
- LogError(error, "Failed to parse audio format");
- return EXIT_FAILURE;
- }
-
- AudioFormat out_audio_format_mask;
- if (!audio_format_parse(out_audio_format_mask, argv[2],
- true, error)) {
- LogError(error, "Failed to parse audio format");
- return EXIT_FAILURE;
- }
+ const auto in_audio_format = ParseAudioFormat(argv[1], false);
+ const auto out_audio_format_mask = ParseAudioFormat(argv[2], false);
- out_audio_format = in_audio_format;
+ auto out_audio_format = in_audio_format;
out_audio_format.ApplyMask(out_audio_format_mask);
const size_t in_frame_size = in_audio_format.GetFrameSize();