aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-30 23:40:56 +0100
committerMax Kellermann <max@duempel.org>2013-01-31 00:26:55 +0100
commit361404fd59e817560e4564f15466e94c2a0d7551 (patch)
tree2e8eab59d93b24e496576be0ccdcfc3bf70d54bf /test
parent762c91b7f1024ff81d3dd39b217995d817030ef8 (diff)
pcm_convert: convert to C++
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 1e54f2d3..e66d0be2 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 e9daf3c1..f76e6fc7 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");