aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-30 21:47:12 +0100
committerMax Kellermann <max@duempel.org>2013-01-30 21:47:12 +0100
commitd664baff2699842f2182968f5c26dbf63babdeff (patch)
tree387920b40478228d7c0ba0574c2415dd3ee91a8c
parent3275d4c6fa40c66c410bd279f3571ba36f95c4d6 (diff)
audio_{parser,config}: convert to C++
-rw-r--r--Makefile.am21
-rw-r--r--src/AudioCompress/compress.h9
-rw-r--r--src/AudioConfig.cxx (renamed from src/audio_config.c)6
-rw-r--r--src/AudioConfig.hxx (renamed from src/audio_config.h)4
-rw-r--r--src/AudioParser.cxx (renamed from src/audio_parser.c)2
-rw-r--r--src/AudioParser.hxx (renamed from src/audio_parser.h)16
-rw-r--r--src/DecoderAPI.cxx6
-rw-r--r--src/Main.cxx2
-rw-r--r--src/OutputInit.cxx2
-rw-r--r--src/audio_check.h8
-rw-r--r--test/run_convert.cxx2
-rw-r--r--test/run_encoder.cxx2
-rw-r--r--test/run_filter.cxx6
-rw-r--r--test/run_normalize.cxx (renamed from test/run_normalize.c)4
-rw-r--r--test/run_output.cxx2
-rw-r--r--test/software_volume.cxx2
16 files changed, 45 insertions, 49 deletions
diff --git a/Makefile.am b/Makefile.am
index 92c47423..17315e17 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,7 +54,6 @@ mpd_headers = \
src/ape.h \
src/audio_format.h \
src/audio_check.h \
- src/audio_parser.h \
src/output_internal.h \
src/output_api.h \
src/filter_internal.h \
@@ -132,10 +131,10 @@ src_mpd_SOURCES = \
src/thread/GLibCond.hxx \
src/clock.c src/clock.h \
src/notify.cxx src/notify.hxx \
- src/audio_config.c src/audio_config.h \
+ src/AudioConfig.cxx src/AudioConfig.hxx \
src/audio_check.c \
src/audio_format.c \
- src/audio_parser.c \
+ src/AudioParser.cxx src/AudioParser.hxx \
src/protocol/ArgParser.cxx src/protocol/ArgParser.hxx \
src/protocol/Result.cxx src/protocol/Result.hxx \
src/CommandError.cxx src/CommandError.hxx \
@@ -1244,7 +1243,7 @@ test_run_filter_SOURCES = test/run_filter.cxx \
src/tokenizer.c src/utils.c src/string_util.c \
src/audio_check.c \
src/audio_format.c \
- src/audio_parser.c \
+ src/AudioParser.cxx \
src/ReplayGainInfo.cxx \
src/AudioCompress/compress.c
@@ -1264,7 +1263,7 @@ test_run_encoder_SOURCES = test/run_encoder.cxx \
src/Tag.cxx src/TagNames.c src/TagPool.cxx \
src/audio_check.c \
src/audio_format.c \
- src/audio_parser.c
+ src/AudioParser.cxx
test_run_encoder_LDADD = \
$(ENCODER_LIBS) \
$(TAG_LIBS) \
@@ -1283,7 +1282,7 @@ test_test_vorbis_encoder_SOURCES = test/test_vorbis_encoder.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx \
src/audio_check.c \
src/audio_format.c \
- src/audio_parser.c \
+ src/AudioParser.cxx \
src/pcm_buffer.c \
$(ENCODER_SRC)
test_test_vorbis_encoder_CPPFLAGS = $(AM_CPPFLAGS) \
@@ -1299,15 +1298,15 @@ endif
test_software_volume_SOURCES = test/software_volume.cxx \
test/stdbin.h \
src/audio_check.c \
- src/audio_parser.c
+ src/AudioParser.cxx
test_software_volume_LDADD = \
$(PCM_LIBS) \
$(GLIB_LIBS)
-test_run_normalize_SOURCES = test/run_normalize.c \
+test_run_normalize_SOURCES = test/run_normalize.cxx \
test/stdbin.h \
src/audio_check.c \
- src/audio_parser.c \
+ src/AudioParser.cxx \
src/AudioCompress/compress.c
test_run_normalize_LDADD = \
$(GLIB_LIBS)
@@ -1316,7 +1315,7 @@ test_run_convert_SOURCES = test/run_convert.cxx \
src/dsd2pcm/dsd2pcm.c \
src/audio_format.c \
src/audio_check.c \
- src/audio_parser.c
+ src/AudioParser.cxx
test_run_convert_LDADD = \
$(PCM_LIBS) \
libutil.a \
@@ -1339,7 +1338,7 @@ test_run_output_SOURCES = test/run_output.cxx \
src/IOThread.cxx \
src/audio_check.c \
src/audio_format.c \
- src/audio_parser.c \
+ src/AudioParser.cxx \
src/timer.c src/clock.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx \
src/Page.cxx \
diff --git a/src/AudioCompress/compress.h b/src/AudioCompress/compress.h
index 073d4af9..8556d16b 100644
--- a/src/AudioCompress/compress.h
+++ b/src/AudioCompress/compress.h
@@ -19,6 +19,10 @@ struct CompressorConfig {
struct Compressor;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
//! Create a new compressor (use history value of 0 for default)
struct Compressor *Compressor_new(unsigned int history);
@@ -34,7 +38,12 @@ struct CompressorConfig *Compressor_getConfig(struct Compressor *);
//! Process 16-bit signed data
void Compressor_Process_int16(struct Compressor *, int16_t *data, unsigned int count);
+#ifdef __cplusplus
+}
+#endif
+
//! TODO: Compressor_Process_int32, Compressor_Process_float, others as needed
//! TODO: functions for getting at the peak/gain/clip history buffers (for monitoring)
+
#endif
diff --git a/src/audio_config.c b/src/AudioConfig.cxx
index bae3c184..e546aed2 100644
--- a/src/audio_config.c
+++ b/src/AudioConfig.cxx
@@ -18,14 +18,12 @@
*/
#include "config.h"
-#include "audio_config.h"
+#include "AudioConfig.hxx"
#include "audio_format.h"
-#include "audio_parser.h"
+#include "AudioParser.hxx"
#include "conf.h"
#include "mpd_error.h"
-#include <glib.h>
-
static struct audio_format configured_audio_format;
void getOutputAudioFormat(const struct audio_format *inAudioFormat,
diff --git a/src/audio_config.h b/src/AudioConfig.hxx
index fe43dbbc..717a8e2e 100644
--- a/src/audio_config.h
+++ b/src/AudioConfig.hxx
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_AUDIO_CONFIG_H
-#define MPD_AUDIO_CONFIG_H
+#ifndef MPD_AUDIO_CONFIG_HXX
+#define MPD_AUDIO_CONFIG_HXX
struct audio_format;
diff --git a/src/audio_parser.c b/src/AudioParser.cxx
index 152eab5d..9178c3e1 100644
--- a/src/audio_parser.c
+++ b/src/AudioParser.cxx
@@ -23,7 +23,7 @@
*/
#include "config.h"
-#include "audio_parser.h"
+#include "AudioParser.hxx"
#include "audio_format.h"
#include "audio_check.h"
#include "gcc.h"
diff --git a/src/audio_parser.h b/src/AudioParser.hxx
index bbe868f6..f7855e8e 100644
--- a/src/audio_parser.h
+++ b/src/AudioParser.hxx
@@ -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
@@ -22,19 +22,13 @@
* Parser functions for audio related objects.
*/
-#ifndef AUDIO_PARSER_H
-#define AUDIO_PARSER_H
+#ifndef MPD_AUDIO_PARSER_HXX
+#define MPD_AUDIO_PARSER_HXX
#include "gerror.h"
-#include <stdbool.h>
-
struct audio_format;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* Parses a string in the form "SAMPLE_RATE:BITS:CHANNELS" into an
* #audio_format.
@@ -50,8 +44,4 @@ bool
audio_format_parse(struct audio_format *dest, const char *src,
bool mask, GError **error_r);
-#ifdef __cplusplus
-}
-#endif
-
#endif
diff --git a/src/DecoderAPI.cxx b/src/DecoderAPI.cxx
index 29b39688..b68af19b 100644
--- a/src/DecoderAPI.cxx
+++ b/src/DecoderAPI.cxx
@@ -19,11 +19,7 @@
#include "config.h"
#include "decoder_api.h"
-
-extern "C" {
-#include "audio_config.h"
-}
-
+#include "AudioConfig.hxx"
#include "replay_gain_config.h"
#include "MusicChunk.hxx"
#include "MusicBuffer.hxx"
diff --git a/src/Main.cxx b/src/Main.cxx
index a22ee631..63a78d0e 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -51,11 +51,11 @@
#include "PlaylistRegistry.hxx"
#include "ZeroconfGlue.hxx"
#include "DecoderList.hxx"
+#include "AudioConfig.hxx"
extern "C" {
#include "daemon.h"
#include "stats.h"
-#include "audio_config.h"
#include "pcm_resample.h"
}
diff --git a/src/OutputInit.cxx b/src/OutputInit.cxx
index dfb246a0..0d3dd05a 100644
--- a/src/OutputInit.cxx
+++ b/src/OutputInit.cxx
@@ -22,10 +22,10 @@
#include "OutputList.hxx"
#include "FilterConfig.hxx"
#include "output_api.h"
+#include "AudioParser.hxx"
extern "C" {
#include "output_internal.h"
-#include "audio_parser.h"
#include "mixer_control.h"
#include "mixer_type.h"
#include "mixer_list.h"
diff --git a/src/audio_check.h b/src/audio_check.h
index e2302126..d4d3f13f 100644
--- a/src/audio_check.h
+++ b/src/audio_check.h
@@ -35,6 +35,10 @@ audio_format_quark(void)
return g_quark_from_static_string("audio_format");
}
+#ifdef __cplusplus
+extern "C" {
+#endif
+
bool
audio_check_sample_rate(unsigned long sample_rate, GError **error_r);
@@ -52,4 +56,8 @@ audio_format_init_checked(struct audio_format *af, unsigned long sample_rate,
enum sample_format sample_format, unsigned channels,
GError **error_r);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/test/run_convert.cxx b/test/run_convert.cxx
index a71ebc2c..1e54f2d3 100644
--- a/test/run_convert.cxx
+++ b/test/run_convert.cxx
@@ -24,7 +24,7 @@
*/
#include "config.h"
-#include "audio_parser.h"
+#include "AudioParser.hxx"
#include "audio_format.h"
#include "pcm_convert.h"
#include "conf.h"
diff --git a/test/run_encoder.cxx b/test/run_encoder.cxx
index 6a141296..3d500d0b 100644
--- a/test/run_encoder.cxx
+++ b/test/run_encoder.cxx
@@ -21,7 +21,7 @@
#include "encoder_list.h"
#include "encoder_plugin.h"
#include "audio_format.h"
-#include "audio_parser.h"
+#include "AudioParser.hxx"
#include "conf.h"
#include "stdbin.h"
diff --git a/test/run_filter.cxx b/test/run_filter.cxx
index dbf6caa9..87672adc 100644
--- a/test/run_filter.cxx
+++ b/test/run_filter.cxx
@@ -20,11 +20,7 @@
#include "config.h"
#include "conf.h"
#include "fs/Path.hxx"
-
-extern "C" {
-#include "audio_parser.h"
-}
-
+#include "AudioParser.hxx"
#include "audio_format.h"
#include "filter_plugin.h"
#include "pcm_volume.h"
diff --git a/test/run_normalize.c b/test/run_normalize.cxx
index fc26829e..070dbaf5 100644
--- a/test/run_normalize.c
+++ b/test/run_normalize.cxx
@@ -25,7 +25,7 @@
#include "config.h"
#include "AudioCompress/compress.h"
-#include "audio_parser.h"
+#include "AudioParser.hxx"
#include "audio_format.h"
#include "stdbin.h"
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
return 1;
}
} else
- audio_format_init(&audio_format, 48000, 16, 2);
+ audio_format_init(&audio_format, 48000, SAMPLE_FORMAT_S16, 2);
compressor = Compressor_new(0);
diff --git a/test/run_output.cxx b/test/run_output.cxx
index ec94beaa..e9daf3c1 100644
--- a/test/run_output.cxx
+++ b/test/run_output.cxx
@@ -26,11 +26,11 @@
#include "GlobalEvents.hxx"
#include "IOThread.hxx"
#include "fs/Path.hxx"
+#include "AudioParser.hxx"
extern "C" {
#include "output_plugin.h"
#include "output_internal.h"
-#include "audio_parser.h"
#include "filter_registry.h"
#include "pcm_convert.h"
}
diff --git a/test/software_volume.cxx b/test/software_volume.cxx
index 18068665..2579a4f0 100644
--- a/test/software_volume.cxx
+++ b/test/software_volume.cxx
@@ -25,7 +25,7 @@
#include "config.h"
#include "pcm_volume.h"
-#include "audio_parser.h"
+#include "AudioParser.hxx"
#include "audio_format.h"
#include "stdbin.h"