summaryrefslogtreecommitdiff
path: root/modules/webm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webm')
-rw-r--r--modules/webm/SCsub15
-rw-r--r--modules/webm/libvpx/SCsub27
-rw-r--r--modules/webm/video_stream_webm.cpp7
-rw-r--r--modules/webm/video_stream_webm.h3
4 files changed, 32 insertions, 20 deletions
diff --git a/modules/webm/SCsub b/modules/webm/SCsub
index 33561da098..cb35b926ab 100644
--- a/modules/webm/SCsub
+++ b/modules/webm/SCsub
@@ -6,17 +6,16 @@ Import('env_modules')
env_webm = env_modules.Clone()
# Thirdparty source files
-thirdparty_libsimplewebm_dir = "#thirdparty/libsimplewebm/"
-thirdparty_libsimplewebm_sources = [
+thirdparty_dir = "#thirdparty/libsimplewebm/"
+thirdparty_sources = [
"libwebm/mkvparser/mkvparser.cc",
"OpusVorbisDecoder.cpp",
"VPXDecoder.cpp",
"WebMDemuxer.cpp",
]
-thirdparty_libsimplewebm_sources = [thirdparty_libsimplewebm_dir + file for file in thirdparty_libsimplewebm_sources]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources)
-env_webm.Append(CPPPATH=[thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
+env_webm.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"])
# upstream uses c++11
if (not env_webm.msvc):
@@ -31,8 +30,12 @@ if env['builtin_opus']:
env_webm.Append(CPPPATH=["#thirdparty/opus"])
if env['builtin_libvpx']:
- Export('env_webm')
+ env_webm.Append(CPPPATH=["#thirdparty/libvpx"])
SConscript("libvpx/SCsub")
+env_thirdparty = env_webm.Clone()
+env_thirdparty.disable_warnings()
+env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
+
# Godot source files
env_webm.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index c681e2b34f..98e38b9027 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -1,5 +1,10 @@
#!/usr/bin/env python
+Import('env')
+Import('env_modules')
+
+# Thirdparty sources
+
libvpx_dir = "#thirdparty/libvpx/"
libvpx_sources = [
@@ -38,7 +43,6 @@ libvpx_sources = [
"vp8/decoder/decodemv.c",
"vp8/decoder/detokenize.c",
"vp8/decoder/onyxd_if.c",
- "vp8/decoder/threading.c",
"vp9/vp9_dx_iface.c",
@@ -102,6 +106,10 @@ libvpx_sources = [
"vpx_util/vpx_thread.c"
]
+libvpx_sources_mt = [
+ "vp8/decoder/threading.c",
+]
+
libvpx_sources_intrin_x86 = [
"vp8/common/x86/filter_x86.c",
"vp8/common/x86/loopfilter_x86.c",
@@ -231,6 +239,7 @@ libvpx_sources_arm_neon_gas_apple = [
]
libvpx_sources = [libvpx_dir + file for file in libvpx_sources]
+libvpx_sources_mt = [libvpx_dir + file for file in libvpx_sources_mt]
libvpx_sources_intrin_x86 = [libvpx_dir + file for file in libvpx_sources_intrin_x86]
libvpx_sources_intrin_x86_mmx = [libvpx_dir + file for file in libvpx_sources_intrin_x86_mmx]
libvpx_sources_intrin_x86_sse2 = [libvpx_dir + file for file in libvpx_sources_intrin_x86_sse2]
@@ -245,14 +254,12 @@ libvpx_sources_arm_neon_armasm_ms = [libvpx_dir + file for file in libvpx_source
libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_sources_arm_neon_gas_apple]
-Import('env')
-Import('env_webm')
-
-env_webm.Append(CPPPATH=[libvpx_dir])
-
-env_libvpx = env.Clone()
+env_libvpx = env_modules.Clone()
+env_libvpx.disable_warnings()
env_libvpx.Append(CPPPATH=[libvpx_dir])
+webm_multithread = env["platform"] != 'javascript'
+
cpu_bits = env["bits"]
webm_cpu_x86 = False
webm_cpu_arm = False
@@ -338,8 +345,12 @@ if webm_simd_optimizations == False:
print("WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!")
env_libvpx.add_source_files(env.modules_sources, libvpx_sources)
+
+if webm_multithread:
+ env_libvpx.add_source_files(env.modules_sources, libvpx_sources_mt)
+
if webm_cpu_x86:
- is_clang_or_gcc = ('gcc' in env["CC"]) or ('clang' in env["CC"]) or ("OSXCROSS_ROOT" in os.environ)
+ is_clang_or_gcc = ('gcc' in os.path.basename(env["CC"])) or ('clang' in os.path.basename(env["CC"])) or ("OSXCROSS_ROOT" in os.environ)
env_libvpx_mmx = env_libvpx.Clone()
if cpu_bits == '32' and is_clang_or_gcc:
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 1bb9a43886..675fc97b55 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -35,9 +35,9 @@
#include "mkvparser/mkvparser.h"
-#include "os/file_access.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "thirdparty/misc/yuv2rgb.h"
@@ -453,7 +453,6 @@ RES ResourceFormatLoaderWebm::load(const String &p_path, const String &p_origina
if (r_error) {
*r_error = ERR_CANT_OPEN;
}
- memdelete(f);
return RES();
}
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
index 08be50846d..3739a73114 100644
--- a/modules/webm/video_stream_webm.h
+++ b/modules/webm/video_stream_webm.h
@@ -31,7 +31,7 @@
#ifndef VIDEO_STREAM_WEBM_H
#define VIDEO_STREAM_WEBM_H
-#include "io/resource_loader.h"
+#include "core/io/resource_loader.h"
#include "scene/resources/video_stream.h"
class WebMFrame;
@@ -109,7 +109,6 @@ private:
class VideoStreamWebm : public VideoStream {
GDCLASS(VideoStreamWebm, VideoStream);
- RES_BASE_EXTENSION("webm");
String file;
int audio_track;