aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/DecoderList.cxx2
-rw-r--r--src/decoder/Mpg123DecoderPlugin.cxx (renamed from src/decoder/mpg123_decoder_plugin.c)33
-rw-r--r--src/decoder/Mpg123DecoderPlugin.hxx25
3 files changed, 45 insertions, 15 deletions
diff --git a/src/DecoderList.cxx b/src/DecoderList.cxx
index 4e7ac211a..e607b685d 100644
--- a/src/DecoderList.cxx
+++ b/src/DecoderList.cxx
@@ -36,12 +36,12 @@
#include "decoder/FaadDecoderPlugin.hxx"
#include "decoder/MadDecoderPlugin.hxx"
#include "decoder/SndfileDecoderPlugin.hxx"
+#include "decoder/Mpg123DecoderPlugin.hxx"
#include <glib.h>
#include <string.h>
-extern const struct decoder_plugin mpg123_decoder_plugin;
extern const struct decoder_plugin mpcdec_decoder_plugin;
extern const struct decoder_plugin modplug_decoder_plugin;
extern const struct decoder_plugin mikmod_decoder_plugin;
diff --git a/src/decoder/mpg123_decoder_plugin.c b/src/decoder/Mpg123DecoderPlugin.cxx
index 657a9c889..f43aa5dea 100644
--- a/src/decoder/mpg123_decoder_plugin.c
+++ b/src/decoder/Mpg123DecoderPlugin.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,6 +18,7 @@
*/
#include "config.h" /* must be first for large file support */
+#include "Mpg123DecoderPlugin.hxx"
#include "decoder_api.h"
#include "audio_check.h"
#include "tag_handler.h"
@@ -57,7 +58,7 @@ static bool
mpd_mpg123_open(mpg123_handle *handle, const char *path_fs,
struct audio_format *audio_format)
{
- GError *gerror = NULL;
+ GError *gerror = nullptr;
char *path_dup;
int error;
int channels, encoding;
@@ -111,8 +112,8 @@ mpd_mpg123_file_decode(struct decoder *decoder, const char *path_fs)
/* open the file */
- handle = mpg123_new(NULL, &error);
- if (handle == NULL) {
+ handle = mpg123_new(nullptr, &error);
+ if (handle == nullptr) {
g_warning("mpg123_new() failed: %s",
mpg123_plain_strerror(error));
return;
@@ -172,7 +173,7 @@ mpd_mpg123_file_decode(struct decoder *decoder, const char *path_fs)
/* send to MPD */
- cmd = decoder_data(decoder, NULL, buffer, nbytes, info.bitrate);
+ cmd = decoder_data(decoder, nullptr, buffer, nbytes, info.bitrate);
if (cmd == DECODE_COMMAND_SEEK) {
off_t c = decoder_seek_where(decoder)*audio_format.sample_rate;
@@ -202,8 +203,8 @@ mpd_mpg123_scan_file(const char *path_fs,
int error;
off_t num_samples;
- handle = mpg123_new(NULL, &error);
- if (handle == NULL) {
+ handle = mpg123_new(nullptr, &error);
+ if (handle == nullptr) {
g_warning("mpg123_new() failed: %s",
mpg123_plain_strerror(error));
return false;
@@ -231,15 +232,19 @@ mpd_mpg123_scan_file(const char *path_fs,
static const char *const mpg123_suffixes[] = {
"mp3",
- NULL
+ nullptr
};
const struct decoder_plugin mpg123_decoder_plugin = {
- .name = "mpg123",
- .init = mpd_mpg123_init,
- .finish = mpd_mpg123_finish,
- .file_decode = mpd_mpg123_file_decode,
+ "mpg123",
+ mpd_mpg123_init,
+ mpd_mpg123_finish,
/* streaming not yet implemented */
- .scan_file = mpd_mpg123_scan_file,
- .suffixes = mpg123_suffixes,
+ nullptr,
+ mpd_mpg123_file_decode,
+ mpd_mpg123_scan_file,
+ nullptr,
+ nullptr,
+ mpg123_suffixes,
+ nullptr,
};
diff --git a/src/decoder/Mpg123DecoderPlugin.hxx b/src/decoder/Mpg123DecoderPlugin.hxx
new file mode 100644
index 000000000..273b03eaf
--- /dev/null
+++ b/src/decoder/Mpg123DecoderPlugin.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_MPG123_HXX
+#define MPD_DECODER_MPG123_HXX
+
+extern const struct decoder_plugin mpg123_decoder_plugin;
+
+#endif