aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-07-28 13:04:12 +0200
committerMax Kellermann <max@duempel.org>2013-07-28 13:04:12 +0200
commitf016a99f2447e68d19dcccc68ecc47d12ac32e5b (patch)
treed3253211e4ce4b4e4a9f5953e08074b09566b8e7
parent2eed9d64ce89071e0f1221931c789efabc48f0ae (diff)
downloadmpd-f016a99f2447e68d19dcccc68ecc47d12ac32e5b.tar.gz
mpd-f016a99f2447e68d19dcccc68ecc47d12ac32e5b.tar.xz
mpd-f016a99f2447e68d19dcccc68ecc47d12ac32e5b.zip
decoder/mpcdec: convert to C++
-rw-r--r--Makefile.am4
-rw-r--r--src/DecoderList.cxx2
-rw-r--r--src/decoder/MpcdecDecoderPlugin.cxx (renamed from src/decoder/mpcdec_decoder_plugin.c)27
-rw-r--r--src/decoder/MpcdecDecoderPlugin.hxx25
4 files changed, 46 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am
index bb5cc4f6a..919da1be8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -510,7 +510,9 @@ libdecoder_plugins_a_SOURCES += \
endif
if HAVE_MPCDEC
-libdecoder_plugins_a_SOURCES += src/decoder/mpcdec_decoder_plugin.c
+libdecoder_plugins_a_SOURCES += \
+ src/decoder/MpcdecDecoderPlugin.cxx \
+ src/decoder/MpcdecDecoderPlugin.hxx
endif
if HAVE_OPUS
diff --git a/src/DecoderList.cxx b/src/DecoderList.cxx
index 562e25a18..3964a12f0 100644
--- a/src/DecoderList.cxx
+++ b/src/DecoderList.cxx
@@ -40,12 +40,12 @@
#include "decoder/WildmidiDecoderPlugin.hxx"
#include "decoder/MikmodDecoderPlugin.hxx"
#include "decoder/ModplugDecoderPlugin.hxx"
+#include "decoder/MpcdecDecoderPlugin.hxx"
#include <glib.h>
#include <string.h>
-extern const struct decoder_plugin mpcdec_decoder_plugin;
extern const struct decoder_plugin sidplay_decoder_plugin;
extern const struct decoder_plugin fluidsynth_decoder_plugin;
diff --git a/src/decoder/mpcdec_decoder_plugin.c b/src/decoder/MpcdecDecoderPlugin.cxx
index 77db2416b..36cf620c6 100644
--- a/src/decoder/mpcdec_decoder_plugin.c
+++ b/src/decoder/MpcdecDecoderPlugin.cxx
@@ -18,6 +18,7 @@
*/
#include "config.h"
+#include "MpcdecDecoderPlugin.hxx"
#include "decoder_api.h"
#include "audio_check.h"
#include "tag_handler.h"
@@ -62,7 +63,7 @@ mpc_seek_cb(cb_first_arg, mpc_int32_t offset)
{
struct mpc_decoder_data *data = (struct mpc_decoder_data *) cb_data;
- return input_stream_lock_seek(data->is, offset, SEEK_SET, NULL);
+ return input_stream_lock_seek(data->is, offset, SEEK_SET, nullptr);
}
static mpc_int32_t
@@ -144,7 +145,7 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is)
#endif
mpc_reader reader;
mpc_streaminfo info;
- GError *error = NULL;
+ GError *error = nullptr;
struct audio_format audio_format;
struct mpc_decoder_data data;
@@ -185,7 +186,7 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is)
}
#else
demux = mpc_demux_init(&reader);
- if (demux == NULL) {
+ if (demux == nullptr) {
if (decoder_get_command(mpd_decoder) != DECODE_COMMAND_STOP)
g_warning("Not a valid musepack stream");
return;
@@ -296,7 +297,7 @@ mpcdec_get_file_duration(struct input_stream *is)
struct mpc_decoder_data data;
data.is = is;
- data.decoder = NULL;
+ data.decoder = nullptr;
reader.read = mpc_read_cb;
reader.seek = mpc_seek_cb;
@@ -312,7 +313,7 @@ mpcdec_get_file_duration(struct input_stream *is)
return -1;
#else
demux = mpc_demux_init(&reader);
- if (demux == NULL)
+ if (demux == nullptr)
return -1;
mpc_demux_get_info(demux, &info);
@@ -337,11 +338,17 @@ mpcdec_scan_stream(struct input_stream *is,
return true;
}
-static const char *const mpcdec_suffixes[] = { "mpc", NULL };
+static const char *const mpcdec_suffixes[] = { "mpc", nullptr };
const struct decoder_plugin mpcdec_decoder_plugin = {
- .name = "mpcdec",
- .stream_decode = mpcdec_decode,
- .scan_stream = mpcdec_scan_stream,
- .suffixes = mpcdec_suffixes,
+ "mpcdec",
+ nullptr,
+ nullptr,
+ mpcdec_decode,
+ nullptr,
+ nullptr,
+ mpcdec_scan_stream,
+ nullptr,
+ mpcdec_suffixes,
+ nullptr,
};
diff --git a/src/decoder/MpcdecDecoderPlugin.hxx b/src/decoder/MpcdecDecoderPlugin.hxx
new file mode 100644
index 000000000..7e9b51cdb
--- /dev/null
+++ b/src/decoder/MpcdecDecoderPlugin.hxx
@@ -0,0 +1,25 @@
+/*
+ * 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
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPD_DECODER_MPCDEC_HXX
+#define MPD_DECODER_MPCDEC_HXX
+
+extern const struct decoder_plugin mpcdec_decoder_plugin;
+
+#endif