Skip to content

Commit

Permalink
theora: Move to a module and split thirdparty lib
Browse files Browse the repository at this point in the history
Same rationale as the previous commits.
  • Loading branch information
akien-mga committed Oct 15, 2016
1 parent da09c61 commit cfcc8a2
Show file tree
Hide file tree
Showing 88 changed files with 199 additions and 178 deletions.
10 changes: 1 addition & 9 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ opts.Add('tools','Build Tools (Including Editor): (yes/no)','yes')
opts.Add('gdscript','Build GDSCript support: (yes/no)','yes')
opts.Add('libogg','Ogg library for ogg container support (system/builtin)','builtin')
opts.Add('libvorbis','Ogg Vorbis library for vorbis support (system/builtin)','builtin')
opts.Add('libtheora','Theora library for theora module (system/builtin)','builtin')
opts.Add('opus','Opus and opusfile library for Opus format support: (system/builtin)','builtin')
opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes')
opts.Add('squish','Squish BC Texture Compression in editor (yes/no)','yes')
opts.Add('theora','Theora Video (yes/no)','yes')
opts.Add('theoralib','Theora Video (yes/no)','no')
opts.Add('freetype','Freetype support in editor','builtin')
opts.Add('xml','XML Save/Load support (yes/no)','yes')
opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin')
Expand Down Expand Up @@ -331,13 +330,6 @@ if selected_platform in platform_list:
if (env_base['squish']=='yes'):
env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);


if (env['theora']=='yes'):
env['theoralib']='yes'
env.Append(CPPFLAGS=['-DTHEORA_ENABLED']);
if (env['theoralib']=='yes'):
env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);

if (env['tools']=='yes'):
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
if (env['disable_3d']=='yes'):
Expand Down
2 changes: 0 additions & 2 deletions drivers/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ SConscript("chibi/SCsub");
if (env["tools"]=="yes"):
SConscript("convex_decomp/SCsub");

if (env["theoralib"]=="yes"):
SConscript("theora/SCsub");
if (env['musepack']=='yes'):
SConscript("mpc/SCsub");
if (env["squish"]=="yes" and env["tools"]=="yes"):
Expand Down
22 changes: 1 addition & 21 deletions drivers/register_driver_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
/*************************************************************************/
#include "register_driver_types.h"

#include "core/math/geometry.h"
#include "png/image_loader_png.h"
#include "png/resource_saver_png.h"
#include "chibi/event_stream_chibi.h"
Expand All @@ -45,11 +46,6 @@
#include "platform/windows/export/export.h"
#endif

#ifdef THEORA_ENABLED
#include "theora/video_stream_theora.h"
#endif


#include "drivers/nrex/regex.h"

#ifdef MUSEPACK_ENABLED
Expand All @@ -59,10 +55,6 @@
static ImageLoaderPNG *image_loader_png=NULL;
static ResourceSaverPNG *resource_saver_png=NULL;

#ifdef THEORA_ENABLED
static ResourceFormatLoaderVideoStreamTheora* theora_stream_loader = NULL;
#endif

#ifdef MUSEPACK_ENABLED
static ResourceFormatLoaderAudioStreamMPC * mpc_stream_loader=NULL;
#endif
Expand Down Expand Up @@ -103,13 +95,6 @@ void register_driver_types() {

#endif

#ifdef THEORA_ENABLED
theora_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheora );
ResourceLoader::add_resource_format_loader(theora_stream_loader);
ObjectTypeDB::register_type<VideoStreamTheora>();
#endif


#ifdef TOOLS_ENABLED
#ifdef SQUISH_ENABLED

Expand All @@ -123,11 +108,6 @@ void register_driver_types() {

void unregister_driver_types() {

#ifdef THEORA_ENABLED
memdelete (theora_stream_loader);
#endif


#ifdef MUSEPACK_ENABLED

memdelete (mpc_stream_loader);
Expand Down
65 changes: 0 additions & 65 deletions drivers/theora/SCsub

This file was deleted.

55 changes: 0 additions & 55 deletions drivers/theora/theora.exp

This file was deleted.

81 changes: 81 additions & 0 deletions modules/theora/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
Import('env')
Import('env_modules')

env_theora = env_modules.Clone()

# Thirdparty source files
if (env["libtheora"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libtheora/"
thirdparty_sources = [
"analyze.c",
"apiwrapper.c",
"bitpack.c",
"cpu.c",
"decapiwrapper.c",
"decinfo.c",
"decode.c",
"dequant.c",
"encapiwrapper.c",
"encfrag.c",
"encinfo.c",
"encode.c",
"encoder_disabled.c",
"enquant.c",
"fdct.c",
"fragment.c",
"huffdec.c",
"huffenc.c",
"idct.c",
"info.c",
"internal.c",
"mathops.c",
"mcenc.c",
"quant.c",
"rate.c",
"state.c",
"tokenize.c",
]

thirdparty_sources_x86 = [
"x86/mmxencfrag.c",
"x86/mmxfdct.c",
"x86/mmxfrag.c",
"x86/mmxidct.c",
"x86/mmxstate.c",
"x86/sse2fdct.c",
"x86/x86enc.c",
"x86/x86state.c",
]

thirdparty_sources_x86_vc = [
"x86_vc/mmxencfrag.c",
"x86_vc/mmxfdct.c",
"x86_vc/mmxfrag.c",
"x86_vc/mmxidct.c",
"x86_vc/mmxstate.c",
"x86_vc/x86enc.c",
"x86_vc/x86state.c",
]

if (env["x86_opt_gcc"]):
thirdparty_sources += thirdparty_sources_x86

if (env["x86_opt_vc"]):
thirdparty_sources += thirdparty_sources_x86_vc

if (env["x86_opt_gcc"] or env["x86_opt_vc"]):
env_theora.Append(CCFLAGS = ["-DOC_X86_ASM"])

thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]

env_theora.add_source_files(env.modules_sources, thirdparty_sources)
env_theora.Append(CPPPATH = [thirdparty_dir])

# also requires libogg and libvorbis
if (env["libogg"] != "system"): # builtin
env_theora.Append(CPPPATH = ["#thirdparty/libogg"])
if (env["libvorbis"] != "system"): # builtin
env_theora.Append(CPPPATH = ["#thirdparty/libvorbis"])

# Godot source files
env_theora.add_source_files(env.modules_sources, "*.cpp")
6 changes: 6 additions & 0 deletions modules/theora/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

def can_build(platform):
return True

def configure(env):
pass
45 changes: 45 additions & 0 deletions modules/theora/register_types.cpp
Original file line number Diff line number Diff line change
@@ -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 "video_stream_theora.h"

static ResourceFormatLoaderVideoStreamTheora* theora_stream_loader = NULL;

void register_theora_types() {

theora_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheora );
ResourceLoader::add_resource_format_loader(theora_stream_loader);
ObjectTypeDB::register_type<VideoStreamTheora>();
}

void unregister_theora_types() {

memdelete( theora_stream_loader );
}
30 changes: 30 additions & 0 deletions modules/theora/register_types.h
Original file line number Diff line number Diff line change
@@ -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_theora_types();
void unregister_theora_types();
Loading

0 comments on commit cfcc8a2

Please sign in to comment.