output_*: convert to C++
This commit is contained in:
@@ -29,7 +29,7 @@ extern "C" {
|
||||
|
||||
#include "decoder_list.h"
|
||||
#include "decoder_plugin.h"
|
||||
#include "output_list.h"
|
||||
#include "OutputList.hxx"
|
||||
#include "output_plugin.h"
|
||||
#include "input_registry.h"
|
||||
#include "input_plugin.h"
|
||||
|
@@ -18,17 +18,24 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
extern "C" {
|
||||
#include "output_all.h"
|
||||
#include "output_error.h"
|
||||
#include "output_internal.h"
|
||||
#include "output_control.h"
|
||||
#include "chunk.h"
|
||||
}
|
||||
|
||||
#include "OutputControl.hxx"
|
||||
#include "OutputError.hxx"
|
||||
#include "mpd_error.h"
|
||||
|
||||
extern "C" {
|
||||
#include "player_control.h"
|
||||
#include "conf.h"
|
||||
#include "chunk.h"
|
||||
#include "pipe.h"
|
||||
#include "buffer.h"
|
||||
#include "player_control.h"
|
||||
#include "mpd_error.h"
|
||||
#include "notify.h"
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
#include "chunk.h"
|
@@ -25,13 +25,16 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "output_command.h"
|
||||
#include "OutputCommand.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include "output_all.h"
|
||||
#include "output_internal.h"
|
||||
#include "output_plugin.h"
|
||||
#include "mixer_control.h"
|
||||
#include "player_control.h"
|
||||
#include "idle.h"
|
||||
}
|
||||
|
||||
extern unsigned audio_output_state_version;
|
||||
|
@@ -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
|
||||
@@ -24,10 +24,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OUTPUT_COMMAND_H
|
||||
#define OUTPUT_COMMAND_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#ifndef MPD_OUTPUT_COMMAND_HXX
|
||||
#define MPD_OUTPUT_COMMAND_HXX
|
||||
|
||||
/**
|
||||
* Enables an audio output. Returns false if the specified output
|
@@ -20,13 +20,10 @@
|
||||
#include "config.h"
|
||||
#include "OutputCommands.hxx"
|
||||
#include "OutputPrint.hxx"
|
||||
#include "OutputCommand.hxx"
|
||||
#include "protocol/Result.hxx"
|
||||
#include "protocol/ArgParser.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include "output_command.h"
|
||||
}
|
||||
|
||||
#include <string.h>
|
||||
|
||||
enum command_return
|
||||
|
@@ -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,18 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "output_control.h"
|
||||
#include "OutputControl.hxx"
|
||||
#include "OutputThread.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include "output_api.h"
|
||||
#include "output_internal.h"
|
||||
#include "output_thread.h"
|
||||
#include "mixer_control.h"
|
||||
#include "mixer_plugin.h"
|
||||
#include "filter_plugin.h"
|
||||
#include "notify.h"
|
||||
}
|
||||
|
||||
#include "filter_plugin.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
@@ -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,13 +17,12 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef MPD_OUTPUT_CONTROL_H
|
||||
#define MPD_OUTPUT_CONTROL_H
|
||||
#ifndef MPD_OUTPUT_CONTROL_HXX
|
||||
#define MPD_OUTPUT_CONTROL_HXX
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct audio_output;
|
||||
struct audio_format;
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2012 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_OUTPUT_ERROR_H
|
||||
#define MPD_OUTPUT_ERROR_H
|
||||
#ifndef MPD_OUTPUT_ERROR_HXX
|
||||
#define MPD_OUTPUT_ERROR_HXX
|
||||
|
||||
#include <glib.h>
|
||||
|
@@ -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"
|
||||
|
||||
extern "C" {
|
||||
#include "output_internal.h"
|
||||
#include "output_plugin.h"
|
||||
#include "mixer_control.h"
|
||||
#include "filter_plugin.h"
|
||||
}
|
||||
|
||||
#include <assert.h>
|
||||
|
@@ -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,12 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "output_control.h"
|
||||
#include "OutputControl.hxx"
|
||||
#include "OutputList.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include "output_api.h"
|
||||
#include "output_internal.h"
|
||||
#include "output_list.h"
|
||||
#include "audio_parser.h"
|
||||
#include "mixer_control.h"
|
||||
#include "mixer_type.h"
|
||||
@@ -33,6 +35,7 @@
|
||||
#include "filter/chain_filter_plugin.h"
|
||||
#include "filter/autoconvert_filter_plugin.h"
|
||||
#include "filter/replay_gain_filter_plugin.h"
|
||||
}
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@@ -298,14 +301,14 @@ audio_output_new(const struct config_param *param,
|
||||
if (p == NULL) {
|
||||
g_set_error(error_r, audio_output_quark(), 0,
|
||||
"Missing \"type\" configuration");
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
plugin = audio_output_plugin_get(p);
|
||||
if (plugin == NULL) {
|
||||
g_set_error(error_r, audio_output_quark(), 0,
|
||||
"No such audio output plugin: %s", p);
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
g_warning("No \"%s\" defined in config file\n",
|
||||
@@ -313,7 +316,7 @@ audio_output_new(const struct config_param *param,
|
||||
|
||||
plugin = audio_output_detect(error_r);
|
||||
if (plugin == NULL)
|
||||
return false;
|
||||
return nullptr;
|
||||
|
||||
g_message("Successfully detected a %s audio device",
|
||||
plugin->name);
|
@@ -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,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "output_list.h"
|
||||
#include "OutputList.hxx"
|
||||
#include "output_api.h"
|
||||
#include "output/alsa_output_plugin.h"
|
||||
#include "output/ao_output_plugin.h"
|
@@ -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_OUTPUT_LIST_H
|
||||
#define MPD_OUTPUT_LIST_H
|
||||
#ifndef MPD_OUTPUT_LIST_HXX
|
||||
#define MPD_OUTPUT_LIST_HXX
|
||||
|
||||
extern const struct audio_output_plugin *const audio_output_plugins[];
|
||||
|
@@ -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,7 +18,11 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
extern "C" {
|
||||
#include "output_plugin.h"
|
||||
}
|
||||
|
||||
#include "output_internal.h"
|
||||
|
||||
struct audio_output *
|
@@ -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,7 +18,9 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "output_thread.h"
|
||||
#include "OutputThread.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include "output_api.h"
|
||||
#include "output_internal.h"
|
||||
#include "chunk.h"
|
||||
@@ -28,8 +30,10 @@
|
||||
#include "filter_plugin.h"
|
||||
#include "filter/convert_filter_plugin.h"
|
||||
#include "filter/replay_gain_filter_plugin.h"
|
||||
#include "mpd_error.h"
|
||||
#include "notify.h"
|
||||
}
|
||||
|
||||
#include "mpd_error.h"
|
||||
#include "gcc.h"
|
||||
|
||||
#include <glib.h>
|
||||
@@ -315,7 +319,7 @@ ao_wait(struct audio_output *ao)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
static const void *
|
||||
ao_chunk_data(struct audio_output *ao, const struct music_chunk *chunk,
|
||||
struct filter *replay_gain_filter,
|
||||
unsigned *replay_gain_serial_p,
|
||||
@@ -325,7 +329,7 @@ ao_chunk_data(struct audio_output *ao, const struct music_chunk *chunk,
|
||||
assert(!music_chunk_is_empty(chunk));
|
||||
assert(music_chunk_check_format(chunk, &ao->in_audio_format));
|
||||
|
||||
const char *data = chunk->data;
|
||||
const void *data = chunk->data;
|
||||
size_t length = chunk->length;
|
||||
|
||||
(void)ao;
|
||||
@@ -356,14 +360,14 @@ ao_chunk_data(struct audio_output *ao, const struct music_chunk *chunk,
|
||||
return data;
|
||||
}
|
||||
|
||||
static const char *
|
||||
static const void *
|
||||
ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk,
|
||||
size_t *length_r)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
size_t length;
|
||||
const char *data = ao_chunk_data(ao, chunk, ao->replay_gain_filter,
|
||||
const void *data = ao_chunk_data(ao, chunk, ao->replay_gain_filter,
|
||||
&ao->replay_gain_serial, &length);
|
||||
if (data == NULL)
|
||||
return NULL;
|
||||
@@ -378,7 +382,7 @@ ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk,
|
||||
|
||||
if (chunk->other != NULL) {
|
||||
size_t other_length;
|
||||
const char *other_data =
|
||||
const void *other_data =
|
||||
ao_chunk_data(ao, chunk->other,
|
||||
ao->other_replay_gain_filter,
|
||||
&ao->other_replay_gain_serial,
|
||||
@@ -399,13 +403,14 @@ ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk,
|
||||
if (length > other_length)
|
||||
length = other_length;
|
||||
|
||||
char *dest = pcm_buffer_get(&ao->cross_fade_buffer,
|
||||
void *dest = pcm_buffer_get(&ao->cross_fade_buffer,
|
||||
other_length);
|
||||
memcpy(dest, other_data, other_length);
|
||||
if (!pcm_mix(dest, data, length, ao->in_audio_format.format,
|
||||
if (!pcm_mix(dest, data, length,
|
||||
sample_format(ao->in_audio_format.format),
|
||||
1.0 - chunk->mix_ratio)) {
|
||||
g_warning("Cannot cross-fade format %s",
|
||||
sample_format_to_string(ao->in_audio_format.format));
|
||||
sample_format_to_string(sample_format(ao->in_audio_format.format)));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -446,7 +451,7 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk)
|
||||
/* workaround -Wmaybe-uninitialized false positive */
|
||||
size = 0;
|
||||
#endif
|
||||
const char *data = ao_filter_chunk(ao, chunk, &size);
|
||||
const char *data = (const char *)ao_filter_chunk(ao, chunk, &size);
|
||||
if (data == NULL) {
|
||||
ao_close(ao, false);
|
||||
|
||||
@@ -578,7 +583,7 @@ static void ao_pause(struct audio_output *ao)
|
||||
|
||||
static gpointer audio_output_task(gpointer arg)
|
||||
{
|
||||
struct audio_output *ao = arg;
|
||||
struct audio_output *ao = (struct audio_output *)arg;
|
||||
|
||||
g_mutex_lock(ao->mutex);
|
||||
|
@@ -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_OUTPUT_THREAD_H
|
||||
#define MPD_OUTPUT_THREAD_H
|
||||
#ifndef MPD_OUTPUT_THREAD_HXX
|
||||
#define MPD_OUTPUT_THREAD_HXX
|
||||
|
||||
struct audio_output;
|
||||
|
Reference in New Issue
Block a user