aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-11-11 16:15:38 +0100
committerMax Kellermann <max@duempel.org>2013-11-13 21:06:33 +0100
commitd2679f59c5a6c8df7a2140d40ab65a17b8e5c023 (patch)
tree803edccbb6c7d383199eba5f91a8610ee3c63c96 /test
parent4ee147ea34057c0bcef31afed55f98b025b997dc (diff)
downloadmpd-d2679f59c5a6c8df7a2140d40ab65a17b8e5c023.tar.gz
mpd-d2679f59c5a6c8df7a2140d40ab65a17b8e5c023.tar.xz
mpd-d2679f59c5a6c8df7a2140d40ab65a17b8e5c023.zip
PcmConvert: add methods Open(), Close()
Replaces Reset() and eliminates the AudioFormat parameters from the Convert() method.
Diffstat (limited to 'test')
-rw-r--r--test/run_convert.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/run_convert.cxx b/test/run_convert.cxx
index 0e873a3b3..d9a1b7f08 100644
--- a/test/run_convert.cxx
+++ b/test/run_convert.cxx
@@ -90,6 +90,11 @@ int main(int argc, char **argv)
const size_t in_frame_size = in_audio_format.GetFrameSize();
PcmConvert state;
+ if (!state.Open(in_audio_format, out_audio_format_mask, error)) {
+ g_printerr("Failed to open PcmConvert: %s\n",
+ error.GetMessage());
+ return EXIT_FAILURE;
+ }
FifoBuffer<uint8_t, 4096> buffer;
@@ -115,9 +120,10 @@ int main(int argc, char **argv)
buffer.Consume(src.size);
size_t length;
- output = state.Convert(in_audio_format, src.data, src.size,
- out_audio_format, &length, error);
+ output = state.Convert(src.data, src.size,
+ &length, error);
if (output == NULL) {
+ state.Close();
g_printerr("Failed to convert: %s\n", error.GetMessage());
return 2;
}
@@ -125,5 +131,7 @@ int main(int argc, char **argv)
gcc_unused ssize_t ignored = write(1, output, length);
}
+ state.Close();
+
return EXIT_SUCCESS;
}