aboutsummaryrefslogtreecommitdiffstats
path: root/src/PlayerThread.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-02 20:36:28 +0100
committerMax Kellermann <max@duempel.org>2013-01-02 20:36:28 +0100
commit975deca85b3fb881571203c9a2cad4eb242cd954 (patch)
treede6f8c57fee4b3b80aafd7a9c087a6b6b90ffadb /src/PlayerThread.cxx
parent3bbb5023871aaba48b6f503dd53d864f9a44c07d (diff)
downloadmpd-975deca85b3fb881571203c9a2cad4eb242cd954.tar.gz
mpd-975deca85b3fb881571203c9a2cad4eb242cd954.tar.xz
mpd-975deca85b3fb881571203c9a2cad4eb242cd954.zip
{decoder,player}_thread: convert to C++
Diffstat (limited to '')
-rw-r--r--src/PlayerThread.cxx (renamed from src/player_thread.c)49
1 files changed, 25 insertions, 24 deletions
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);