aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-07-28 13:10:05 +0200
committerMax Kellermann <max@duempel.org>2013-07-28 13:10:05 +0200
commit6b6d9e64bda0ab19a3f6f13957f6625ba35c1d08 (patch)
treee9caa4738949a88fc736c37bb98f572a29ede31e
parentf016a99f2447e68d19dcccc68ecc47d12ac32e5b (diff)
downloadmpd-6b6d9e64bda0ab19a3f6f13957f6625ba35c1d08.tar.gz
mpd-6b6d9e64bda0ab19a3f6f13957f6625ba35c1d08.tar.xz
mpd-6b6d9e64bda0ab19a3f6f13957f6625ba35c1d08.zip
decoder/pcm: convert to C++
Diffstat (limited to '')
-rw-r--r--Makefile.am4
-rw-r--r--src/DecoderList.cxx2
-rw-r--r--src/decoder/PcmDecoderPlugin.cxx (renamed from src/decoder/pcm_decoder_plugin.c)34
-rw-r--r--src/decoder/PcmDecoderPlugin.hxx (renamed from src/decoder/pcm_decoder_plugin.h)6
4 files changed, 28 insertions, 18 deletions
diff --git a/Makefile.am b/Makefile.am
index 919da1be8..376ebe88c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,7 +68,6 @@ mpd_headers = \
src/gerror.h \
src/glib_compat.h \
src/gcc.h \
- src/decoder/pcm_decoder_plugin.h \
src/input_stream.h \
src/TextInputStream.hxx \
src/ls.h \
@@ -447,7 +446,8 @@ endif
# decoder plugins
libdecoder_plugins_a_SOURCES = \
- src/decoder/pcm_decoder_plugin.c \
+ src/decoder/PcmDecoderPlugin.cxx \
+ src/decoder/PcmDecoderPlugin.hxx \
src/decoder/DsdiffDecoderPlugin.cxx \
src/decoder/DsdiffDecoderPlugin.hxx \
src/decoder/DsfDecoderPlugin.cxx \
diff --git a/src/DecoderList.cxx b/src/DecoderList.cxx
index 3964a12f0..241997817 100644
--- a/src/DecoderList.cxx
+++ b/src/DecoderList.cxx
@@ -23,7 +23,7 @@
#include "conf.h"
#include "mpd_error.h"
#include "decoder/AudiofileDecoderPlugin.hxx"
-#include "decoder/pcm_decoder_plugin.h"
+#include "decoder/PcmDecoderPlugin.hxx"
#include "decoder/DsdiffDecoderPlugin.hxx"
#include "decoder/DsfDecoderPlugin.hxx"
#include "decoder/FlacDecoderPlugin.h"
diff --git a/src/decoder/pcm_decoder_plugin.c b/src/decoder/PcmDecoderPlugin.cxx
index d529cef5c..a1c965bbb 100644
--- a/src/decoder/pcm_decoder_plugin.c
+++ b/src/decoder/PcmDecoderPlugin.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
@@ -18,9 +18,12 @@
*/
#include "config.h"
-#include "decoder/pcm_decoder_plugin.h"
+#include "decoder/PcmDecoderPlugin.hxx"
#include "decoder_api.h"
+
+extern "C" {
#include "util/byte_reverse.h"
+}
#include <glib.h>
#include <unistd.h>
@@ -32,17 +35,17 @@
static void
pcm_stream_decode(struct decoder *decoder, struct input_stream *is)
{
- static const struct audio_format audio_format = {
- .sample_rate = 44100,
- .format = SAMPLE_FORMAT_S16,
- .channels = 2,
+ static constexpr struct audio_format audio_format = {
+ 44100,
+ SAMPLE_FORMAT_S16,
+ 2,
};
const char *const mime = input_stream_get_mime_type(is);
- const bool reverse_endian = mime != NULL &&
+ const bool reverse_endian = mime != nullptr &&
strcmp(mime, "audio/x-mpd-cdda-pcm-reverse") == 0;
- GError *error = NULL;
+ GError *error = nullptr;
enum decoder_command cmd;
double time_to_size = audio_format_time_to_size(&audio_format);
@@ -98,11 +101,18 @@ static const char *const pcm_mime_types[] = {
/* same as above, but with reverse byte order */
"audio/x-mpd-cdda-pcm-reverse",
- NULL
+ nullptr
};
const struct decoder_plugin pcm_decoder_plugin = {
- .name = "pcm",
- .stream_decode = pcm_stream_decode,
- .mime_types = pcm_mime_types,
+ "pcm",
+ nullptr,
+ nullptr,
+ pcm_stream_decode,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ pcm_mime_types,
};
diff --git a/src/decoder/pcm_decoder_plugin.h b/src/decoder/PcmDecoderPlugin.hxx
index 11df80155..2883e866e 100644
--- a/src/decoder/pcm_decoder_plugin.h
+++ b/src/decoder/PcmDecoderPlugin.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
@@ -25,8 +25,8 @@
* which does not need a decoder.
*/
-#ifndef MPD_DECODER_PCM_H
-#define MPD_DECODER_PCM_H
+#ifndef MPD_DECODER_PCM_HXX
+#define MPD_DECODER_PCM_HXX
extern const struct decoder_plugin pcm_decoder_plugin;