aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-30 21:27:37 +0100
committerMax Kellermann <max@duempel.org>2013-01-30 21:39:43 +0100
commitcfeeb7af2e398b94db6db84c208976588d8cfcda (patch)
tree19635e8dc5fdcd54ff838def22e74de5ffffb13e
parentac887d3afb9aba509ddf2da034e089e86b761c3d (diff)
test/run_encoder, ...: convert to C++
-rw-r--r--Makefile.am6
-rw-r--r--src/audio_parser.h8
-rw-r--r--src/pcm_volume.h8
-rw-r--r--test/run_convert.cxx (renamed from test/run_convert.c)2
-rw-r--r--test/run_encoder.cxx (renamed from test/run_encoder.c)4
-rw-r--r--test/software_volume.cxx (renamed from test/software_volume.c)5
6 files changed, 25 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index 167b6176..357416a0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1257,7 +1257,7 @@ endif
if ENABLE_ENCODER
noinst_PROGRAMS += test/run_encoder
-test_run_encoder_SOURCES = test/run_encoder.c \
+test_run_encoder_SOURCES = test/run_encoder.cxx \
test/stdbin.h \
src/tokenizer.c src/utils.c src/string_util.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx \
@@ -1295,7 +1295,7 @@ test_test_vorbis_encoder_LDADD = $(MPD_LIBS) \
$(GLIB_LIBS)
endif
-test_software_volume_SOURCES = test/software_volume.c \
+test_software_volume_SOURCES = test/software_volume.cxx \
test/stdbin.h \
src/audio_check.c \
src/audio_parser.c
@@ -1311,7 +1311,7 @@ test_run_normalize_SOURCES = test/run_normalize.c \
test_run_normalize_LDADD = \
$(GLIB_LIBS)
-test_run_convert_SOURCES = test/run_convert.c \
+test_run_convert_SOURCES = test/run_convert.cxx \
src/dsd2pcm/dsd2pcm.c \
src/audio_format.c \
src/audio_check.c \
diff --git a/src/audio_parser.h b/src/audio_parser.h
index 49926999..bbe868f6 100644
--- a/src/audio_parser.h
+++ b/src/audio_parser.h
@@ -31,6 +31,10 @@
struct audio_format;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Parses a string in the form "SAMPLE_RATE:BITS:CHANNELS" into an
* #audio_format.
@@ -46,4 +50,8 @@ bool
audio_format_parse(struct audio_format *dest, const char *src,
bool mask, GError **error_r);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/pcm_volume.h b/src/pcm_volume.h
index 4a4a4e45..c161a72c 100644
--- a/src/pcm_volume.h
+++ b/src/pcm_volume.h
@@ -65,6 +65,10 @@ pcm_volume_dither(void)
return (r & 511) - ((r >> 9) & 511);
}
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Adjust the volume of the specified PCM buffer.
*
@@ -79,4 +83,8 @@ pcm_volume(void *buffer, size_t length,
enum sample_format format,
int volume);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/test/run_convert.c b/test/run_convert.cxx
index bdb3d2cf..a71ebc2c 100644
--- a/test/run_convert.c
+++ b/test/run_convert.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_encoder.c b/test/run_encoder.cxx
index db4d3af9..6a141296 100644
--- a/test/run_encoder.c
+++ b/test/run_encoder.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -51,7 +51,6 @@ int main(int argc, char **argv)
struct encoder *encoder;
struct config_param *param;
static char buffer[32768];
- ssize_t nbytes;
/* parse command line */
@@ -110,6 +109,7 @@ int main(int argc, char **argv)
/* do it */
+ ssize_t nbytes;
while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
ret = encoder_write(encoder, buffer, nbytes, &error);
if (!ret) {
diff --git a/test/software_volume.c b/test/software_volume.cxx
index 2357da67..18068665 100644
--- a/test/software_volume.c
+++ b/test/software_volume.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -59,7 +59,8 @@ int main(int argc, char **argv)
audio_format_init(&audio_format, 48000, SAMPLE_FORMAT_S16, 2);
while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
- if (!pcm_volume(buffer, nbytes, audio_format.format,
+ if (!pcm_volume(buffer, nbytes,
+ sample_format(audio_format.format),
PCM_VOLUME_1 / 2)) {
g_printerr("pcm_volume() has failed\n");
return 2;