From d2679f59c5a6c8df7a2140d40ab65a17b8e5c023 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 11 Nov 2013 16:15:38 +0100 Subject: PcmConvert: add methods Open(), Close() Replaces Reset() and eliminates the AudioFormat parameters from the Convert() method. --- test/run_convert.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test') 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 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; } -- cgit v1.2.3