aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile.am6
-rw-r--r--src/DecoderThread.cxx (renamed from src/decoder_thread.c)30
-rw-r--r--src/DecoderThread.hxx (renamed from src/decoder_thread.h)6
-rw-r--r--src/Main.cxx2
-rw-r--r--src/PlayerThread.cxx (renamed from src/player_thread.c)49
-rw-r--r--src/PlayerThread.hxx (renamed from src/player_thread.h)6
-rw-r--r--src/decoder_internal.h7
7 files changed, 52 insertions, 54 deletions
diff --git a/Makefile.am b/Makefile.am
index 2b88016e5..5811dac95 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -72,7 +72,6 @@ mpd_headers = \
src/cmdline.h \
src/conf.h \
src/crossfade.h \
- src/decoder_thread.h \
src/decoder_control.h \
src/decoder_plugin.h \
src/decoder_command.h \
@@ -137,7 +136,6 @@ mpd_headers = \
src/output/httpd_internal.h \
src/page.h \
src/permission.h \
- src/player_thread.h \
src/player_control.h \
src/playlist.h \
src/playlist_error.h \
@@ -224,7 +222,7 @@ src_mpd_SOURCES = \
src/crossfade.c \
src/cue/cue_parser.c src/cue/cue_parser.h \
src/decoder_error.h \
- src/decoder_thread.c \
+ src/DecoderThread.cxx src/DecoderThread.hxx \
src/decoder_control.c \
src/decoder_api.c \
src/decoder_internal.c \
@@ -291,7 +289,7 @@ src_mpd_SOURCES = \
src/mapper.c \
src/page.c \
src/permission.c \
- src/player_thread.c \
+ src/PlayerThread.cxx src/PlayerThread.hxx \
src/player_control.c \
src/playlist.c \
src/playlist_global.c \
diff --git a/src/decoder_thread.c b/src/DecoderThread.cxx
index b13f2a46a..e5b582598 100644
--- a/src/decoder_thread.c
+++ b/src/DecoderThread.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,22 +18,23 @@
*/
#include "config.h"
-#include "decoder_thread.h"
+#include "DecoderThread.hxx"
#include "decoder_error.h"
+#include "decoder_plugin.h"
+#include "song.h"
+#include "mpd_error.h"
+
+extern "C" {
#include "decoder_control.h"
#include "decoder_internal.h"
#include "decoder_list.h"
-#include "decoder_plugin.h"
#include "decoder_api.h"
#include "replay_gain_ape.h"
#include "input_stream.h"
-#include "pipe.h"
-#include "song.h"
#include "tag.h"
#include "mapper.h"
-#include "path.h"
#include "uri.h"
-#include "mpd_error.h"
+}
#include <glib.h>
@@ -183,12 +184,7 @@ decoder_file_decode(const struct decoder_plugin *plugin,
static inline gpointer
deconst_plugin(const struct decoder_plugin *plugin)
{
- union {
- const struct decoder_plugin *in;
- gpointer out;
- } u = { .in = plugin };
-
- return u.out;
+ return const_cast<struct decoder_plugin *>(plugin);
}
/**
@@ -384,11 +380,7 @@ static void
decoder_run_song(struct decoder_control *dc,
const struct song *song, const char *uri)
{
- struct decoder decoder = {
- .dc = dc,
- .initial_seek_pending = dc->start_ms > 0,
- .initial_seek_running = false,
- };
+ decoder decoder(dc, dc->start_ms > 0);
int ret;
decoder.timestamp = 0.0;
@@ -477,7 +469,7 @@ decoder_run(struct decoder_control *dc)
static gpointer
decoder_task(gpointer arg)
{
- struct decoder_control *dc = arg;
+ struct decoder_control *dc = (struct decoder_control *)arg;
decoder_lock(dc);
diff --git a/src/decoder_thread.h b/src/DecoderThread.hxx
index 78f12a54a..8efaa2fca 100644
--- a/src/decoder_thread.h
+++ b/src/DecoderThread.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_THREAD_H
-#define MPD_DECODER_THREAD_H
+#ifndef MPD_DECODER_THREAD_HXX
+#define MPD_DECODER_THREAD_HXX
struct decoder_control;
diff --git a/src/Main.cxx b/src/Main.cxx
index 9a5fa1cd9..0d8f66d7e 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -23,6 +23,7 @@
#include "UpdateGlue.hxx"
#include "chunk.h"
#include "StateFile.hxx"
+#include "PlayerThread.hxx"
extern "C" {
#include "daemon.h"
@@ -33,7 +34,6 @@ extern "C" {
#include "AllCommands.h"
#include "playlist.h"
#include "database.h"
-#include "player_thread.h"
#include "listen.h"
#include "cmdline.h"
#include "conf.h"
diff --git a/src/player_thread.c b/src/PlayerThread.cxx
index 561c595eb..ad7a008db 100644
--- a/src/player_thread.c
+++ b/src/PlayerThread.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,23 +18,24 @@
*/
#include "config.h"
-#include "player_thread.h"
+#include "PlayerThread.hxx"
+#include "DecoderThread.hxx"
+#include "song.h"
+#include "Main.hxx"
+#include "mpd_error.h"
+
+extern "C" {
#include "player_control.h"
#include "decoder_control.h"
-#include "decoder_thread.h"
#include "output_all.h"
-#include "pcm_volume.h"
-#include "path.h"
#include "event_pipe.h"
#include "crossfade.h"
-#include "song.h"
#include "tag.h"
#include "pipe.h"
#include "chunk.h"
#include "idle.h"
-#include "Main.hxx"
#include "buffer.h"
-#include "mpd_error.h"
+}
#include <glib.h>
@@ -123,6 +124,20 @@ struct player {
* precisely.
*/
float elapsed_time;
+
+ player(player_control *_pc, decoder_control *_dc)
+ :pc(_pc), dc(_dc),
+ buffering(false),
+ decoder_starting(false),
+ paused(false),
+ queued(true),
+ output_open(false),
+ song(NULL),
+ xfade(XFADE_UNKNOWN),
+ cross_fading(false),
+ cross_fade_chunks(0),
+ cross_fade_tag(NULL),
+ elapsed_time(0.0) {}
};
static struct music_buffer *player_buffer;
@@ -882,21 +897,7 @@ player_song_border(struct player *player)
*/
static void do_play(struct player_control *pc, struct decoder_control *dc)
{
- struct player player = {
- .pc = pc,
- .dc = dc,
- .buffering = true,
- .decoder_starting = false,
- .paused = false,
- .queued = true,
- .output_open = false,
- .song = NULL,
- .xfade = XFADE_UNKNOWN,
- .cross_fading = false,
- .cross_fade_chunks = 0,
- .cross_fade_tag = NULL,
- .elapsed_time = 0.0,
- };
+ player player(pc, dc);
player_unlock(pc);
@@ -1094,7 +1095,7 @@ static void do_play(struct player_control *pc, struct decoder_control *dc)
static gpointer
player_task(gpointer arg)
{
- struct player_control *pc = arg;
+ struct player_control *pc = (struct player_control *)arg;
struct decoder_control *dc = dc_new(pc->cond);
decoder_thread_start(dc);
diff --git a/src/player_thread.h b/src/PlayerThread.hxx
index 7373eb438..197669cd6 100644
--- a/src/player_thread.h
+++ b/src/PlayerThread.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
@@ -34,8 +34,8 @@
* #music_chunk instances around in #music_pipe objects.
*/
-#ifndef MPD_PLAYER_THREAD_H
-#define MPD_PLAYER_THREAD_H
+#ifndef MPD_PLAYER_THREAD_HXX
+#define MPD_PLAYER_THREAD_HXX
struct player_control;
diff --git a/src/decoder_internal.h b/src/decoder_internal.h
index d89e68cfc..5bc7e216d 100644
--- a/src/decoder_internal.h
+++ b/src/decoder_internal.h
@@ -80,6 +80,13 @@ struct decoder {
* has changed since the last check.
*/
unsigned replay_gain_serial;
+
+#ifdef __cplusplus
+ decoder(decoder_control *_dc, bool _initial_seek_pending)
+ :dc(_dc),
+ initial_seek_pending(_initial_seek_pending),
+ initial_seek_running(false) {}
+#endif
};
/**