Commit e12cc01a authored by Max Kellermann's avatar Max Kellermann

decoder_*: convert to C++

parent 71c69728
...@@ -70,13 +70,11 @@ mpd_headers = \ ...@@ -70,13 +70,11 @@ mpd_headers = \
src/idle.h \ src/idle.h \
src/conf.h \ src/conf.h \
src/crossfade.h \ src/crossfade.h \
src/decoder_control.h \
src/decoder_plugin.h \ src/decoder_plugin.h \
src/decoder_command.h \ src/decoder_command.h \
src/decoder_buffer.h \ src/decoder_buffer.h \
src/decoder_api.h \ src/decoder_api.h \
src/decoder_plugin.h \ src/decoder_plugin.h \
src/decoder_internal.h \
src/encoder_plugin.h \ src/encoder_plugin.h \
src/encoder_list.h \ src/encoder_list.h \
src/encoder_api.h \ src/encoder_api.h \
...@@ -207,9 +205,9 @@ src_mpd_SOURCES = \ ...@@ -207,9 +205,9 @@ src_mpd_SOURCES = \
src/cue/cue_parser.c src/cue/cue_parser.h \ src/cue/cue_parser.c src/cue/cue_parser.h \
src/decoder_error.h \ src/decoder_error.h \
src/DecoderThread.cxx src/DecoderThread.hxx \ src/DecoderThread.cxx src/DecoderThread.hxx \
src/decoder_control.c \ src/DecoderControl.cxx src/DecoderControl.hxx \
src/decoder_api.c \ src/DecoderAPI.cxx \
src/decoder_internal.c \ src/DecoderInternal.cxx src/DecoderInternal.hxx \
src/DecoderPrint.cxx src/DecoderPrint.hxx \ src/DecoderPrint.cxx src/DecoderPrint.hxx \
src/Directory.cxx src/Directory.hxx \ src/Directory.cxx src/Directory.hxx \
src/DirectorySave.cxx src/DirectorySave.hxx \ src/DirectorySave.cxx src/DirectorySave.hxx \
...@@ -274,7 +272,7 @@ src_mpd_SOURCES = \ ...@@ -274,7 +272,7 @@ src_mpd_SOURCES = \
src/page.c \ src/page.c \
src/Permission.cxx src/Permission.hxx \ src/Permission.cxx src/Permission.hxx \
src/PlayerThread.cxx src/PlayerThread.hxx \ src/PlayerThread.cxx src/PlayerThread.hxx \
src/player_control.c \ src/PlayerControl.cxx \
src/playlist.c \ src/playlist.c \
src/playlist_global.c \ src/playlist_global.c \
src/playlist_control.c \ src/playlist_control.c \
......
/* /*
* Copyright (C) 2003-2011 The Music Player Daemon Project * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -18,15 +18,19 @@ ...@@ -18,15 +18,19 @@
*/ */
#include "config.h" #include "config.h"
extern "C" {
#include "decoder_api.h" #include "decoder_api.h"
#include "decoder_internal.h"
#include "decoder_control.h"
#include "audio_config.h" #include "audio_config.h"
#include "song.h"
#include "buffer.h" #include "buffer.h"
#include "pipe.h" #include "pipe.h"
#include "chunk.h" #include "chunk.h"
#include "replay_gain_config.h" #include "replay_gain_config.h"
}
#include "DecoderControl.hxx"
#include "DecoderInternal.hxx"
#include "song.h"
#include <glib.h> #include <glib.h>
...@@ -362,11 +366,10 @@ update_stream_tag(struct decoder *decoder, struct input_stream *is) ...@@ -362,11 +366,10 @@ update_stream_tag(struct decoder *decoder, struct input_stream *is)
enum decoder_command enum decoder_command
decoder_data(struct decoder *decoder, decoder_data(struct decoder *decoder,
struct input_stream *is, struct input_stream *is,
const void *_data, size_t length, const void *data, size_t length,
uint16_t kbit_rate) uint16_t kbit_rate)
{ {
struct decoder_control *dc = decoder->dc; struct decoder_control *dc = decoder->dc;
const char *data = _data;
GError *error = NULL; GError *error = NULL;
enum decoder_command cmd; enum decoder_command cmd;
...@@ -417,7 +420,6 @@ decoder_data(struct decoder *decoder, ...@@ -417,7 +420,6 @@ decoder_data(struct decoder *decoder,
while (length > 0) { while (length > 0) {
struct music_chunk *chunk; struct music_chunk *chunk;
char *dest;
size_t nbytes; size_t nbytes;
bool full; bool full;
...@@ -427,10 +429,10 @@ decoder_data(struct decoder *decoder, ...@@ -427,10 +429,10 @@ decoder_data(struct decoder *decoder,
return dc->command; return dc->command;
} }
dest = music_chunk_write(chunk, &dc->out_audio_format, void *dest = music_chunk_write(chunk, &dc->out_audio_format,
decoder->timestamp - decoder->timestamp -
dc->song->start_ms / 1000.0, dc->song->start_ms / 1000.0,
kbit_rate, &nbytes); kbit_rate, &nbytes);
if (dest == NULL) { if (dest == NULL) {
/* the chunk is full, flush it */ /* the chunk is full, flush it */
decoder_flush_chunk(decoder); decoder_flush_chunk(decoder);
...@@ -456,7 +458,7 @@ decoder_data(struct decoder *decoder, ...@@ -456,7 +458,7 @@ decoder_data(struct decoder *decoder,
g_cond_signal(dc->client_cond); g_cond_signal(dc->client_cond);
} }
data += nbytes; data = (const uint8_t *)data + nbytes;
length -= nbytes; length -= nbytes;
decoder->timestamp += (double)nbytes / decoder->timestamp += (double)nbytes /
......
/* /*
* Copyright (C) 2003-2011 The Music Player Daemon Project * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -18,10 +18,13 @@ ...@@ -18,10 +18,13 @@
*/ */
#include "config.h" #include "config.h"
#include "decoder_control.h" #include "DecoderControl.hxx"
#include "pipe.h"
#include "song.h" #include "song.h"
extern "C" {
#include "pipe.h"
}
#include <assert.h> #include <assert.h>
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
......
/* /*
* Copyright (C) 2003-2011 The Music Player Daemon Project * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef MPD_DECODER_CONTROL_H #ifndef MPD_DECODER_CONTROL_HXX
#define MPD_DECODER_CONTROL_H #define MPD_DECODER_CONTROL_HXX
#include "decoder_command.h" #include "decoder_command.h"
#include "audio_format.h" #include "audio_format.h"
......
/* /*
* Copyright (C) 2003-2011 The Music Player Daemon Project * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -18,11 +18,15 @@ ...@@ -18,11 +18,15 @@
*/ */
#include "config.h" #include "config.h"
#include "decoder_internal.h" #include "DecoderInternal.hxx"
#include "decoder_control.h" #include "DecoderControl.hxx"
extern "C" {
#include "pipe.h" #include "pipe.h"
#include "input_stream.h"
#include "buffer.h" #include "buffer.h"
}
#include "input_stream.h"
#include "chunk.h" #include "chunk.h"
#include <assert.h> #include <assert.h>
......
/* /*
* Copyright (C) 2003-2011 The Music Player Daemon Project * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef MPD_DECODER_INTERNAL_H #ifndef MPD_DECODER_INTERNAL_HXX
#define MPD_DECODER_INTERNAL_H #define MPD_DECODER_INTERNAL_HXX
#include "decoder_command.h" #include "decoder_command.h"
#include "pcm_convert.h" #include "pcm_convert.h"
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include "config.h" #include "config.h"
#include "DecoderThread.hxx" #include "DecoderThread.hxx"
#include "DecoderControl.hxx"
#include "DecoderInternal.hxx"
#include "decoder_error.h" #include "decoder_error.h"
#include "decoder_plugin.h" #include "decoder_plugin.h"
#include "song.h" #include "song.h"
...@@ -26,8 +28,6 @@ ...@@ -26,8 +28,6 @@
#include "Mapper.hxx" #include "Mapper.hxx"
extern "C" { extern "C" {
#include "decoder_control.h"
#include "decoder_internal.h"
#include "decoder_list.h" #include "decoder_list.h"
#include "decoder_api.h" #include "decoder_api.h"
#include "replay_gain_ape.h" #include "replay_gain_ape.h"
......
/* /*
* Copyright (C) 2003-2011 The Music Player Daemon Project * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
*/ */
#include "config.h" #include "config.h"
extern "C" {
#include "player_control.h" #include "player_control.h"
#include "decoder_control.h"
#include "path.h"
#include "log.h"
#include "tag.h"
#include "song.h"
#include "idle.h" #include "idle.h"
#include "pcm_volume.h" }
#include "song.h"
#include "DecoderControl.hxx"
#include "Main.hxx" #include "Main.hxx"
#include <assert.h> #include <assert.h>
......
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
#include "config.h" #include "config.h"
#include "PlayerThread.hxx" #include "PlayerThread.hxx"
#include "DecoderThread.hxx" #include "DecoderThread.hxx"
#include "DecoderControl.hxx"
#include "song.h" #include "song.h"
#include "Main.hxx" #include "Main.hxx"
#include "mpd_error.h" #include "mpd_error.h"
extern "C" { extern "C" {
#include "player_control.h" #include "player_control.h"
#include "decoder_control.h"
#include "output_all.h" #include "output_all.h"
#include "event_pipe.h" #include "event_pipe.h"
#include "crossfade.h" #include "crossfade.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment