From 01dd540d7ea062d08c5c6000422dbba197511efc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 30 Jan 2013 17:18:48 +0100 Subject: decoder_list: convert to C++ --- Makefile.am | 3 +- src/CommandLine.cxx | 2 +- src/DecoderList.cxx | 237 +++++++++++++++++++++++++++++++++++++++++++++++++ src/DecoderList.hxx | 63 +++++++++++++ src/DecoderPrint.cxx | 2 +- src/DecoderThread.cxx | 2 +- src/Main.cxx | 2 +- src/SongUpdate.cxx | 4 +- src/TagFile.cxx | 2 +- src/UpdateSong.cxx | 5 +- src/decoder_list.c | 237 ------------------------------------------------- src/decoder_list.h | 65 -------------- src/decoder_plugin.h | 8 ++ test/dump_playlist.cxx | 5 +- test/read_tags.cxx | 4 +- test/run_decoder.cxx | 4 +- 16 files changed, 320 insertions(+), 325 deletions(-) create mode 100644 src/DecoderList.cxx create mode 100644 src/DecoderList.hxx delete mode 100644 src/decoder_list.c delete mode 100644 src/decoder_list.h diff --git a/Makefile.am b/Makefile.am index 4b2d8d75..482e3892 100644 --- a/Makefile.am +++ b/Makefile.am @@ -77,7 +77,6 @@ mpd_headers = \ src/gerror.h \ src/glib_compat.h \ src/gcc.h \ - src/decoder_list.h \ src/decoder/pcm_decoder_plugin.h \ src/input_stream.h \ src/text_input_stream.h \ @@ -465,7 +464,7 @@ libdecoder_plugins_a_SOURCES = \ src/decoder/dsdlib.h \ src/decoder_buffer.c \ src/decoder_plugin.c \ - src/decoder_list.c + src/DecoderList.cxx src/DecoderList.hxx libdecoder_plugins_a_CPPFLAGS = $(AM_CPPFLAGS) \ $(VORBIS_CFLAGS) $(TREMOR_CFLAGS) \ $(patsubst -I%/FLAC,-I%,$(FLAC_CFLAGS)) \ diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx index 5384fc6d..0de211fd 100644 --- a/src/CommandLine.cxx +++ b/src/CommandLine.cxx @@ -22,7 +22,7 @@ #include "ls.hxx" #include "Log.hxx" #include "conf.h" -#include "decoder_list.h" +#include "DecoderList.hxx" #include "decoder_plugin.h" #include "OutputList.hxx" #include "output_plugin.h" diff --git a/src/DecoderList.cxx b/src/DecoderList.cxx new file mode 100644 index 00000000..da9c3fcc --- /dev/null +++ b/src/DecoderList.cxx @@ -0,0 +1,237 @@ +/* + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" +#include "DecoderList.hxx" +#include "decoder_plugin.h" +#include "conf.h" +#include "mpd_error.h" +#include "decoder/pcm_decoder_plugin.h" +#include "decoder/dsdiff_decoder_plugin.h" +#include "decoder/dsf_decoder_plugin.h" +#include "decoder/FLACDecoderPlugin.h" +#include "decoder/OpusDecoderPlugin.h" +#include "decoder/VorbisDecoderPlugin.h" +#include "decoder/AdPlugDecoderPlugin.h" +#include "decoder/WavpackDecoderPlugin.hxx" +#include "decoder/FfmpegDecoderPlugin.hxx" + +#include + +#include + +extern const struct decoder_plugin mad_decoder_plugin; +extern const struct decoder_plugin mpg123_decoder_plugin; +extern const struct decoder_plugin sndfile_decoder_plugin; +extern const struct decoder_plugin audiofile_decoder_plugin; +extern const struct decoder_plugin faad_decoder_plugin; +extern const struct decoder_plugin mpcdec_decoder_plugin; +extern const struct decoder_plugin modplug_decoder_plugin; +extern const struct decoder_plugin mikmod_decoder_plugin; +extern const struct decoder_plugin sidplay_decoder_plugin; +extern const struct decoder_plugin wildmidi_decoder_plugin; +extern const struct decoder_plugin fluidsynth_decoder_plugin; +extern const struct decoder_plugin gme_decoder_plugin; + +const struct decoder_plugin *const decoder_plugins[] = { +#ifdef HAVE_MAD + &mad_decoder_plugin, +#endif +#ifdef HAVE_MPG123 + &mpg123_decoder_plugin, +#endif +#ifdef ENABLE_VORBIS_DECODER + &vorbis_decoder_plugin, +#endif +#if defined(HAVE_FLAC) + &oggflac_decoder_plugin, +#endif +#ifdef HAVE_FLAC + &flac_decoder_plugin, +#endif +#ifdef HAVE_OPUS + &opus_decoder_plugin, +#endif +#ifdef ENABLE_SNDFILE + &sndfile_decoder_plugin, +#endif +#ifdef HAVE_AUDIOFILE + &audiofile_decoder_plugin, +#endif + &dsdiff_decoder_plugin, + &dsf_decoder_plugin, +#ifdef HAVE_FAAD + &faad_decoder_plugin, +#endif +#ifdef HAVE_MPCDEC + &mpcdec_decoder_plugin, +#endif +#ifdef HAVE_WAVPACK + &wavpack_decoder_plugin, +#endif +#ifdef HAVE_MODPLUG + &modplug_decoder_plugin, +#endif +#ifdef ENABLE_MIKMOD_DECODER + &mikmod_decoder_plugin, +#endif +#ifdef ENABLE_SIDPLAY + &sidplay_decoder_plugin, +#endif +#ifdef ENABLE_WILDMIDI + &wildmidi_decoder_plugin, +#endif +#ifdef ENABLE_FLUIDSYNTH + &fluidsynth_decoder_plugin, +#endif +#ifdef HAVE_ADPLUG + &adplug_decoder_plugin, +#endif +#ifdef HAVE_FFMPEG + &ffmpeg_decoder_plugin, +#endif +#ifdef HAVE_GME + &gme_decoder_plugin, +#endif + &pcm_decoder_plugin, + NULL +}; + +enum { + num_decoder_plugins = G_N_ELEMENTS(decoder_plugins) - 1, +}; + +/** which plugins have been initialized successfully? */ +bool decoder_plugins_enabled[num_decoder_plugins]; + +static unsigned +decoder_plugin_index(const struct decoder_plugin *plugin) +{ + unsigned i = 0; + + while (decoder_plugins[i] != plugin) + ++i; + + return i; +} + +static unsigned +decoder_plugin_next_index(const struct decoder_plugin *plugin) +{ + return plugin == 0 + ? 0 /* start with first plugin */ + : decoder_plugin_index(plugin) + 1; +} + +const struct decoder_plugin * +decoder_plugin_from_suffix(const char *suffix, + const struct decoder_plugin *plugin) +{ + if (suffix == NULL) + return NULL; + + for (unsigned i = decoder_plugin_next_index(plugin); + decoder_plugins[i] != NULL; ++i) { + plugin = decoder_plugins[i]; + if (decoder_plugins_enabled[i] && + decoder_plugin_supports_suffix(plugin, suffix)) + return plugin; + } + + return NULL; +} + +const struct decoder_plugin * +decoder_plugin_from_mime_type(const char *mimeType, unsigned int next) +{ + static unsigned i = num_decoder_plugins; + + if (mimeType == NULL) + return NULL; + + if (!next) + i = 0; + for (; decoder_plugins[i] != NULL; ++i) { + const struct decoder_plugin *plugin = decoder_plugins[i]; + if (decoder_plugins_enabled[i] && + decoder_plugin_supports_mime_type(plugin, mimeType)) { + ++i; + return plugin; + } + } + + return NULL; +} + +const struct decoder_plugin * +decoder_plugin_from_name(const char *name) +{ + decoder_plugins_for_each_enabled(plugin) + if (strcmp(plugin->name, name) == 0) + return plugin; + + return NULL; +} + +/** + * Find the "decoder" configuration block for the specified plugin. + * + * @param plugin_name the name of the decoder plugin + * @return the configuration block, or NULL if none was configured + */ +static const struct config_param * +decoder_plugin_config(const char *plugin_name) +{ + const struct config_param *param = NULL; + + while ((param = config_get_next_param(CONF_DECODER, param)) != NULL) { + const char *name = + config_get_block_string(param, "plugin", NULL); + if (name == NULL) + MPD_ERROR("decoder configuration without 'plugin' name in line %d", + param->line); + + if (strcmp(name, plugin_name) == 0) + return param; + } + + return NULL; +} + +void decoder_plugin_init_all(void) +{ + for (unsigned i = 0; decoder_plugins[i] != NULL; ++i) { + const struct decoder_plugin *plugin = decoder_plugins[i]; + const struct config_param *param = + decoder_plugin_config(plugin->name); + + if (!config_get_block_bool(param, "enabled", true)) + /* the plugin is disabled in mpd.conf */ + continue; + + if (decoder_plugin_init(plugin, param)) + decoder_plugins_enabled[i] = true; + } +} + +void decoder_plugin_deinit_all(void) +{ + decoder_plugins_for_each_enabled(plugin) + decoder_plugin_finish(plugin); +} diff --git a/src/DecoderList.hxx b/src/DecoderList.hxx new file mode 100644 index 00000000..8dab8724 --- /dev/null +++ b/src/DecoderList.hxx @@ -0,0 +1,63 @@ +/* + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DECODER_LIST_HXX +#define MPD_DECODER_LIST_HXX + +struct decoder_plugin; + +extern const struct decoder_plugin *const decoder_plugins[]; +extern bool decoder_plugins_enabled[]; + +#define decoder_plugins_for_each(plugin) \ + for (const struct decoder_plugin *plugin, \ + *const*decoder_plugin_iterator = &decoder_plugins[0]; \ + (plugin = *decoder_plugin_iterator) != NULL; \ + ++decoder_plugin_iterator) + +#define decoder_plugins_for_each_enabled(plugin) \ + decoder_plugins_for_each(plugin) \ + if (decoder_plugins_enabled[decoder_plugin_iterator - decoder_plugins]) + +/* interface for using plugins */ + +/** + * Find the next enabled decoder plugin which supports the specified suffix. + * + * @param suffix the file name suffix + * @param plugin the previous plugin, or NULL to find the first plugin + * @return a plugin, or NULL if none matches + */ +const struct decoder_plugin * +decoder_plugin_from_suffix(const char *suffix, + const struct decoder_plugin *plugin); + +const struct decoder_plugin * +decoder_plugin_from_mime_type(const char *mimeType, unsigned int next); + +const struct decoder_plugin * +decoder_plugin_from_name(const char *name); + +/* this is where we "load" all the "plugins" ;-) */ +void decoder_plugin_init_all(void); + +/* this is where we "unload" all the "plugins" */ +void decoder_plugin_deinit_all(void); + +#endif diff --git a/src/DecoderPrint.cxx b/src/DecoderPrint.cxx index 70c713e9..719a499e 100644 --- a/src/DecoderPrint.cxx +++ b/src/DecoderPrint.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "DecoderPrint.hxx" -#include "decoder_list.h" +#include "DecoderList.hxx" #include "decoder_plugin.h" #include "Client.hxx" diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx index ac89b54c..b7b0bf78 100644 --- a/src/DecoderThread.cxx +++ b/src/DecoderThread.cxx @@ -30,9 +30,9 @@ #include "decoder_api.h" #include "tag.h" #include "InputStream.hxx" +#include "DecoderList.hxx" extern "C" { -#include "decoder_list.h" #include "replay_gain_ape.h" #include "uri.h" } diff --git a/src/Main.cxx b/src/Main.cxx index 83baf4ca..ecea5984 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -50,13 +50,13 @@ #include "fs/Path.hxx" #include "PlaylistRegistry.hxx" #include "ZeroconfGlue.hxx" +#include "DecoderList.hxx" extern "C" { #include "daemon.h" #include "stats.h" #include "audio_config.h" #include "pcm_resample.h" -#include "decoder_list.h" } #include "mpd_error.h" diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx index ce678fe0..e0a8aca1 100644 --- a/src/SongUpdate.cxx +++ b/src/SongUpdate.cxx @@ -29,10 +29,10 @@ extern "C" { #include "fs/Path.hxx" #include "tag.h" #include "input_stream.h" +#include "decoder_plugin.h" +#include "DecoderList.hxx" extern "C" { -#include "decoder_list.h" -#include "decoder_plugin.h" #include "tag_ape.h" #include "tag_id3.h" #include "tag_handler.h" diff --git a/src/TagFile.cxx b/src/TagFile.cxx index f2a88abd..046778bd 100644 --- a/src/TagFile.cxx +++ b/src/TagFile.cxx @@ -22,9 +22,9 @@ extern "C" { #include "uri.h" -#include "decoder_list.h" } +#include "DecoderList.hxx" #include "decoder_plugin.h" #include "input_stream.h" diff --git a/src/UpdateSong.cxx b/src/UpdateSong.cxx index 7994ea75..676ba48e 100644 --- a/src/UpdateSong.cxx +++ b/src/UpdateSong.cxx @@ -27,10 +27,7 @@ #include "Directory.hxx" #include "song.h" #include "decoder_plugin.h" - -extern "C" { -#include "decoder_list.h" -} +#include "DecoderList.hxx" #include diff --git a/src/decoder_list.c b/src/decoder_list.c deleted file mode 100644 index 80f6db1f..00000000 --- a/src/decoder_list.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2003-2012 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "config.h" -#include "decoder_list.h" -#include "decoder_plugin.h" -#include "conf.h" -#include "mpd_error.h" -#include "decoder/pcm_decoder_plugin.h" -#include "decoder/dsdiff_decoder_plugin.h" -#include "decoder/dsf_decoder_plugin.h" -#include "decoder/FLACDecoderPlugin.h" -#include "decoder/OpusDecoderPlugin.h" -#include "decoder/VorbisDecoderPlugin.h" -#include "decoder/AdPlugDecoderPlugin.h" -#include "decoder/WavpackDecoderPlugin.hxx" -#include "decoder/FfmpegDecoderPlugin.hxx" - -#include - -#include - -extern const struct decoder_plugin mad_decoder_plugin; -extern const struct decoder_plugin mpg123_decoder_plugin; -extern const struct decoder_plugin sndfile_decoder_plugin; -extern const struct decoder_plugin audiofile_decoder_plugin; -extern const struct decoder_plugin faad_decoder_plugin; -extern const struct decoder_plugin mpcdec_decoder_plugin; -extern const struct decoder_plugin modplug_decoder_plugin; -extern const struct decoder_plugin mikmod_decoder_plugin; -extern const struct decoder_plugin sidplay_decoder_plugin; -extern const struct decoder_plugin wildmidi_decoder_plugin; -extern const struct decoder_plugin fluidsynth_decoder_plugin; -extern const struct decoder_plugin gme_decoder_plugin; - -const struct decoder_plugin *const decoder_plugins[] = { -#ifdef HAVE_MAD - &mad_decoder_plugin, -#endif -#ifdef HAVE_MPG123 - &mpg123_decoder_plugin, -#endif -#ifdef ENABLE_VORBIS_DECODER - &vorbis_decoder_plugin, -#endif -#if defined(HAVE_FLAC) - &oggflac_decoder_plugin, -#endif -#ifdef HAVE_FLAC - &flac_decoder_plugin, -#endif -#ifdef HAVE_OPUS - &opus_decoder_plugin, -#endif -#ifdef ENABLE_SNDFILE - &sndfile_decoder_plugin, -#endif -#ifdef HAVE_AUDIOFILE - &audiofile_decoder_plugin, -#endif - &dsdiff_decoder_plugin, - &dsf_decoder_plugin, -#ifdef HAVE_FAAD - &faad_decoder_plugin, -#endif -#ifdef HAVE_MPCDEC - &mpcdec_decoder_plugin, -#endif -#ifdef HAVE_WAVPACK - &wavpack_decoder_plugin, -#endif -#ifdef HAVE_MODPLUG - &modplug_decoder_plugin, -#endif -#ifdef ENABLE_MIKMOD_DECODER - &mikmod_decoder_plugin, -#endif -#ifdef ENABLE_SIDPLAY - &sidplay_decoder_plugin, -#endif -#ifdef ENABLE_WILDMIDI - &wildmidi_decoder_plugin, -#endif -#ifdef ENABLE_FLUIDSYNTH - &fluidsynth_decoder_plugin, -#endif -#ifdef HAVE_ADPLUG - &adplug_decoder_plugin, -#endif -#ifdef HAVE_FFMPEG - &ffmpeg_decoder_plugin, -#endif -#ifdef HAVE_GME - &gme_decoder_plugin, -#endif - &pcm_decoder_plugin, - NULL -}; - -enum { - num_decoder_plugins = G_N_ELEMENTS(decoder_plugins) - 1, -}; - -/** which plugins have been initialized successfully? */ -bool decoder_plugins_enabled[num_decoder_plugins]; - -static unsigned -decoder_plugin_index(const struct decoder_plugin *plugin) -{ - unsigned i = 0; - - while (decoder_plugins[i] != plugin) - ++i; - - return i; -} - -static unsigned -decoder_plugin_next_index(const struct decoder_plugin *plugin) -{ - return plugin == 0 - ? 0 /* start with first plugin */ - : decoder_plugin_index(plugin) + 1; -} - -const struct decoder_plugin * -decoder_plugin_from_suffix(const char *suffix, - const struct decoder_plugin *plugin) -{ - if (suffix == NULL) - return NULL; - - for (unsigned i = decoder_plugin_next_index(plugin); - decoder_plugins[i] != NULL; ++i) { - plugin = decoder_plugins[i]; - if (decoder_plugins_enabled[i] && - decoder_plugin_supports_suffix(plugin, suffix)) - return plugin; - } - - return NULL; -} - -const struct decoder_plugin * -decoder_plugin_from_mime_type(const char *mimeType, unsigned int next) -{ - static unsigned i = num_decoder_plugins; - - if (mimeType == NULL) - return NULL; - - if (!next) - i = 0; - for (; decoder_plugins[i] != NULL; ++i) { - const struct decoder_plugin *plugin = decoder_plugins[i]; - if (decoder_plugins_enabled[i] && - decoder_plugin_supports_mime_type(plugin, mimeType)) { - ++i; - return plugin; - } - } - - return NULL; -} - -const struct decoder_plugin * -decoder_plugin_from_name(const char *name) -{ - decoder_plugins_for_each_enabled(plugin) - if (strcmp(plugin->name, name) == 0) - return plugin; - - return NULL; -} - -/** - * Find the "decoder" configuration block for the specified plugin. - * - * @param plugin_name the name of the decoder plugin - * @return the configuration block, or NULL if none was configured - */ -static const struct config_param * -decoder_plugin_config(const char *plugin_name) -{ - const struct config_param *param = NULL; - - while ((param = config_get_next_param(CONF_DECODER, param)) != NULL) { - const char *name = - config_get_block_string(param, "plugin", NULL); - if (name == NULL) - MPD_ERROR("decoder configuration without 'plugin' name in line %d", - param->line); - - if (strcmp(name, plugin_name) == 0) - return param; - } - - return NULL; -} - -void decoder_plugin_init_all(void) -{ - for (unsigned i = 0; decoder_plugins[i] != NULL; ++i) { - const struct decoder_plugin *plugin = decoder_plugins[i]; - const struct config_param *param = - decoder_plugin_config(plugin->name); - - if (!config_get_block_bool(param, "enabled", true)) - /* the plugin is disabled in mpd.conf */ - continue; - - if (decoder_plugin_init(plugin, param)) - decoder_plugins_enabled[i] = true; - } -} - -void decoder_plugin_deinit_all(void) -{ - decoder_plugins_for_each_enabled(plugin) - decoder_plugin_finish(plugin); -} diff --git a/src/decoder_list.h b/src/decoder_list.h deleted file mode 100644 index d0a6ade7..00000000 --- a/src/decoder_list.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DECODER_LIST_H -#define MPD_DECODER_LIST_H - -#include - -struct decoder_plugin; - -extern const struct decoder_plugin *const decoder_plugins[]; -extern bool decoder_plugins_enabled[]; - -#define decoder_plugins_for_each(plugin) \ - for (const struct decoder_plugin *plugin, \ - *const*decoder_plugin_iterator = &decoder_plugins[0]; \ - (plugin = *decoder_plugin_iterator) != NULL; \ - ++decoder_plugin_iterator) - -#define decoder_plugins_for_each_enabled(plugin) \ - decoder_plugins_for_each(plugin) \ - if (decoder_plugins_enabled[decoder_plugin_iterator - decoder_plugins]) - -/* interface for using plugins */ - -/** - * Find the next enabled decoder plugin which supports the specified suffix. - * - * @param suffix the file name suffix - * @param plugin the previous plugin, or NULL to find the first plugin - * @return a plugin, or NULL if none matches - */ -const struct decoder_plugin * -decoder_plugin_from_suffix(const char *suffix, - const struct decoder_plugin *plugin); - -const struct decoder_plugin * -decoder_plugin_from_mime_type(const char *mimeType, unsigned int next); - -const struct decoder_plugin * -decoder_plugin_from_name(const char *name); - -/* this is where we "load" all the "plugins" ;-) */ -void decoder_plugin_init_all(void); - -/* this is where we "unload" all the "plugins" */ -void decoder_plugin_deinit_all(void); - -#endif diff --git a/src/decoder_plugin.h b/src/decoder_plugin.h index 933ba675..b7ab738b 100644 --- a/src/decoder_plugin.h +++ b/src/decoder_plugin.h @@ -190,6 +190,10 @@ decoder_plugin_container_scan( const struct decoder_plugin *plugin, return plugin->container_scan(pathname, tnum); } +#ifdef __cplusplus +extern "C" { +#endif + /** * Does the plugin announce the specified file name suffix? */ @@ -204,4 +208,8 @@ bool decoder_plugin_supports_mime_type(const struct decoder_plugin *plugin, const char *mime_type); +#ifdef __cplusplus +} +#endif + #endif diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx index ec09bcb2..6e1f4858 100644 --- a/test/dump_playlist.cxx +++ b/test/dump_playlist.cxx @@ -24,16 +24,13 @@ #include "input_stream.h" #include "conf.h" #include "decoder_api.h" +#include "DecoderList.hxx" #include "InputInit.hxx" #include "IOThread.hxx" #include "PlaylistRegistry.hxx" #include "PlaylistPlugin.hxx" #include "fs/Path.hxx" -extern "C" { -#include "decoder_list.h" -} - #include #include diff --git a/test/read_tags.cxx b/test/read_tags.cxx index ddd278ff..1ceddf1d 100644 --- a/test/read_tags.cxx +++ b/test/read_tags.cxx @@ -19,9 +19,7 @@ #include "config.h" #include "IOThread.hxx" -extern "C" { -#include "decoder_list.h" -} +#include "DecoderList.hxx" #include "decoder_api.h" #include "InputInit.hxx" #include "InputStream.hxx" diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx index 288b83f9..d5c7c313 100644 --- a/test/run_decoder.cxx +++ b/test/run_decoder.cxx @@ -19,9 +19,7 @@ #include "config.h" #include "IOThread.hxx" -extern "C" { -#include "decoder_list.h" -} +#include "DecoderList.hxx" #include "decoder_api.h" #include "InputInit.hxx" #include "input_stream.h" -- cgit v1.2.3