aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/run_convert.cxx11
-rw-r--r--test/run_output.cxx22
2 files changed, 13 insertions, 20 deletions
diff --git a/test/run_convert.cxx b/test/run_convert.cxx
index 1e54f2d35..e66d0be2b 100644
--- a/test/run_convert.cxx
+++ b/test/run_convert.cxx
@@ -26,7 +26,7 @@
#include "config.h"
#include "AudioParser.hxx"
#include "audio_format.h"
-#include "pcm_convert.h"
+#include "PcmConvert.hxx"
#include "conf.h"
#include "util/fifo_buffer.h"
#include "stdbin.h"
@@ -58,7 +58,6 @@ int main(int argc, char **argv)
{
GError *error = NULL;
struct audio_format in_audio_format, out_audio_format;
- struct pcm_convert_state state;
const void *output;
ssize_t nbytes;
size_t length;
@@ -90,7 +89,7 @@ int main(int argc, char **argv)
const size_t in_frame_size = audio_format_frame_size(&in_audio_format);
- pcm_convert_init(&state);
+ PcmConvert state;
struct fifo_buffer *buffer = fifo_buffer_new(4096);
@@ -113,8 +112,8 @@ int main(int argc, char **argv)
fifo_buffer_consume(buffer, length);
- output = pcm_convert(&state, &in_audio_format, src, length,
- &out_audio_format, &length, &error);
+ output = state.Convert(&in_audio_format, src, length,
+ &out_audio_format, &length, &error);
if (output == NULL) {
g_printerr("Failed to convert: %s\n", error->message);
return 2;
@@ -123,5 +122,5 @@ int main(int argc, char **argv)
G_GNUC_UNUSED ssize_t ignored = write(1, output, length);
}
- pcm_convert_deinit(&state);
+ return EXIT_SUCCESS;
}
diff --git a/test/run_output.cxx b/test/run_output.cxx
index e9daf3c1c..f76e6fc76 100644
--- a/test/run_output.cxx
+++ b/test/run_output.cxx
@@ -27,12 +27,12 @@
#include "IOThread.hxx"
#include "fs/Path.hxx"
#include "AudioParser.hxx"
+#include "PcmConvert.hxx"
extern "C" {
#include "output_plugin.h"
#include "output_internal.h"
#include "filter_registry.h"
-#include "pcm_convert.h"
}
#include "PlayerControl.hxx"
@@ -52,21 +52,15 @@ GlobalEvents::Emit(gcc_unused Event event)
{
}
-void pcm_convert_init(G_GNUC_UNUSED struct pcm_convert_state *state)
-{
-}
-
-void pcm_convert_deinit(G_GNUC_UNUSED struct pcm_convert_state *state)
-{
-}
+PcmConvert::PcmConvert() {}
+PcmConvert::~PcmConvert() {}
const void *
-pcm_convert(G_GNUC_UNUSED struct pcm_convert_state *state,
- G_GNUC_UNUSED const struct audio_format *src_format,
- G_GNUC_UNUSED const void *src, G_GNUC_UNUSED size_t src_size,
- G_GNUC_UNUSED const struct audio_format *dest_format,
- G_GNUC_UNUSED size_t *dest_size_r,
- GError **error_r)
+PcmConvert::Convert(gcc_unused const audio_format *src_format,
+ gcc_unused const void *src, gcc_unused size_t src_size,
+ gcc_unused const audio_format *dest_format,
+ gcc_unused size_t *dest_size_r,
+ gcc_unused GError **error_r)
{
g_set_error(error_r, pcm_convert_quark(), 0,
"Not implemented");