aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-04 08:41:16 +0100
committerMax Kellermann <max@duempel.org>2013-01-04 09:41:45 +0100
commite12cc01aa4b25798a2887ac6c5e01309e744ea8b (patch)
treecbf58024a0fb6d470a87c420ddcdf0ac2f0f15d6
parent71c697288b2325011f7302437aac912e88d6b6b4 (diff)
downloadmpd-e12cc01aa4b25798a2887ac6c5e01309e744ea8b.tar.gz
mpd-e12cc01aa4b25798a2887ac6c5e01309e744ea8b.tar.xz
mpd-e12cc01aa4b25798a2887ac6c5e01309e744ea8b.zip
decoder_*: convert to C++
-rw-r--r--Makefile.am10
-rw-r--r--src/DecoderAPI.cxx (renamed from src/decoder_api.c)26
-rw-r--r--src/DecoderControl.cxx (renamed from src/decoder_control.c)9
-rw-r--r--src/DecoderControl.hxx (renamed from src/decoder_control.h)6
-rw-r--r--src/DecoderInternal.cxx (renamed from src/decoder_internal.c)12
-rw-r--r--src/DecoderInternal.hxx (renamed from src/decoder_internal.h)6
-rw-r--r--src/DecoderThread.cxx4
-rw-r--r--src/PlayerControl.cxx (renamed from src/player_control.c)14
-rw-r--r--src/PlayerThread.cxx2
9 files changed, 48 insertions, 41 deletions
diff --git a/Makefile.am b/Makefile.am
index 250a1998c..12841d02d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,13 +70,11 @@ mpd_headers = \
src/idle.h \
src/conf.h \
src/crossfade.h \
- src/decoder_control.h \
src/decoder_plugin.h \
src/decoder_command.h \
src/decoder_buffer.h \
src/decoder_api.h \
src/decoder_plugin.h \
- src/decoder_internal.h \
src/encoder_plugin.h \
src/encoder_list.h \
src/encoder_api.h \
@@ -207,9 +205,9 @@ src_mpd_SOURCES = \
src/cue/cue_parser.c src/cue/cue_parser.h \
src/decoder_error.h \
src/DecoderThread.cxx src/DecoderThread.hxx \
- src/decoder_control.c \
- src/decoder_api.c \
- src/decoder_internal.c \
+ src/DecoderControl.cxx src/DecoderControl.hxx \
+ src/DecoderAPI.cxx \
+ src/DecoderInternal.cxx src/DecoderInternal.hxx \
src/DecoderPrint.cxx src/DecoderPrint.hxx \
src/Directory.cxx src/Directory.hxx \
src/DirectorySave.cxx src/DirectorySave.hxx \
@@ -274,7 +272,7 @@ src_mpd_SOURCES = \
src/page.c \
src/Permission.cxx src/Permission.hxx \
src/PlayerThread.cxx src/PlayerThread.hxx \
- src/player_control.c \
+ src/PlayerControl.cxx \
src/playlist.c \
src/playlist_global.c \
src/playlist_control.c \
diff --git a/src/decoder_api.c b/src/DecoderAPI.cxx
index a45d0f1e6..738e71842 100644
--- a/src/decoder_api.c
+++ b/src/DecoderAPI.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,15 +18,19 @@
*/
#include "config.h"
+
+extern "C" {
#include "decoder_api.h"
-#include "decoder_internal.h"
-#include "decoder_control.h"
#include "audio_config.h"
-#include "song.h"
#include "buffer.h"
#include "pipe.h"
#include "chunk.h"
#include "replay_gain_config.h"
+}
+
+#include "DecoderControl.hxx"
+#include "DecoderInternal.hxx"
+#include "song.h"
#include <glib.h>
@@ -362,11 +366,10 @@ update_stream_tag(struct decoder *decoder, struct input_stream *is)
enum decoder_command
decoder_data(struct decoder *decoder,
struct input_stream *is,
- const void *_data, size_t length,
+ const void *data, size_t length,
uint16_t kbit_rate)
{
struct decoder_control *dc = decoder->dc;
- const char *data = _data;
GError *error = NULL;
enum decoder_command cmd;
@@ -417,7 +420,6 @@ decoder_data(struct decoder *decoder,
while (length > 0) {
struct music_chunk *chunk;
- char *dest;
size_t nbytes;
bool full;
@@ -427,10 +429,10 @@ decoder_data(struct decoder *decoder,
return dc->command;
}
- dest = music_chunk_write(chunk, &dc->out_audio_format,
- decoder->timestamp -
- dc->song->start_ms / 1000.0,
- kbit_rate, &nbytes);
+ void *dest = music_chunk_write(chunk, &dc->out_audio_format,
+ decoder->timestamp -
+ dc->song->start_ms / 1000.0,
+ kbit_rate, &nbytes);
if (dest == NULL) {
/* the chunk is full, flush it */
decoder_flush_chunk(decoder);
@@ -456,7 +458,7 @@ decoder_data(struct decoder *decoder,
g_cond_signal(dc->client_cond);
}
- data += nbytes;
+ data = (const uint8_t *)data + nbytes;
length -= nbytes;
decoder->timestamp += (double)nbytes /
diff --git a/src/decoder_control.c b/src/DecoderControl.cxx
index 33d4e4d44..bd075ed71 100644
--- a/src/decoder_control.c
+++ b/src/DecoderControl.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,10 +18,13 @@
*/
#include "config.h"
-#include "decoder_control.h"
-#include "pipe.h"
+#include "DecoderControl.hxx"
#include "song.h"
+extern "C" {
+#include "pipe.h"
+}
+
#include <assert.h>
#undef G_LOG_DOMAIN
diff --git a/src/decoder_control.h b/src/DecoderControl.hxx
index 9ecbde73e..f98a604fa 100644
--- a/src/decoder_control.h
+++ b/src/DecoderControl.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
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_DECODER_CONTROL_H
-#define MPD_DECODER_CONTROL_H
+#ifndef MPD_DECODER_CONTROL_HXX
+#define MPD_DECODER_CONTROL_HXX
#include "decoder_command.h"
#include "audio_format.h"
diff --git a/src/decoder_internal.c b/src/DecoderInternal.cxx
index bc349f2ff..ab496dbd3 100644
--- a/src/decoder_internal.c
+++ b/src/DecoderInternal.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,11 +18,15 @@
*/
#include "config.h"
-#include "decoder_internal.h"
-#include "decoder_control.h"
+#include "DecoderInternal.hxx"
+#include "DecoderControl.hxx"
+
+extern "C" {
#include "pipe.h"
-#include "input_stream.h"
#include "buffer.h"
+}
+
+#include "input_stream.h"
#include "chunk.h"
#include <assert.h>
diff --git a/src/decoder_internal.h b/src/DecoderInternal.hxx
index 5bc7e216d..698e90bf1 100644
--- a/src/decoder_internal.h
+++ b/src/DecoderInternal.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
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_DECODER_INTERNAL_H
-#define MPD_DECODER_INTERNAL_H
+#ifndef MPD_DECODER_INTERNAL_HXX
+#define MPD_DECODER_INTERNAL_HXX
#include "decoder_command.h"
#include "pcm_convert.h"
diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx
index cbdb19188..f6f8437ab 100644
--- a/src/DecoderThread.cxx
+++ b/src/DecoderThread.cxx
@@ -19,6 +19,8 @@
#include "config.h"
#include "DecoderThread.hxx"
+#include "DecoderControl.hxx"
+#include "DecoderInternal.hxx"
#include "decoder_error.h"
#include "decoder_plugin.h"
#include "song.h"
@@ -26,8 +28,6 @@
#include "Mapper.hxx"
extern "C" {
-#include "decoder_control.h"
-#include "decoder_internal.h"
#include "decoder_list.h"
#include "decoder_api.h"
#include "replay_gain_ape.h"
diff --git a/src/player_control.c b/src/PlayerControl.cxx
index 5a16520c2..07749b7f0 100644
--- a/src/player_control.c
+++ b/src/PlayerControl.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,14 +18,14 @@
*/
#include "config.h"
+
+extern "C" {
#include "player_control.h"
-#include "decoder_control.h"
-#include "path.h"
-#include "log.h"
-#include "tag.h"
-#include "song.h"
#include "idle.h"
-#include "pcm_volume.h"
+}
+
+#include "song.h"
+#include "DecoderControl.hxx"
#include "Main.hxx"
#include <assert.h>
diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx
index ad7a008db..9e5c6042b 100644
--- a/src/PlayerThread.cxx
+++ b/src/PlayerThread.cxx
@@ -20,13 +20,13 @@
#include "config.h"
#include "PlayerThread.hxx"
#include "DecoderThread.hxx"
+#include "DecoderControl.hxx"
#include "song.h"
#include "Main.hxx"
#include "mpd_error.h"
extern "C" {
#include "player_control.h"
-#include "decoder_control.h"
#include "output_all.h"
#include "event_pipe.h"
#include "crossfade.h"