diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2016-10-13 20:46:42 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2016-10-15 11:50:42 +0200 |
commit | 5c12c9e69b85023934dc85f3aada03da150556be (patch) | |
tree | 9893e468cd3116e6f42a7d90dd9dbc08934280c3 | |
parent | cfcc8a20e862b758c32bd3f152186e6df0591a24 (diff) |
mpc: Move to a module and split thirdparty libmpcdec
-rw-r--r-- | SConstruct | 5 | ||||
-rw-r--r-- | drivers/SCsub | 2 | ||||
-rw-r--r-- | drivers/mpc/SCsub | 21 | ||||
-rw-r--r-- | drivers/register_driver_types.cpp | 21 | ||||
-rw-r--r-- | modules/mpc/SCsub | 26 | ||||
-rw-r--r-- | modules/mpc/audio_stream_mpc.cpp (renamed from drivers/mpc/audio_stream_mpc.cpp) | 0 | ||||
-rw-r--r-- | modules/mpc/audio_stream_mpc.h (renamed from drivers/mpc/audio_stream_mpc.h) | 9 | ||||
-rw-r--r-- | modules/mpc/config.py | 6 | ||||
-rw-r--r-- | modules/mpc/register_types.cpp | 45 | ||||
-rw-r--r-- | modules/mpc/register_types.h | 30 | ||||
-rw-r--r-- | platform/javascript/detect.py | 2 | ||||
-rw-r--r-- | thirdparty/README.md | 13 | ||||
-rw-r--r-- | thirdparty/libmpcdec/COPYING | 31 | ||||
-rw-r--r-- | thirdparty/libmpcdec/decoder.h (renamed from drivers/mpc/decoder.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/huffman.c (renamed from drivers/mpc/huffman.c) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/huffman.h (renamed from drivers/mpc/huffman.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/internal.h (renamed from drivers/mpc/internal.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc/datatypes.h (renamed from drivers/mpc/datatypes.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc/minimax.h (renamed from drivers/mpc/minimax.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc/mpc_types.h (renamed from drivers/mpc/mpc_types.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc/mpcdec.h (renamed from drivers/mpc/mpcdec.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc/mpcmath.h (renamed from drivers/mpc/mpcmath.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc/reader.h (renamed from drivers/mpc/reader.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc/streaminfo.h (renamed from drivers/mpc/streaminfo.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc_bits_reader.c (renamed from drivers/mpc/mpc_bits_reader.c) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc_bits_reader.h (renamed from drivers/mpc/mpc_bits_reader.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc_decoder.c (renamed from drivers/mpc/mpc_decoder.c) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc_demux.c (renamed from drivers/mpc/mpc_demux.c) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpc_reader.c (renamed from drivers/mpc/mpc_reader.c) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/mpcdec_math.h (renamed from drivers/mpc/mpcdec_math.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/requant.c (renamed from drivers/mpc/requant.c) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/requant.h (renamed from drivers/mpc/requant.h) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/streaminfo.c (renamed from drivers/mpc/streaminfo.c) | 0 | ||||
-rw-r--r-- | thirdparty/libmpcdec/synth_filter.c (renamed from drivers/mpc/synth_filter.c) | 0 |
34 files changed, 157 insertions, 54 deletions
diff --git a/SConstruct b/SConstruct index 4ed3845f97..66c066b141 100644 --- a/SConstruct +++ b/SConstruct @@ -131,7 +131,7 @@ opts.Add('libpng','libpng library for image loader support (system/builtin)','bu opts.Add('libwebp','libwebp library for webp module (system/builtin)','builtin') opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes') opts.Add('openssl','OpenSSL library for openssl module (system/builtin)','builtin') -opts.Add('musepack','Musepack Audio (yes/no)','yes') +opts.Add('libmpcdec','libmpcdec library for mpc module (system/builtin)','builtin') opts.Add('enet','ENet library (system/builtin)','builtin') opts.Add("CXX", "C++ Compiler") opts.Add("CC", "C Compiler") @@ -318,9 +318,6 @@ if selected_platform in platform_list: if (env.use_ptrcall): env.Append(CPPFLAGS=['-DPTRCALL_ENABLED']); - if (env['musepack']=='yes'): - env.Append(CPPFLAGS=['-DMUSEPACK_ENABLED']); - if (env["builtin_zlib"]=='yes'): env.Append(CPPPATH=['#drivers/builtin_zlib/zlib']) diff --git a/drivers/SCsub b/drivers/SCsub index 8b7ec80dcd..3862a095ba 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -24,8 +24,6 @@ SConscript("chibi/SCsub"); if (env["tools"]=="yes"): SConscript("convex_decomp/SCsub"); -if (env['musepack']=='yes'): - SConscript("mpc/SCsub"); if (env["squish"]=="yes" and env["tools"]=="yes"): SConscript("squish/SCsub"); if (env["freetype"]!="no"): diff --git a/drivers/mpc/SCsub b/drivers/mpc/SCsub deleted file mode 100644 index 32ffdb863f..0000000000 --- a/drivers/mpc/SCsub +++ /dev/null @@ -1,21 +0,0 @@ -Import('env') - - -mpc_sources = [ - "mpc/huffman.c", - "mpc/mpc_bits_reader.c", - "mpc/mpc_decoder.c", - "mpc/mpc_demux.c", - "mpc/mpc_reader.c", - "mpc/requant.c", - "mpc/streaminfo.c", - "mpc/synth_filter.c", -] - -env.drivers_sources+=mpc_sources - -env.add_source_files(env.drivers_sources,"*.cpp") - -#env.add_source_files(env.drivers_sources, mpc_sources) - -Export('env') diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp index 6d48d94d44..1999a9a7c9 100644 --- a/drivers/register_driver_types.cpp +++ b/drivers/register_driver_types.cpp @@ -48,17 +48,9 @@ #include "drivers/nrex/regex.h" -#ifdef MUSEPACK_ENABLED -#include "mpc/audio_stream_mpc.h" -#endif - static ImageLoaderPNG *image_loader_png=NULL; static ResourceSaverPNG *resource_saver_png=NULL; -#ifdef MUSEPACK_ENABLED -static ResourceFormatLoaderAudioStreamMPC * mpc_stream_loader=NULL; -#endif - void register_core_driver_types() { @@ -87,14 +79,6 @@ void register_driver_types() { Geometry::_decompose_func=b2d_decompose; #endif -#ifdef MUSEPACK_ENABLED - - mpc_stream_loader=memnew( ResourceFormatLoaderAudioStreamMPC ); - ResourceLoader::add_resource_format_loader(mpc_stream_loader); - ObjectTypeDB::register_type<AudioStreamMPC>(); - -#endif - #ifdef TOOLS_ENABLED #ifdef SQUISH_ENABLED @@ -108,10 +92,5 @@ void register_driver_types() { void unregister_driver_types() { -#ifdef MUSEPACK_ENABLED - - memdelete (mpc_stream_loader); -#endif - finalize_chibi(); } diff --git a/modules/mpc/SCsub b/modules/mpc/SCsub new file mode 100644 index 0000000000..d2662c34ab --- /dev/null +++ b/modules/mpc/SCsub @@ -0,0 +1,26 @@ +Import('env') +Import('env_modules') + +env_mpc = env_modules.Clone() + +# Thirdparty source files +if (env["libmpcdec"] != "system"): # builtin + thirdparty_dir = "#thirdparty/libmpcdec/" + thirdparty_sources = [ + "huffman.c", + "mpc_bits_reader.c", + "mpc_decoder.c", + "mpc_demux.c", + "mpc_reader.c", + "requant.c", + "streaminfo.c", + "synth_filter.c", + ] + + thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] + + env_mpc.add_source_files(env.modules_sources, thirdparty_sources) + env_mpc.Append(CPPPATH = [thirdparty_dir]) + +# Godot source files +env_mpc.add_source_files(env.modules_sources, "*.cpp") diff --git a/drivers/mpc/audio_stream_mpc.cpp b/modules/mpc/audio_stream_mpc.cpp index 9713eb3c77..9713eb3c77 100644 --- a/drivers/mpc/audio_stream_mpc.cpp +++ b/modules/mpc/audio_stream_mpc.cpp diff --git a/drivers/mpc/audio_stream_mpc.h b/modules/mpc/audio_stream_mpc.h index 27f55777d6..c982bdc358 100644 --- a/drivers/mpc/audio_stream_mpc.h +++ b/modules/mpc/audio_stream_mpc.h @@ -29,13 +29,12 @@ #ifndef AUDIO_STREAM_MPC_H #define AUDIO_STREAM_MPC_H -#include "scene/resources/audio_stream.h" +#include "io/resource_loader.h" #include "os/file_access.h" -#include "mpc/mpcdec.h" #include "os/thread_safe.h" -#include "io/resource_loader.h" -//#include "../libmpcdec/decoder.h" -//#include "../libmpcdec/internal.h" +#include "scene/resources/audio_stream.h" + +#include <mpc/mpcdec.h> class AudioStreamPlaybackMPC : public AudioStreamPlayback { diff --git a/modules/mpc/config.py b/modules/mpc/config.py new file mode 100644 index 0000000000..368e97e152 --- /dev/null +++ b/modules/mpc/config.py @@ -0,0 +1,6 @@ + +def can_build(platform): + return True + +def configure(env): + pass diff --git a/modules/mpc/register_types.cpp b/modules/mpc/register_types.cpp new file mode 100644 index 0000000000..f6a1f59dca --- /dev/null +++ b/modules/mpc/register_types.cpp @@ -0,0 +1,45 @@ +/*************************************************************************/ +/* register_types.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "register_types.h" + +#include "audio_stream_mpc.h" + +static ResourceFormatLoaderAudioStreamMPC* mpc_stream_loader = NULL; + +void register_mpc_types() { + + mpc_stream_loader=memnew( ResourceFormatLoaderAudioStreamMPC ); + ResourceLoader::add_resource_format_loader(mpc_stream_loader); + ObjectTypeDB::register_type<AudioStreamMPC>(); +} + +void unregister_mpc_types() { + + memdelete( mpc_stream_loader ); +} diff --git a/modules/mpc/register_types.h b/modules/mpc/register_types.h new file mode 100644 index 0000000000..3d0661ed62 --- /dev/null +++ b/modules/mpc/register_types.h @@ -0,0 +1,30 @@ +/*************************************************************************/ +/* register_types.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +void register_mpc_types(); +void unregister_mpc_types(); diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index fce680b002..fce57acc3b 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -26,9 +26,9 @@ def get_flags(): return [ ('tools', 'no'), - ('musepack', 'no'), ('squish', 'no'), ('etc1', 'no'), + ('module_mpc_enabled', 'no'), ('module_theora_enabled', 'no'), ] diff --git a/thirdparty/README.md b/thirdparty/README.md index a567eb177d..39809e079c 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -29,6 +29,19 @@ Files extracted from upstream source: - jpgd.{c,h} +## libmpcdec + +- Upstream: https://www.musepack.net +- Version: SVN somewhere between SV7 and SV8 (r475) +- License: BSD-3-Clause + +Files extracted from upstream source: + +- all .c and .h files in libmpcdec/ +- include/mpc as mpc/ +- COPYING from libmpcdec/ + + ## libogg - Upstream: https://www.xiph.org/ogg diff --git a/thirdparty/libmpcdec/COPYING b/thirdparty/libmpcdec/COPYING new file mode 100644 index 0000000000..10190c014a --- /dev/null +++ b/thirdparty/libmpcdec/COPYING @@ -0,0 +1,31 @@ +Copyright (c) 2005, The Musepack Development Team +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/drivers/mpc/decoder.h b/thirdparty/libmpcdec/decoder.h index 3813fc02ea..3813fc02ea 100644 --- a/drivers/mpc/decoder.h +++ b/thirdparty/libmpcdec/decoder.h diff --git a/drivers/mpc/huffman.c b/thirdparty/libmpcdec/huffman.c index 52cdfd92c4..52cdfd92c4 100644 --- a/drivers/mpc/huffman.c +++ b/thirdparty/libmpcdec/huffman.c diff --git a/drivers/mpc/huffman.h b/thirdparty/libmpcdec/huffman.h index 5b12bff931..5b12bff931 100644 --- a/drivers/mpc/huffman.h +++ b/thirdparty/libmpcdec/huffman.h diff --git a/drivers/mpc/internal.h b/thirdparty/libmpcdec/internal.h index 7810bcc25d..7810bcc25d 100644 --- a/drivers/mpc/internal.h +++ b/thirdparty/libmpcdec/internal.h diff --git a/drivers/mpc/datatypes.h b/thirdparty/libmpcdec/mpc/datatypes.h index 608ecfa2f2..608ecfa2f2 100644 --- a/drivers/mpc/datatypes.h +++ b/thirdparty/libmpcdec/mpc/datatypes.h diff --git a/drivers/mpc/minimax.h b/thirdparty/libmpcdec/mpc/minimax.h index 1192626567..1192626567 100644 --- a/drivers/mpc/minimax.h +++ b/thirdparty/libmpcdec/mpc/minimax.h diff --git a/drivers/mpc/mpc_types.h b/thirdparty/libmpcdec/mpc/mpc_types.h index a827d15725..a827d15725 100644 --- a/drivers/mpc/mpc_types.h +++ b/thirdparty/libmpcdec/mpc/mpc_types.h diff --git a/drivers/mpc/mpcdec.h b/thirdparty/libmpcdec/mpc/mpcdec.h index c72359516c..c72359516c 100644 --- a/drivers/mpc/mpcdec.h +++ b/thirdparty/libmpcdec/mpc/mpcdec.h diff --git a/drivers/mpc/mpcmath.h b/thirdparty/libmpcdec/mpc/mpcmath.h index fa83cf8374..fa83cf8374 100644 --- a/drivers/mpc/mpcmath.h +++ b/thirdparty/libmpcdec/mpc/mpcmath.h diff --git a/drivers/mpc/reader.h b/thirdparty/libmpcdec/mpc/reader.h index 1a93e06706..1a93e06706 100644 --- a/drivers/mpc/reader.h +++ b/thirdparty/libmpcdec/mpc/reader.h diff --git a/drivers/mpc/streaminfo.h b/thirdparty/libmpcdec/mpc/streaminfo.h index a0a9470be1..a0a9470be1 100644 --- a/drivers/mpc/streaminfo.h +++ b/thirdparty/libmpcdec/mpc/streaminfo.h diff --git a/drivers/mpc/mpc_bits_reader.c b/thirdparty/libmpcdec/mpc_bits_reader.c index 5281288d25..5281288d25 100644 --- a/drivers/mpc/mpc_bits_reader.c +++ b/thirdparty/libmpcdec/mpc_bits_reader.c diff --git a/drivers/mpc/mpc_bits_reader.h b/thirdparty/libmpcdec/mpc_bits_reader.h index a7d8d66905..a7d8d66905 100644 --- a/drivers/mpc/mpc_bits_reader.h +++ b/thirdparty/libmpcdec/mpc_bits_reader.h diff --git a/drivers/mpc/mpc_decoder.c b/thirdparty/libmpcdec/mpc_decoder.c index 45596c6015..45596c6015 100644 --- a/drivers/mpc/mpc_decoder.c +++ b/thirdparty/libmpcdec/mpc_decoder.c diff --git a/drivers/mpc/mpc_demux.c b/thirdparty/libmpcdec/mpc_demux.c index 03bca9c36e..03bca9c36e 100644 --- a/drivers/mpc/mpc_demux.c +++ b/thirdparty/libmpcdec/mpc_demux.c diff --git a/drivers/mpc/mpc_reader.c b/thirdparty/libmpcdec/mpc_reader.c index 550c5ecb54..550c5ecb54 100644 --- a/drivers/mpc/mpc_reader.c +++ b/thirdparty/libmpcdec/mpc_reader.c diff --git a/drivers/mpc/mpcdec_math.h b/thirdparty/libmpcdec/mpcdec_math.h index 35a5ac5a57..35a5ac5a57 100644 --- a/drivers/mpc/mpcdec_math.h +++ b/thirdparty/libmpcdec/mpcdec_math.h diff --git a/drivers/mpc/requant.c b/thirdparty/libmpcdec/requant.c index ebc89a10f0..ebc89a10f0 100644 --- a/drivers/mpc/requant.c +++ b/thirdparty/libmpcdec/requant.c diff --git a/drivers/mpc/requant.h b/thirdparty/libmpcdec/requant.h index 014e2ebab7..014e2ebab7 100644 --- a/drivers/mpc/requant.h +++ b/thirdparty/libmpcdec/requant.h diff --git a/drivers/mpc/streaminfo.c b/thirdparty/libmpcdec/streaminfo.c index d9b76bb5e6..d9b76bb5e6 100644 --- a/drivers/mpc/streaminfo.c +++ b/thirdparty/libmpcdec/streaminfo.c diff --git a/drivers/mpc/synth_filter.c b/thirdparty/libmpcdec/synth_filter.c index 0d0c345340..0d0c345340 100644 --- a/drivers/mpc/synth_filter.c +++ b/thirdparty/libmpcdec/synth_filter.c |