diff --git a/SConstruct b/SConstruct index 4ed3845f978..66c066b141f 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 8b7ec80dcdc..3862a095bab 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 32ffdb863f3..00000000000 --- 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 6d48d94d44e..1999a9a7c9c 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(); - -#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 00000000000..d2662c34ab8 --- /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 similarity index 100% rename from drivers/mpc/audio_stream_mpc.cpp rename to modules/mpc/audio_stream_mpc.cpp diff --git a/drivers/mpc/audio_stream_mpc.h b/modules/mpc/audio_stream_mpc.h similarity index 98% rename from drivers/mpc/audio_stream_mpc.h rename to modules/mpc/audio_stream_mpc.h index 27f55777d60..c982bdc3587 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 "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 "os/file_access.h" +#include "os/thread_safe.h" +#include "scene/resources/audio_stream.h" + +#include class AudioStreamPlaybackMPC : public AudioStreamPlayback { diff --git a/modules/mpc/config.py b/modules/mpc/config.py new file mode 100644 index 00000000000..368e97e152c --- /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 00000000000..f6a1f59dcab --- /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(); +} + +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 00000000000..3d0661ed627 --- /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 fce680b0021..fce57acc3be 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 a567eb177de..39809e079c6 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 00000000000..10190c014a4 --- /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 similarity index 100% rename from drivers/mpc/decoder.h rename to thirdparty/libmpcdec/decoder.h diff --git a/drivers/mpc/huffman.c b/thirdparty/libmpcdec/huffman.c similarity index 100% rename from drivers/mpc/huffman.c rename to thirdparty/libmpcdec/huffman.c diff --git a/drivers/mpc/huffman.h b/thirdparty/libmpcdec/huffman.h similarity index 100% rename from drivers/mpc/huffman.h rename to thirdparty/libmpcdec/huffman.h diff --git a/drivers/mpc/internal.h b/thirdparty/libmpcdec/internal.h similarity index 100% rename from drivers/mpc/internal.h rename to thirdparty/libmpcdec/internal.h diff --git a/drivers/mpc/datatypes.h b/thirdparty/libmpcdec/mpc/datatypes.h similarity index 100% rename from drivers/mpc/datatypes.h rename to thirdparty/libmpcdec/mpc/datatypes.h diff --git a/drivers/mpc/minimax.h b/thirdparty/libmpcdec/mpc/minimax.h similarity index 100% rename from drivers/mpc/minimax.h rename to thirdparty/libmpcdec/mpc/minimax.h diff --git a/drivers/mpc/mpc_types.h b/thirdparty/libmpcdec/mpc/mpc_types.h similarity index 100% rename from drivers/mpc/mpc_types.h rename to thirdparty/libmpcdec/mpc/mpc_types.h diff --git a/drivers/mpc/mpcdec.h b/thirdparty/libmpcdec/mpc/mpcdec.h similarity index 100% rename from drivers/mpc/mpcdec.h rename to thirdparty/libmpcdec/mpc/mpcdec.h diff --git a/drivers/mpc/mpcmath.h b/thirdparty/libmpcdec/mpc/mpcmath.h similarity index 100% rename from drivers/mpc/mpcmath.h rename to thirdparty/libmpcdec/mpc/mpcmath.h diff --git a/drivers/mpc/reader.h b/thirdparty/libmpcdec/mpc/reader.h similarity index 100% rename from drivers/mpc/reader.h rename to thirdparty/libmpcdec/mpc/reader.h diff --git a/drivers/mpc/streaminfo.h b/thirdparty/libmpcdec/mpc/streaminfo.h similarity index 100% rename from drivers/mpc/streaminfo.h rename to thirdparty/libmpcdec/mpc/streaminfo.h diff --git a/drivers/mpc/mpc_bits_reader.c b/thirdparty/libmpcdec/mpc_bits_reader.c similarity index 100% rename from drivers/mpc/mpc_bits_reader.c rename to thirdparty/libmpcdec/mpc_bits_reader.c diff --git a/drivers/mpc/mpc_bits_reader.h b/thirdparty/libmpcdec/mpc_bits_reader.h similarity index 100% rename from drivers/mpc/mpc_bits_reader.h rename to thirdparty/libmpcdec/mpc_bits_reader.h diff --git a/drivers/mpc/mpc_decoder.c b/thirdparty/libmpcdec/mpc_decoder.c similarity index 100% rename from drivers/mpc/mpc_decoder.c rename to thirdparty/libmpcdec/mpc_decoder.c diff --git a/drivers/mpc/mpc_demux.c b/thirdparty/libmpcdec/mpc_demux.c similarity index 100% rename from drivers/mpc/mpc_demux.c rename to thirdparty/libmpcdec/mpc_demux.c diff --git a/drivers/mpc/mpc_reader.c b/thirdparty/libmpcdec/mpc_reader.c similarity index 100% rename from drivers/mpc/mpc_reader.c rename to thirdparty/libmpcdec/mpc_reader.c diff --git a/drivers/mpc/mpcdec_math.h b/thirdparty/libmpcdec/mpcdec_math.h similarity index 100% rename from drivers/mpc/mpcdec_math.h rename to thirdparty/libmpcdec/mpcdec_math.h diff --git a/drivers/mpc/requant.c b/thirdparty/libmpcdec/requant.c similarity index 100% rename from drivers/mpc/requant.c rename to thirdparty/libmpcdec/requant.c diff --git a/drivers/mpc/requant.h b/thirdparty/libmpcdec/requant.h similarity index 100% rename from drivers/mpc/requant.h rename to thirdparty/libmpcdec/requant.h diff --git a/drivers/mpc/streaminfo.c b/thirdparty/libmpcdec/streaminfo.c similarity index 100% rename from drivers/mpc/streaminfo.c rename to thirdparty/libmpcdec/streaminfo.c diff --git a/drivers/mpc/synth_filter.c b/thirdparty/libmpcdec/synth_filter.c similarity index 100% rename from drivers/mpc/synth_filter.c rename to thirdparty/libmpcdec/synth_filter.c