aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderThread.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/DecoderThread.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/DecoderThread.cxx (renamed from src/decoder_thread.c)30
1 files changed, 11 insertions, 19 deletions
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);