diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FilterConfig.cxx | 12 | ||||
-rw-r--r-- | src/FilterInternal.hxx (renamed from src/filter_internal.h) | 6 | ||||
-rw-r--r-- | src/FilterPlugin.cxx (renamed from src/filter_plugin.c) | 8 | ||||
-rw-r--r-- | src/FilterPlugin.hxx (renamed from src/filter_plugin.h) | 15 | ||||
-rw-r--r-- | src/FilterRegistry.cxx (renamed from src/filter_registry.c) | 6 | ||||
-rw-r--r-- | src/FilterRegistry.hxx (renamed from src/filter_registry.h) | 6 | ||||
-rw-r--r-- | src/OutputControl.cxx | 2 | ||||
-rw-r--r-- | src/OutputFinish.cxx | 3 | ||||
-rw-r--r-- | src/OutputInit.cxx | 6 | ||||
-rw-r--r-- | src/OutputThread.cxx | 2 | ||||
-rw-r--r-- | src/filter/AutoConvertFilterPlugin.cxx | 6 | ||||
-rw-r--r-- | src/filter/ChainFilterPlugin.cxx (renamed from src/filter/chain_filter_plugin.c) | 59 | ||||
-rw-r--r-- | src/filter/ChainFilterPlugin.hxx (renamed from src/filter/chain_filter_plugin.h) | 6 | ||||
-rw-r--r-- | src/filter/ConvertFilterPlugin.cxx | 6 | ||||
-rw-r--r-- | src/filter/NormalizeFilterPlugin.cxx (renamed from src/filter/normalize_filter_plugin.c) | 23 | ||||
-rw-r--r-- | src/filter/NullFilterPlugin.cxx (renamed from src/filter/null_filter_plugin.c) | 20 | ||||
-rw-r--r-- | src/filter/ReplayGainFilterPlugin.cxx | 6 | ||||
-rw-r--r-- | src/filter/RouteFilterPlugin.cxx (renamed from src/filter/route_filter_plugin.c) | 27 | ||||
-rw-r--r-- | src/filter/VolumeFilterPlugin.cxx | 6 | ||||
-rw-r--r-- | src/mixer/SoftwareMixerPlugin.cxx | 4 |
20 files changed, 108 insertions, 121 deletions
diff --git a/src/FilterConfig.cxx b/src/FilterConfig.cxx index 8d4dc5771..7fca2ae67 100644 --- a/src/FilterConfig.cxx +++ b/src/FilterConfig.cxx @@ -20,14 +20,10 @@ #include "config.h" #include "FilterConfig.hxx" #include "conf.h" - -extern "C" { -#include "filter/chain_filter_plugin.h" -} - -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "filter/ChainFilterPlugin.hxx" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include <glib.h> diff --git a/src/filter_internal.h b/src/FilterInternal.hxx index 4e94599a2..7ffcec334 100644 --- a/src/filter_internal.h +++ b/src/FilterInternal.hxx @@ -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 @@ -22,8 +22,8 @@ * Internal stuff for the filter core and filter plugins. */ -#ifndef MPD_FILTER_INTERNAL_H -#define MPD_FILTER_INTERNAL_H +#ifndef MPD_FILTER_INTERNAL_HXX +#define MPD_FILTER_INTERNAL_HXX struct filter { const struct filter_plugin *plugin; diff --git a/src/filter_plugin.c b/src/FilterPlugin.cxx index 2e3c8fec0..f1f7561a9 100644 --- a/src/filter_plugin.c +++ b/src/FilterPlugin.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,9 +18,9 @@ */ #include "config.h" -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include "conf.h" #include "ConfigQuark.hxx" diff --git a/src/filter_plugin.h b/src/FilterPlugin.hxx index ae14a245c..6476a621f 100644 --- a/src/filter_plugin.h +++ b/src/FilterPlugin.hxx @@ -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 @@ -23,12 +23,11 @@ * plugin API for objects which filter raw PCM data. */ -#ifndef MPD_FILTER_PLUGIN_H -#define MPD_FILTER_PLUGIN_H +#ifndef MPD_FILTER_PLUGIN_HXX +#define MPD_FILTER_PLUGIN_HXX #include "gerror.h" -#include <stdbool.h> #include <stddef.h> struct config_param; @@ -74,10 +73,6 @@ struct filter_plugin { GError **error_r); }; -#ifdef __cplusplus -extern "C" { -#endif - /** * 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, GError **error_r); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/filter_registry.c b/src/FilterRegistry.cxx index dc1889398..c8aff8298 100644 --- a/src/filter_registry.c +++ b/src/FilterRegistry.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,8 +18,8 @@ */ #include "config.h" -#include "filter_registry.h" -#include "filter_plugin.h" +#include "FilterRegistry.hxx" +#include "FilterPlugin.hxx" #include <stddef.h> #include <string.h> diff --git a/src/filter_registry.h b/src/FilterRegistry.hxx index d3949c7c4..c21d8a597 100644 --- a/src/filter_registry.h +++ b/src/FilterRegistry.hxx @@ -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 @@ -23,8 +23,8 @@ * compile time. */ -#ifndef MPD_FILTER_REGISTRY_H -#define MPD_FILTER_REGISTRY_H +#ifndef MPD_FILTER_REGISTRY_HXX +#define MPD_FILTER_REGISTRY_HXX extern const struct filter_plugin null_filter_plugin; extern const struct filter_plugin chain_filter_plugin; diff --git a/src/OutputControl.cxx b/src/OutputControl.cxx index 8e7447bc5..37565082e 100644 --- a/src/OutputControl.cxx +++ b/src/OutputControl.cxx @@ -30,7 +30,7 @@ extern "C" { #include "notify.hxx" #include "filter/ReplayGainFilterPlugin.hxx" -#include "filter_plugin.h" +#include "FilterPlugin.hxx" #include <assert.h> #include <stdlib.h> diff --git a/src/OutputFinish.cxx b/src/OutputFinish.cxx index ac6ad6977..f5a1f9921 100644 --- a/src/OutputFinish.cxx +++ b/src/OutputFinish.cxx @@ -23,9 +23,10 @@ extern "C" { #include "output_internal.h" #include "output_plugin.h" #include "mixer_control.h" -#include "filter_plugin.h" } +#include "FilterPlugin.hxx" + #include <assert.h> void diff --git a/src/OutputInit.cxx b/src/OutputInit.cxx index 6cd1e08ba..5acb8c6cb 100644 --- a/src/OutputInit.cxx +++ b/src/OutputInit.cxx @@ -30,14 +30,14 @@ extern "C" { #include "mixer_control.h" #include "mixer_type.h" #include "mixer_list.h" -#include "filter_plugin.h" -#include "filter_registry.h" -#include "filter/chain_filter_plugin.h" } #include "mixer/SoftwareMixerPlugin.hxx" +#include "FilterPlugin.hxx" +#include "FilterRegistry.hxx" #include "filter/AutoConvertFilterPlugin.hxx" #include "filter/ReplayGainFilterPlugin.hxx" +#include "filter/ChainFilterPlugin.hxx" #include <glib.h> diff --git a/src/OutputThread.cxx b/src/OutputThread.cxx index c7b01d957..e3efbceaa 100644 --- a/src/OutputThread.cxx +++ b/src/OutputThread.cxx @@ -24,10 +24,10 @@ extern "C" { #include "output_internal.h" -#include "filter_plugin.h" } #include "notify.hxx" +#include "FilterPlugin.hxx" #include "filter/ConvertFilterPlugin.hxx" #include "filter/ReplayGainFilterPlugin.hxx" #include "PlayerControl.hxx" diff --git a/src/filter/AutoConvertFilterPlugin.cxx b/src/filter/AutoConvertFilterPlugin.cxx index 3a8c087ba..2a183b579 100644 --- a/src/filter/AutoConvertFilterPlugin.cxx +++ b/src/filter/AutoConvertFilterPlugin.cxx @@ -20,9 +20,9 @@ #include "config.h" #include "AutoConvertFilterPlugin.hxx" #include "ConvertFilterPlugin.hxx" -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include "audio_format.h" #include <assert.h> diff --git a/src/filter/chain_filter_plugin.c b/src/filter/ChainFilterPlugin.cxx index 0788b6751..51eb4b6f6 100644 --- a/src/filter/chain_filter_plugin.c +++ b/src/filter/ChainFilterPlugin.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,26 @@ */ #include "config.h" +#include "ChainFilterPlugin.hxx" #include "conf.h" -#include "filter/chain_filter_plugin.h" -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include "audio_format.h" #include <glib.h> #include <assert.h> -struct filter_chain { +struct ChainFilter { /** the base class */ struct filter base; GSList *children; + + ChainFilter():children(nullptr) { + filter_init(&base, &chain_filter_plugin); + } }; static inline GQuark @@ -46,10 +50,7 @@ static struct filter * chain_filter_init(G_GNUC_UNUSED const struct config_param *param, G_GNUC_UNUSED GError **error_r) { - struct filter_chain *chain = g_new(struct filter_chain, 1); - - filter_init(&chain->base, &chain_filter_plugin); - chain->children = NULL; + ChainFilter *chain = new ChainFilter(); return &chain->base; } @@ -57,7 +58,7 @@ chain_filter_init(G_GNUC_UNUSED const struct config_param *param, static void chain_free_child(gpointer data, G_GNUC_UNUSED gpointer user_data) { - struct filter *filter = data; + struct filter *filter = (struct filter *)data; filter_free(filter); } @@ -65,12 +66,12 @@ chain_free_child(gpointer data, G_GNUC_UNUSED gpointer user_data) static void 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_free(chain->children); - g_free(chain); + delete chain; } /** @@ -78,10 +79,9 @@ chain_filter_finish(struct filter *_filter) * itself is not closed. */ 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; - struct filter *filter; while (true) { /* this assertion fails if #until does not exist @@ -93,7 +93,7 @@ chain_close_until(struct filter_chain *chain, const struct filter *until) break; /* close this filter */ - filter = i->data; + struct filter *filter = (struct filter *)i->data; filter_close(filter); 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, GError **error_r) { - struct filter_chain *chain = (struct filter_chain *)_filter; + ChainFilter *chain = (ChainFilter *)_filter; const struct audio_format *audio_format = in_audio_format; 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); if (audio_format == NULL) { @@ -151,7 +151,7 @@ chain_filter_open(struct filter *_filter, struct audio_format *in_audio_format, static void chain_close_child(gpointer data, G_GNUC_UNUSED gpointer user_data) { - struct filter *filter = data; + struct filter *filter = (struct filter *)data; filter_close(filter); } @@ -159,7 +159,7 @@ chain_close_child(gpointer data, G_GNUC_UNUSED gpointer user_data) static void 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); } @@ -169,10 +169,10 @@ chain_filter_filter(struct filter *_filter, const void *src, size_t src_size, 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)) { - struct filter *filter = i->data; + struct filter *filter = (struct filter *)i->data; /* feed the output of the previous filter as input into the current one */ @@ -187,12 +187,12 @@ chain_filter_filter(struct filter *_filter, } const struct filter_plugin chain_filter_plugin = { - .name = "chain", - .init = chain_filter_init, - .finish = chain_filter_finish, - .open = chain_filter_open, - .close = chain_filter_close, - .filter = chain_filter_filter, + "chain", + chain_filter_init, + chain_filter_finish, + chain_filter_open, + chain_filter_close, + chain_filter_filter, }; struct filter * @@ -208,8 +208,7 @@ filter_chain_new(void) void 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); } - diff --git a/src/filter/chain_filter_plugin.h b/src/filter/ChainFilterPlugin.hxx index 1dba46667..242d29dae 100644 --- a/src/filter/chain_filter_plugin.h +++ b/src/filter/ChainFilterPlugin.hxx @@ -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,8 +24,8 @@ * output to the next one. */ -#ifndef MPD_FILTER_CHAIN_H -#define MPD_FILTER_CHAIN_H +#ifndef MPD_FILTER_CHAIN_HXX +#define MPD_FILTER_CHAIN_HXX struct filter; diff --git a/src/filter/ConvertFilterPlugin.cxx b/src/filter/ConvertFilterPlugin.cxx index 6a5acd707..b07cf80f1 100644 --- a/src/filter/ConvertFilterPlugin.cxx +++ b/src/filter/ConvertFilterPlugin.cxx @@ -19,9 +19,9 @@ #include "config.h" #include "ConvertFilterPlugin.hxx" -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include "conf.h" #include "PcmConvert.hxx" #include "util/Manual.hxx" diff --git a/src/filter/normalize_filter_plugin.c b/src/filter/NormalizeFilterPlugin.cxx index 2151482e4..0dc36c5bc 100644 --- a/src/filter/normalize_filter_plugin.c +++ b/src/filter/NormalizeFilterPlugin.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,9 +18,9 @@ */ #include "config.h" -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include "pcm_buffer.h" #include "audio_format.h" #include "AudioCompress/compress.h" @@ -90,9 +90,8 @@ normalize_filter_filter(struct filter *_filter, G_GNUC_UNUSED GError **error_r) { 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); @@ -103,10 +102,10 @@ normalize_filter_filter(struct filter *_filter, } const struct filter_plugin normalize_filter_plugin = { - .name = "normalize", - .init = normalize_filter_init, - .finish = normalize_filter_finish, - .open = normalize_filter_open, - .close = normalize_filter_close, - .filter = normalize_filter_filter, + "normalize", + normalize_filter_init, + normalize_filter_finish, + normalize_filter_open, + normalize_filter_close, + normalize_filter_filter, }; diff --git a/src/filter/null_filter_plugin.c b/src/filter/NullFilterPlugin.cxx index 7728c55bf..9c1a9c959 100644 --- a/src/filter/null_filter_plugin.c +++ b/src/filter/NullFilterPlugin.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 @@ -25,9 +25,9 @@ */ #include "config.h" -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include <glib.h> #include <assert.h> @@ -85,10 +85,10 @@ null_filter_filter(struct filter *_filter, } const struct filter_plugin null_filter_plugin = { - .name = "null", - .init = null_filter_init, - .finish = null_filter_finish, - .open = null_filter_open, - .close = null_filter_close, - .filter = null_filter_filter, + "null", + null_filter_init, + null_filter_finish, + null_filter_open, + null_filter_close, + null_filter_filter, }; diff --git a/src/filter/ReplayGainFilterPlugin.cxx b/src/filter/ReplayGainFilterPlugin.cxx index 9fb412be7..856213530 100644 --- a/src/filter/ReplayGainFilterPlugin.cxx +++ b/src/filter/ReplayGainFilterPlugin.cxx @@ -19,9 +19,9 @@ #include "config.h" #include "ReplayGainFilterPlugin.hxx" -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include "audio_format.h" #include "replay_gain_info.h" #include "replay_gain_config.h" diff --git a/src/filter/route_filter_plugin.c b/src/filter/RouteFilterPlugin.cxx index c0ecbd9c8..35f8c5c76 100644 --- a/src/filter/route_filter_plugin.c +++ b/src/filter/RouteFilterPlugin.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 @@ -44,9 +44,9 @@ #include "ConfigQuark.hxx" #include "audio_format.h" #include "audio_check.h" -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include "pcm_buffer.h" #include <assert.h> @@ -188,7 +188,7 @@ route_filter_parse(const struct config_param *param, } // Allocate a map of "copy nothing to me" - filter->sources = + filter->sources = (signed char *) g_malloc(filter->min_output_channels * sizeof(signed char)); 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); // 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 uint8_t *chan_destination; // Grow our reusable buffer, if needed, and set the moving pointer *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 @@ -340,10 +341,10 @@ route_filter_filter(struct filter *_filter, } const struct filter_plugin route_filter_plugin = { - .name = "route", - .init = route_filter_init, - .finish = route_filter_finish, - .open = route_filter_open, - .close = route_filter_close, - .filter = route_filter_filter, + "route", + route_filter_init, + route_filter_finish, + route_filter_open, + route_filter_close, + route_filter_filter, }; diff --git a/src/filter/VolumeFilterPlugin.cxx b/src/filter/VolumeFilterPlugin.cxx index 5066ebbfa..f1a1f4784 100644 --- a/src/filter/VolumeFilterPlugin.cxx +++ b/src/filter/VolumeFilterPlugin.cxx @@ -19,9 +19,9 @@ #include "config.h" #include "VolumeFilterPlugin.hxx" -#include "filter_plugin.h" -#include "filter_internal.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterInternal.hxx" +#include "FilterRegistry.hxx" #include "conf.h" #include "pcm_buffer.h" #include "PcmVolume.hxx" diff --git a/src/mixer/SoftwareMixerPlugin.cxx b/src/mixer/SoftwareMixerPlugin.cxx index c06ce18ea..9b8f083f4 100644 --- a/src/mixer/SoftwareMixerPlugin.cxx +++ b/src/mixer/SoftwareMixerPlugin.cxx @@ -20,8 +20,8 @@ #include "config.h" #include "SoftwareMixerPlugin.hxx" #include "mixer_api.h" -#include "filter_plugin.h" -#include "filter_registry.h" +#include "FilterPlugin.hxx" +#include "FilterRegistry.hxx" #include "filter/VolumeFilterPlugin.hxx" #include "PcmVolume.hxx" |