filter: convert to C++

This commit is contained in:
Max Kellermann 2013-02-01 17:47:09 +01:00
parent ec07f6ec83
commit 3894450b10
24 changed files with 121 additions and 137 deletions

View File

@ -57,9 +57,6 @@ mpd_headers = \
src/output_internal.h \ src/output_internal.h \
src/output_api.h \ src/output_api.h \
src/filter_internal.h \ src/filter_internal.h \
src/filter_plugin.h \
src/filter_registry.h \
src/filter/chain_filter_plugin.h \
src/command.h \ src/command.h \
src/conf.h \ src/conf.h \
src/decoder_plugin.h \ src/decoder_plugin.h \
@ -168,8 +165,8 @@ src_mpd_SOURCES = \
src/ExcludeList.cxx src/ExcludeList.hxx \ src/ExcludeList.cxx src/ExcludeList.hxx \
src/fd_util.c \ src/fd_util.c \
src/FilterConfig.cxx src/FilterConfig.hxx \ src/FilterConfig.cxx src/FilterConfig.hxx \
src/filter_plugin.c \ src/FilterPlugin.cxx src/FilterPlugin.hxx \
src/filter_registry.c \ src/FilterRegistry.cxx src/FilterRegistry.hxx \
src/UpdateGlue.cxx src/UpdateGlue.hxx \ src/UpdateGlue.cxx src/UpdateGlue.hxx \
src/UpdateQueue.cxx src/UpdateQueue.hxx \ src/UpdateQueue.cxx src/UpdateQueue.hxx \
src/UpdateIO.cxx src/UpdateIO.hxx \ src/UpdateIO.cxx src/UpdateIO.hxx \
@ -968,14 +965,15 @@ endif
# #
libfilter_plugins_a_SOURCES = \ libfilter_plugins_a_SOURCES = \
src/filter/null_filter_plugin.c \ src/filter/NullFilterPlugin.cxx \
src/filter/chain_filter_plugin.c \ src/filter/ChainFilterPlugin.cxx \
src/filter/ChainFilterPlugin.hxx \
src/filter/AutoConvertFilterPlugin.cxx \ src/filter/AutoConvertFilterPlugin.cxx \
src/filter/AutoConvertFilterPlugin.hxx \ src/filter/AutoConvertFilterPlugin.hxx \
src/filter/ConvertFilterPlugin.cxx \ src/filter/ConvertFilterPlugin.cxx \
src/filter/ConvertFilterPlugin.hxx \ src/filter/ConvertFilterPlugin.hxx \
src/filter/route_filter_plugin.c \ src/filter/RouteFilterPlugin.cxx \
src/filter/normalize_filter_plugin.c \ src/filter/NormalizeFilterPlugin.cxx \
src/filter/ReplayGainFilterPlugin.cxx \ src/filter/ReplayGainFilterPlugin.cxx \
src/filter/ReplayGainFilterPlugin.hxx \ src/filter/ReplayGainFilterPlugin.hxx \
src/filter/VolumeFilterPlugin.cxx \ src/filter/VolumeFilterPlugin.cxx \
@ -1239,8 +1237,7 @@ test_run_filter_LDADD = \
test_run_filter_SOURCES = test/run_filter.cxx \ test_run_filter_SOURCES = test/run_filter.cxx \
test/FakeReplayGainConfig.cxx \ test/FakeReplayGainConfig.cxx \
test/stdbin.h \ test/stdbin.h \
src/filter_plugin.c \ src/FilterPlugin.cxx src/FilterRegistry.cxx \
src/filter_registry.c \
src/tokenizer.c src/utils.c src/string_util.c \ src/tokenizer.c src/utils.c src/string_util.c \
src/audio_check.c \ src/audio_check.c \
src/audio_format.c \ src/audio_format.c \
@ -1350,7 +1347,7 @@ test_run_output_SOURCES = test/run_output.cxx \
src/mixer_api.c \ src/mixer_api.c \
src/mixer_control.c \ src/mixer_control.c \
src/mixer_type.c \ src/mixer_type.c \
src/filter_plugin.c \ src/FilterPlugin.cxx \
src/FilterConfig.cxx \ src/FilterConfig.cxx \
src/AudioCompress/compress.c \ src/AudioCompress/compress.c \
src/ReplayGainInfo.cxx \ src/ReplayGainInfo.cxx \
@ -1367,7 +1364,7 @@ test_read_mixer_LDADD = \
test_read_mixer_SOURCES = test/read_mixer.cxx \ test_read_mixer_SOURCES = test/read_mixer.cxx \
src/tokenizer.c src/utils.c src/string_util.c \ src/tokenizer.c src/utils.c src/string_util.c \
src/mixer_control.c src/mixer_api.c \ src/mixer_control.c src/mixer_api.c \
src/filter_plugin.c \ src/FilterPlugin.cxx \
src/filter/VolumeFilterPlugin.cxx \ src/filter/VolumeFilterPlugin.cxx \
src/fd_util.c src/fd_util.c

View File

@ -20,14 +20,10 @@
#include "config.h" #include "config.h"
#include "FilterConfig.hxx" #include "FilterConfig.hxx"
#include "conf.h" #include "conf.h"
#include "filter/ChainFilterPlugin.hxx"
extern "C" { #include "FilterPlugin.hxx"
#include "filter/chain_filter_plugin.h" #include "FilterInternal.hxx"
} #include "FilterRegistry.hxx"
#include "filter_plugin.h"
#include "filter_internal.h"
#include "filter_registry.h"
#include <glib.h> #include <glib.h>

View File

@ -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 * 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
@ -22,8 +22,8 @@
* Internal stuff for the filter core and filter plugins. * Internal stuff for the filter core and filter plugins.
*/ */
#ifndef MPD_FILTER_INTERNAL_H #ifndef MPD_FILTER_INTERNAL_HXX
#define MPD_FILTER_INTERNAL_H #define MPD_FILTER_INTERNAL_HXX
struct filter { struct filter {
const struct filter_plugin *plugin; const struct filter_plugin *plugin;

View File

@ -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 * 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,9 +18,9 @@
*/ */
#include "config.h" #include "config.h"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_internal.h" #include "FilterInternal.hxx"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include "conf.h" #include "conf.h"
#include "ConfigQuark.hxx" #include "ConfigQuark.hxx"

View File

@ -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 * 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
@ -23,12 +23,11 @@
* plugin API for objects which filter raw PCM data. * plugin API for objects which filter raw PCM data.
*/ */
#ifndef MPD_FILTER_PLUGIN_H #ifndef MPD_FILTER_PLUGIN_HXX
#define MPD_FILTER_PLUGIN_H #define MPD_FILTER_PLUGIN_HXX
#include "gerror.h" #include "gerror.h"
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
struct config_param; struct config_param;
@ -74,10 +73,6 @@ struct filter_plugin {
GError **error_r); GError **error_r);
}; };
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* Creates a new instance of the specified filter plugin. * Creates a new instance of the specified filter plugin.
* *
@ -151,8 +146,4 @@ filter_filter(struct filter *filter, const void *src, size_t src_size,
size_t *dest_size_r, size_t *dest_size_r,
GError **error_r); GError **error_r);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -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 * 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,8 +18,8 @@
*/ */
#include "config.h" #include "config.h"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>

View File

@ -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 * 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
@ -23,8 +23,8 @@
* compile time. * compile time.
*/ */
#ifndef MPD_FILTER_REGISTRY_H #ifndef MPD_FILTER_REGISTRY_HXX
#define MPD_FILTER_REGISTRY_H #define MPD_FILTER_REGISTRY_HXX
extern const struct filter_plugin null_filter_plugin; extern const struct filter_plugin null_filter_plugin;
extern const struct filter_plugin chain_filter_plugin; extern const struct filter_plugin chain_filter_plugin;

View File

@ -30,7 +30,7 @@ extern "C" {
#include "notify.hxx" #include "notify.hxx"
#include "filter/ReplayGainFilterPlugin.hxx" #include "filter/ReplayGainFilterPlugin.hxx"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -23,9 +23,10 @@ extern "C" {
#include "output_internal.h" #include "output_internal.h"
#include "output_plugin.h" #include "output_plugin.h"
#include "mixer_control.h" #include "mixer_control.h"
#include "filter_plugin.h"
} }
#include "FilterPlugin.hxx"
#include <assert.h> #include <assert.h>
void void

View File

@ -30,14 +30,14 @@ extern "C" {
#include "mixer_control.h" #include "mixer_control.h"
#include "mixer_type.h" #include "mixer_type.h"
#include "mixer_list.h" #include "mixer_list.h"
#include "filter_plugin.h"
#include "filter_registry.h"
#include "filter/chain_filter_plugin.h"
} }
#include "mixer/SoftwareMixerPlugin.hxx" #include "mixer/SoftwareMixerPlugin.hxx"
#include "FilterPlugin.hxx"
#include "FilterRegistry.hxx"
#include "filter/AutoConvertFilterPlugin.hxx" #include "filter/AutoConvertFilterPlugin.hxx"
#include "filter/ReplayGainFilterPlugin.hxx" #include "filter/ReplayGainFilterPlugin.hxx"
#include "filter/ChainFilterPlugin.hxx"
#include <glib.h> #include <glib.h>

View File

@ -24,10 +24,10 @@
extern "C" { extern "C" {
#include "output_internal.h" #include "output_internal.h"
#include "filter_plugin.h"
} }
#include "notify.hxx" #include "notify.hxx"
#include "FilterPlugin.hxx"
#include "filter/ConvertFilterPlugin.hxx" #include "filter/ConvertFilterPlugin.hxx"
#include "filter/ReplayGainFilterPlugin.hxx" #include "filter/ReplayGainFilterPlugin.hxx"
#include "PlayerControl.hxx" #include "PlayerControl.hxx"

View File

@ -20,9 +20,9 @@
#include "config.h" #include "config.h"
#include "AutoConvertFilterPlugin.hxx" #include "AutoConvertFilterPlugin.hxx"
#include "ConvertFilterPlugin.hxx" #include "ConvertFilterPlugin.hxx"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_internal.h" #include "FilterInternal.hxx"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include "audio_format.h" #include "audio_format.h"
#include <assert.h> #include <assert.h>

View File

@ -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 * 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,22 +18,26 @@
*/ */
#include "config.h" #include "config.h"
#include "ChainFilterPlugin.hxx"
#include "conf.h" #include "conf.h"
#include "filter/chain_filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_plugin.h" #include "FilterInternal.hxx"
#include "filter_internal.h" #include "FilterRegistry.hxx"
#include "filter_registry.h"
#include "audio_format.h" #include "audio_format.h"
#include <glib.h> #include <glib.h>
#include <assert.h> #include <assert.h>
struct filter_chain { struct ChainFilter {
/** the base class */ /** the base class */
struct filter base; struct filter base;
GSList *children; GSList *children;
ChainFilter():children(nullptr) {
filter_init(&base, &chain_filter_plugin);
}
}; };
static inline GQuark static inline GQuark
@ -46,10 +50,7 @@ static struct filter *
chain_filter_init(G_GNUC_UNUSED const struct config_param *param, chain_filter_init(G_GNUC_UNUSED const struct config_param *param,
G_GNUC_UNUSED GError **error_r) G_GNUC_UNUSED GError **error_r)
{ {
struct filter_chain *chain = g_new(struct filter_chain, 1); ChainFilter *chain = new ChainFilter();
filter_init(&chain->base, &chain_filter_plugin);
chain->children = NULL;
return &chain->base; return &chain->base;
} }
@ -57,7 +58,7 @@ chain_filter_init(G_GNUC_UNUSED const struct config_param *param,
static void static void
chain_free_child(gpointer data, G_GNUC_UNUSED gpointer user_data) chain_free_child(gpointer data, G_GNUC_UNUSED gpointer user_data)
{ {
struct filter *filter = data; struct filter *filter = (struct filter *)data;
filter_free(filter); filter_free(filter);
} }
@ -65,12 +66,12 @@ chain_free_child(gpointer data, G_GNUC_UNUSED gpointer user_data)
static void static void
chain_filter_finish(struct filter *_filter) chain_filter_finish(struct filter *_filter)
{ {
struct filter_chain *chain = (struct filter_chain *)_filter; ChainFilter *chain = (ChainFilter *)_filter;
g_slist_foreach(chain->children, chain_free_child, NULL); g_slist_foreach(chain->children, chain_free_child, NULL);
g_slist_free(chain->children); g_slist_free(chain->children);
g_free(chain); delete chain;
} }
/** /**
@ -78,10 +79,9 @@ chain_filter_finish(struct filter *_filter)
* itself is not closed. * itself is not closed.
*/ */
static void static void
chain_close_until(struct filter_chain *chain, const struct filter *until) chain_close_until(ChainFilter *chain, const struct filter *until)
{ {
GSList *i = chain->children; GSList *i = chain->children;
struct filter *filter;
while (true) { while (true) {
/* this assertion fails if #until does not exist /* this assertion fails if #until does not exist
@ -93,7 +93,7 @@ chain_close_until(struct filter_chain *chain, const struct filter *until)
break; break;
/* close this filter */ /* close this filter */
filter = i->data; struct filter *filter = (struct filter *)i->data;
filter_close(filter); filter_close(filter);
i = g_slist_next(i); i = g_slist_next(i);
@ -130,11 +130,11 @@ static const struct audio_format *
chain_filter_open(struct filter *_filter, struct audio_format *in_audio_format, chain_filter_open(struct filter *_filter, struct audio_format *in_audio_format,
GError **error_r) GError **error_r)
{ {
struct filter_chain *chain = (struct filter_chain *)_filter; ChainFilter *chain = (ChainFilter *)_filter;
const struct audio_format *audio_format = in_audio_format; const struct audio_format *audio_format = in_audio_format;
for (GSList *i = chain->children; i != NULL; i = g_slist_next(i)) { for (GSList *i = chain->children; i != NULL; i = g_slist_next(i)) {
struct filter *filter = i->data; struct filter *filter = (struct filter *)i->data;
audio_format = chain_open_child(filter, audio_format, error_r); audio_format = chain_open_child(filter, audio_format, error_r);
if (audio_format == NULL) { if (audio_format == NULL) {
@ -151,7 +151,7 @@ chain_filter_open(struct filter *_filter, struct audio_format *in_audio_format,
static void static void
chain_close_child(gpointer data, G_GNUC_UNUSED gpointer user_data) chain_close_child(gpointer data, G_GNUC_UNUSED gpointer user_data)
{ {
struct filter *filter = data; struct filter *filter = (struct filter *)data;
filter_close(filter); filter_close(filter);
} }
@ -159,7 +159,7 @@ chain_close_child(gpointer data, G_GNUC_UNUSED gpointer user_data)
static void static void
chain_filter_close(struct filter *_filter) chain_filter_close(struct filter *_filter)
{ {
struct filter_chain *chain = (struct filter_chain *)_filter; ChainFilter *chain = (ChainFilter *)_filter;
g_slist_foreach(chain->children, chain_close_child, NULL); g_slist_foreach(chain->children, chain_close_child, NULL);
} }
@ -169,10 +169,10 @@ chain_filter_filter(struct filter *_filter,
const void *src, size_t src_size, const void *src, size_t src_size,
size_t *dest_size_r, GError **error_r) size_t *dest_size_r, GError **error_r)
{ {
struct filter_chain *chain = (struct filter_chain *)_filter; ChainFilter *chain = (ChainFilter *)_filter;
for (GSList *i = chain->children; i != NULL; i = g_slist_next(i)) { for (GSList *i = chain->children; i != NULL; i = g_slist_next(i)) {
struct filter *filter = i->data; struct filter *filter = (struct filter *)i->data;
/* feed the output of the previous filter as input /* feed the output of the previous filter as input
into the current one */ into the current one */
@ -187,12 +187,12 @@ chain_filter_filter(struct filter *_filter,
} }
const struct filter_plugin chain_filter_plugin = { const struct filter_plugin chain_filter_plugin = {
.name = "chain", "chain",
.init = chain_filter_init, chain_filter_init,
.finish = chain_filter_finish, chain_filter_finish,
.open = chain_filter_open, chain_filter_open,
.close = chain_filter_close, chain_filter_close,
.filter = chain_filter_filter, chain_filter_filter,
}; };
struct filter * struct filter *
@ -208,8 +208,7 @@ filter_chain_new(void)
void void
filter_chain_append(struct filter *_chain, struct filter *filter) filter_chain_append(struct filter *_chain, struct filter *filter)
{ {
struct filter_chain *chain = (struct filter_chain *)_chain; ChainFilter *chain = (ChainFilter *)_chain;
chain->children = g_slist_append(chain->children, filter); chain->children = g_slist_append(chain->children, filter);
} }

View File

@ -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 * 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
@ -24,8 +24,8 @@
* output to the next one. * output to the next one.
*/ */
#ifndef MPD_FILTER_CHAIN_H #ifndef MPD_FILTER_CHAIN_HXX
#define MPD_FILTER_CHAIN_H #define MPD_FILTER_CHAIN_HXX
struct filter; struct filter;

View File

@ -19,9 +19,9 @@
#include "config.h" #include "config.h"
#include "ConvertFilterPlugin.hxx" #include "ConvertFilterPlugin.hxx"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_internal.h" #include "FilterInternal.hxx"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include "conf.h" #include "conf.h"
#include "PcmConvert.hxx" #include "PcmConvert.hxx"
#include "util/Manual.hxx" #include "util/Manual.hxx"

View File

@ -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 * 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,9 +18,9 @@
*/ */
#include "config.h" #include "config.h"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_internal.h" #include "FilterInternal.hxx"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include "pcm_buffer.h" #include "pcm_buffer.h"
#include "audio_format.h" #include "audio_format.h"
#include "AudioCompress/compress.h" #include "AudioCompress/compress.h"
@ -90,9 +90,8 @@ normalize_filter_filter(struct filter *_filter,
G_GNUC_UNUSED GError **error_r) G_GNUC_UNUSED GError **error_r)
{ {
struct normalize_filter *filter = (struct normalize_filter *)_filter; struct normalize_filter *filter = (struct normalize_filter *)_filter;
void *dest;
dest = pcm_buffer_get(&filter->buffer, src_size); int16_t *dest = (int16_t *)pcm_buffer_get(&filter->buffer, src_size);
memcpy(dest, src, src_size); memcpy(dest, src, src_size);
@ -103,10 +102,10 @@ normalize_filter_filter(struct filter *_filter,
} }
const struct filter_plugin normalize_filter_plugin = { const struct filter_plugin normalize_filter_plugin = {
.name = "normalize", "normalize",
.init = normalize_filter_init, normalize_filter_init,
.finish = normalize_filter_finish, normalize_filter_finish,
.open = normalize_filter_open, normalize_filter_open,
.close = normalize_filter_close, normalize_filter_close,
.filter = normalize_filter_filter, normalize_filter_filter,
}; };

View File

@ -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 * 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
@ -25,9 +25,9 @@
*/ */
#include "config.h" #include "config.h"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_internal.h" #include "FilterInternal.hxx"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include <glib.h> #include <glib.h>
#include <assert.h> #include <assert.h>
@ -85,10 +85,10 @@ null_filter_filter(struct filter *_filter,
} }
const struct filter_plugin null_filter_plugin = { const struct filter_plugin null_filter_plugin = {
.name = "null", "null",
.init = null_filter_init, null_filter_init,
.finish = null_filter_finish, null_filter_finish,
.open = null_filter_open, null_filter_open,
.close = null_filter_close, null_filter_close,
.filter = null_filter_filter, null_filter_filter,
}; };

View File

@ -19,9 +19,9 @@
#include "config.h" #include "config.h"
#include "ReplayGainFilterPlugin.hxx" #include "ReplayGainFilterPlugin.hxx"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_internal.h" #include "FilterInternal.hxx"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include "audio_format.h" #include "audio_format.h"
#include "replay_gain_info.h" #include "replay_gain_info.h"
#include "replay_gain_config.h" #include "replay_gain_config.h"

View File

@ -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 * 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
@ -44,9 +44,9 @@
#include "ConfigQuark.hxx" #include "ConfigQuark.hxx"
#include "audio_format.h" #include "audio_format.h"
#include "audio_check.h" #include "audio_check.h"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_internal.h" #include "FilterInternal.hxx"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include "pcm_buffer.h" #include "pcm_buffer.h"
#include <assert.h> #include <assert.h>
@ -188,7 +188,7 @@ route_filter_parse(const struct config_param *param,
} }
// Allocate a map of "copy nothing to me" // Allocate a map of "copy nothing to me"
filter->sources = filter->sources = (signed char *)
g_malloc(filter->min_output_channels * sizeof(signed char)); g_malloc(filter->min_output_channels * sizeof(signed char));
for (int i=0; i<filter->min_output_channels; ++i) for (int i=0; i<filter->min_output_channels; ++i)
@ -295,14 +295,15 @@ route_filter_filter(struct filter *_filter,
audio_format_sample_size(&filter->input_format); audio_format_sample_size(&filter->input_format);
// A moving pointer that always refers to channel 0 in the input, at the currently handled frame // A moving pointer that always refers to channel 0 in the input, at the currently handled frame
const uint8_t *base_source = src; const uint8_t *base_source = (const uint8_t *)src;
// A moving pointer that always refers to the currently filled channel of the currently handled frame, in the output // A moving pointer that always refers to the currently filled channel of the currently handled frame, in the output
uint8_t *chan_destination; uint8_t *chan_destination;
// Grow our reusable buffer, if needed, and set the moving pointer // Grow our reusable buffer, if needed, and set the moving pointer
*dest_size_r = number_of_frames * filter->output_frame_size; *dest_size_r = number_of_frames * filter->output_frame_size;
chan_destination = pcm_buffer_get(&filter->output_buffer, *dest_size_r); chan_destination = (uint8_t *)
pcm_buffer_get(&filter->output_buffer, *dest_size_r);
// Perform our copy operations, with N input channels and M output channels // Perform our copy operations, with N input channels and M output channels
@ -340,10 +341,10 @@ route_filter_filter(struct filter *_filter,
} }
const struct filter_plugin route_filter_plugin = { const struct filter_plugin route_filter_plugin = {
.name = "route", "route",
.init = route_filter_init, route_filter_init,
.finish = route_filter_finish, route_filter_finish,
.open = route_filter_open, route_filter_open,
.close = route_filter_close, route_filter_close,
.filter = route_filter_filter, route_filter_filter,
}; };

View File

@ -19,9 +19,9 @@
#include "config.h" #include "config.h"
#include "VolumeFilterPlugin.hxx" #include "VolumeFilterPlugin.hxx"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_internal.h" #include "FilterInternal.hxx"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include "conf.h" #include "conf.h"
#include "pcm_buffer.h" #include "pcm_buffer.h"
#include "PcmVolume.hxx" #include "PcmVolume.hxx"

View File

@ -20,8 +20,8 @@
#include "config.h" #include "config.h"
#include "SoftwareMixerPlugin.hxx" #include "SoftwareMixerPlugin.hxx"
#include "mixer_api.h" #include "mixer_api.h"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "filter_registry.h" #include "FilterRegistry.hxx"
#include "filter/VolumeFilterPlugin.hxx" #include "filter/VolumeFilterPlugin.hxx"
#include "PcmVolume.hxx" #include "PcmVolume.hxx"

View File

@ -22,9 +22,9 @@
extern "C" { extern "C" {
#include "mixer_control.h" #include "mixer_control.h"
#include "mixer_list.h" #include "mixer_list.h"
#include "filter_registry.h"
} }
#include "FilterRegistry.hxx"
#include "PcmVolume.hxx" #include "PcmVolume.hxx"
#include "GlobalEvents.hxx" #include "GlobalEvents.hxx"
#include "Main.hxx" #include "Main.hxx"

View File

@ -22,7 +22,7 @@
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "AudioParser.hxx" #include "AudioParser.hxx"
#include "audio_format.h" #include "audio_format.h"
#include "filter_plugin.h" #include "FilterPlugin.hxx"
#include "PcmVolume.hxx" #include "PcmVolume.hxx"
#include "mixer_control.h" #include "mixer_control.h"
#include "stdbin.h" #include "stdbin.h"

View File

@ -32,9 +32,9 @@
extern "C" { extern "C" {
#include "output_plugin.h" #include "output_plugin.h"
#include "output_internal.h" #include "output_internal.h"
#include "filter_registry.h"
} }
#include "FilterRegistry.hxx"
#include "PlayerControl.hxx" #include "PlayerControl.hxx"
#include "stdbin.h" #include "stdbin.h"