summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-15 17:33:06 +0200
committerGitHub <noreply@github.com>2021-10-15 17:33:06 +0200
commit1efe7093bec9c0bfaa2ecedd9d5777b594d7283a (patch)
tree72607a5938fa106e90ef835784ee48df1e73732f /modules
parent3f888966c0311a49541d6eb952b5a76d105f59d5 (diff)
parentae74e78909ae0bc476112fb43b9580e969879dcd (diff)
Merge pull request #53833 from akien-mga/remove-webm-support
Diffstat (limited to 'modules')
-rw-r--r--modules/ogg/SCsub3
-rw-r--r--modules/opus/SCsub252
-rw-r--r--modules/opus/config.py6
-rw-r--r--modules/opus/register_types.cpp37
-rw-r--r--modules/opus/register_types.h37
-rw-r--r--modules/theora/doc_classes/VideoStreamTheora.xml2
-rw-r--r--modules/theora/video_stream_theora.cpp2
-rw-r--r--modules/webm/SCsub48
-rw-r--r--modules/webm/config.py19
-rw-r--r--modules/webm/doc_classes/VideoStreamWebm.xml28
-rw-r--r--modules/webm/libvpx/SCsub382
-rw-r--r--modules/webm/register_types.cpp47
-rw-r--r--modules/webm/register_types.h37
-rw-r--r--modules/webm/video_stream_webm.cpp469
-rw-r--r--modules/webm/video_stream_webm.h135
15 files changed, 2 insertions, 1502 deletions
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
index e415d92498..f15525648f 100644
--- a/modules/ogg/SCsub
+++ b/modules/ogg/SCsub
@@ -3,9 +3,6 @@
Import("env")
Import("env_modules")
-# Only kept to build the thirdparty library used by the theora and webm
-# modules.
-
env_ogg = env_modules.Clone()
# Thirdparty source files
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
deleted file mode 100644
index 1437cd86df..0000000000
--- a/modules/opus/SCsub
+++ /dev/null
@@ -1,252 +0,0 @@
-#!/usr/bin/env python
-
-Import("env")
-Import("env_modules")
-
-# Only kept to build the thirdparty library used by the webm module.
-# AudioStreamOpus was dropped in 3.0 due to incompatibility with the new audio
-# engine. If you want to port it, fetch it from the Git history.
-
-env_opus = env_modules.Clone()
-
-# Thirdparty source files
-
-thirdparty_obj = []
-
-# Thirdparty source files
-if env["builtin_opus"]:
- thirdparty_dir = "#thirdparty/opus/"
-
- thirdparty_sources = [
- # Sync with opus_sources.mk
- "opus.c",
- "opus_decoder.c",
- "opus_encoder.c",
- "opus_multistream.c",
- "opus_multistream_encoder.c",
- "opus_multistream_decoder.c",
- "repacketizer.c",
- "analysis.c",
- "mlp.c",
- "mlp_data.c",
- # Sync with libopusfile Makefile.am
- "info.c",
- "internal.c",
- "opusfile.c",
- "stream.c",
- # Sync with celt_sources.mk
- "celt/bands.c",
- "celt/celt.c",
- "celt/celt_encoder.c",
- "celt/celt_decoder.c",
- "celt/cwrs.c",
- "celt/entcode.c",
- "celt/entdec.c",
- "celt/entenc.c",
- "celt/kiss_fft.c",
- "celt/laplace.c",
- "celt/mathops.c",
- "celt/mdct.c",
- "celt/modes.c",
- "celt/pitch.c",
- "celt/celt_lpc.c",
- "celt/quant_bands.c",
- "celt/rate.c",
- "celt/vq.c",
- # "celt/arm/arm_celt_map.c",
- # "celt/arm/armcpu.c",
- # "celt/arm/celt_ne10_fft.c",
- # "celt/arm/celt_ne10_mdct.c",
- # "celt/arm/celt_neon_intr.c",
- # Sync with silk_sources.mk
- "silk/CNG.c",
- "silk/code_signs.c",
- "silk/init_decoder.c",
- "silk/decode_core.c",
- "silk/decode_frame.c",
- "silk/decode_parameters.c",
- "silk/decode_indices.c",
- "silk/decode_pulses.c",
- "silk/decoder_set_fs.c",
- "silk/dec_API.c",
- "silk/enc_API.c",
- "silk/encode_indices.c",
- "silk/encode_pulses.c",
- "silk/gain_quant.c",
- "silk/interpolate.c",
- "silk/LP_variable_cutoff.c",
- "silk/NLSF_decode.c",
- "silk/NSQ.c",
- "silk/NSQ_del_dec.c",
- "silk/PLC.c",
- "silk/shell_coder.c",
- "silk/tables_gain.c",
- "silk/tables_LTP.c",
- "silk/tables_NLSF_CB_NB_MB.c",
- "silk/tables_NLSF_CB_WB.c",
- "silk/tables_other.c",
- "silk/tables_pitch_lag.c",
- "silk/tables_pulses_per_block.c",
- "silk/VAD.c",
- "silk/control_audio_bandwidth.c",
- "silk/quant_LTP_gains.c",
- "silk/VQ_WMat_EC.c",
- "silk/HP_variable_cutoff.c",
- "silk/NLSF_encode.c",
- "silk/NLSF_VQ.c",
- "silk/NLSF_unpack.c",
- "silk/NLSF_del_dec_quant.c",
- "silk/process_NLSFs.c",
- "silk/stereo_LR_to_MS.c",
- "silk/stereo_MS_to_LR.c",
- "silk/check_control_input.c",
- "silk/control_SNR.c",
- "silk/init_encoder.c",
- "silk/control_codec.c",
- "silk/A2NLSF.c",
- "silk/ana_filt_bank_1.c",
- "silk/biquad_alt.c",
- "silk/bwexpander_32.c",
- "silk/bwexpander.c",
- "silk/debug.c",
- "silk/decode_pitch.c",
- "silk/inner_prod_aligned.c",
- "silk/lin2log.c",
- "silk/log2lin.c",
- "silk/LPC_analysis_filter.c",
- "silk/LPC_inv_pred_gain.c",
- "silk/table_LSF_cos.c",
- "silk/NLSF2A.c",
- "silk/NLSF_stabilize.c",
- "silk/NLSF_VQ_weights_laroia.c",
- "silk/pitch_est_tables.c",
- "silk/resampler.c",
- "silk/resampler_down2_3.c",
- "silk/resampler_down2.c",
- "silk/resampler_private_AR2.c",
- "silk/resampler_private_down_FIR.c",
- "silk/resampler_private_IIR_FIR.c",
- "silk/resampler_private_up2_HQ.c",
- "silk/resampler_rom.c",
- "silk/sigm_Q15.c",
- "silk/sort.c",
- "silk/sum_sqr_shift.c",
- "silk/stereo_decode_pred.c",
- "silk/stereo_encode_pred.c",
- "silk/stereo_find_predictor.c",
- "silk/stereo_quant_pred.c",
- ]
-
- opus_sources_silk = []
-
- if env["platform"] in ["android", "iphone", "javascript"]:
- env_opus.Append(CPPDEFINES=["FIXED_POINT"])
- opus_sources_silk = [
- "silk/fixed/LTP_analysis_filter_FIX.c",
- "silk/fixed/LTP_scale_ctrl_FIX.c",
- "silk/fixed/corrMatrix_FIX.c",
- "silk/fixed/encode_frame_FIX.c",
- "silk/fixed/find_LPC_FIX.c",
- "silk/fixed/find_LTP_FIX.c",
- "silk/fixed/find_pitch_lags_FIX.c",
- "silk/fixed/find_pred_coefs_FIX.c",
- "silk/fixed/noise_shape_analysis_FIX.c",
- "silk/fixed/prefilter_FIX.c",
- "silk/fixed/process_gains_FIX.c",
- "silk/fixed/regularize_correlations_FIX.c",
- "silk/fixed/residual_energy16_FIX.c",
- "silk/fixed/residual_energy_FIX.c",
- "silk/fixed/solve_LS_FIX.c",
- "silk/fixed/warped_autocorrelation_FIX.c",
- "silk/fixed/apply_sine_window_FIX.c",
- "silk/fixed/autocorr_FIX.c",
- "silk/fixed/burg_modified_FIX.c",
- "silk/fixed/k2a_FIX.c",
- "silk/fixed/k2a_Q16_FIX.c",
- "silk/fixed/pitch_analysis_core_FIX.c",
- "silk/fixed/vector_ops_FIX.c",
- "silk/fixed/schur64_FIX.c",
- "silk/fixed/schur_FIX.c",
- ]
- else:
- opus_sources_silk = [
- "silk/float/apply_sine_window_FLP.c",
- "silk/float/corrMatrix_FLP.c",
- "silk/float/encode_frame_FLP.c",
- "silk/float/find_LPC_FLP.c",
- "silk/float/find_LTP_FLP.c",
- "silk/float/find_pitch_lags_FLP.c",
- "silk/float/find_pred_coefs_FLP.c",
- "silk/float/LPC_analysis_filter_FLP.c",
- "silk/float/LTP_analysis_filter_FLP.c",
- "silk/float/LTP_scale_ctrl_FLP.c",
- "silk/float/noise_shape_analysis_FLP.c",
- "silk/float/prefilter_FLP.c",
- "silk/float/process_gains_FLP.c",
- "silk/float/regularize_correlations_FLP.c",
- "silk/float/residual_energy_FLP.c",
- "silk/float/solve_LS_FLP.c",
- "silk/float/warped_autocorrelation_FLP.c",
- "silk/float/wrappers_FLP.c",
- "silk/float/autocorrelation_FLP.c",
- "silk/float/burg_modified_FLP.c",
- "silk/float/bwexpander_FLP.c",
- "silk/float/energy_FLP.c",
- "silk/float/inner_product_FLP.c",
- "silk/float/k2a_FLP.c",
- "silk/float/levinsondurbin_FLP.c",
- "silk/float/LPC_inv_pred_gain_FLP.c",
- "silk/float/pitch_analysis_core_FLP.c",
- "silk/float/scale_copy_vector_FLP.c",
- "silk/float/scale_vector_FLP.c",
- "silk/float/schur_FLP.c",
- "silk/float/sort_FLP.c",
- ]
-
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk]
-
- # also requires libogg
- if env["builtin_libogg"]:
- env_opus.Prepend(CPPPATH=["#thirdparty/libogg"])
-
- env_opus.Append(CPPDEFINES=["HAVE_CONFIG_H"])
-
- thirdparty_include_paths = [
- "",
- "celt",
- "opus",
- "silk",
- "silk/fixed",
- "silk/float",
- ]
- env_opus.Prepend(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
-
- if env["platform"] == "android":
- if "android_arch" in env and env["android_arch"] == "armv7":
- env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"])
- elif "android_arch" in env and env["android_arch"] == "arm64v8":
- env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
- elif env["platform"] == "iphone":
- if "arch" in env and env["arch"] == "arm":
- env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"])
- elif "arch" in env and env["arch"] == "arm64":
- env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
- elif env["platform"] == "osx":
- if "arch" in env and env["arch"] == "arm64":
- env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
-
- env_thirdparty = env_opus.Clone()
- env_thirdparty.disable_warnings()
- env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
- env.modules_sources += thirdparty_obj
-
-
-# Godot source files
-
-module_obj = []
-
-env_opus.add_source_files(module_obj, "*.cpp")
-env.modules_sources += module_obj
-
-# Needed to force rebuilding the module files when the thirdparty library is updated.
-env.Depends(module_obj, thirdparty_obj)
diff --git a/modules/opus/config.py b/modules/opus/config.py
deleted file mode 100644
index 9ff7b2dece..0000000000
--- a/modules/opus/config.py
+++ /dev/null
@@ -1,6 +0,0 @@
-def can_build(env, platform):
- return env.module_check_dependencies("opus", ["ogg"])
-
-
-def configure(env):
- pass
diff --git a/modules/opus/register_types.cpp b/modules/opus/register_types.cpp
deleted file mode 100644
index 02874a9a4b..0000000000
--- a/modules/opus/register_types.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*************************************************************************/
-/* register_types.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* 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"
-
-// Dummy module as libvorbis is needed by other modules (theora ...)
-
-void register_opus_types() {}
-
-void unregister_opus_types() {}
diff --git a/modules/opus/register_types.h b/modules/opus/register_types.h
deleted file mode 100644
index af889cf809..0000000000
--- a/modules/opus/register_types.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*************************************************************************/
-/* register_types.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* 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. */
-/*************************************************************************/
-
-#ifndef OPUS_REGISTER_TYPES_H
-#define OPUS_REGISTER_TYPES_H
-
-void register_opus_types();
-void unregister_opus_types();
-
-#endif // OPUS_REGISTER_TYPES_H
diff --git a/modules/theora/doc_classes/VideoStreamTheora.xml b/modules/theora/doc_classes/VideoStreamTheora.xml
index 2dfcd27dff..725f87b046 100644
--- a/modules/theora/doc_classes/VideoStreamTheora.xml
+++ b/modules/theora/doc_classes/VideoStreamTheora.xml
@@ -4,7 +4,7 @@
[VideoStream] resource for Ogg Theora videos.
</brief_description>
<description>
- [VideoStream] resource handling the [url=https://www.theora.org/]Ogg Theora[/url] video format with [code].ogv[/code] extension. The Theora codec is less efficient than [VideoStreamWebm]'s VP8 and VP9, but it requires less CPU resources to decode. The Theora codec is decoded on the CPU.
+ [VideoStream] resource handling the [url=https://www.theora.org/]Ogg Theora[/url] video format with [code].ogv[/code] extension. The Theora codec is decoded on the CPU.
[b]Note:[/b] While Ogg Theora videos can also have an [code].ogg[/code] extension, you will have to rename the extension to [code].ogv[/code] to use those videos within Godot.
</description>
<tutorials>
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 8e80dfffca..ef434f107e 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -603,7 +603,7 @@ float VideoStreamPlaybackTheora::get_playback_position() const {
};
void VideoStreamPlaybackTheora::seek(float p_time) {
- WARN_PRINT_ONCE("Seeking in Theora and WebM videos is not implemented yet (it's only supported for GDNative-provided video streams).");
+ WARN_PRINT_ONCE("Seeking in Theora videos is not implemented yet (it's only supported for GDNative-provided video streams).");
}
void VideoStreamPlaybackTheora::set_mix_callback(AudioMixCallback p_callback, void *p_userdata) {
diff --git a/modules/webm/SCsub b/modules/webm/SCsub
deleted file mode 100644
index 44e80e2870..0000000000
--- a/modules/webm/SCsub
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-Import("env")
-Import("env_modules")
-
-env_webm = env_modules.Clone()
-
-# Thirdparty source files
-
-thirdparty_obj = []
-
-thirdparty_dir = "#thirdparty/libsimplewebm/"
-thirdparty_sources = [
- "libwebm/mkvparser/mkvparser.cc",
- "OpusVorbisDecoder.cpp",
- "VPXDecoder.cpp",
- "WebMDemuxer.cpp",
-]
-thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-
-env_webm.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"])
-
-# also requires libogg, libvorbis and libopus
-if env["builtin_libogg"]:
- env_webm.Prepend(CPPPATH=["#thirdparty/libogg"])
-if env["builtin_libvorbis"]:
- env_webm.Prepend(CPPPATH=["#thirdparty/libvorbis"])
-if env["builtin_opus"]:
- env_webm.Prepend(CPPPATH=["#thirdparty/opus"])
-
-if env["builtin_libvpx"]:
- env_webm.Prepend(CPPPATH=["#thirdparty/libvpx"])
- SConscript("libvpx/SCsub")
-
-env_thirdparty = env_webm.Clone()
-env_thirdparty.disable_warnings()
-env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
-env.modules_sources += thirdparty_obj
-
-# Godot source files
-
-module_obj = []
-
-env_webm.add_source_files(module_obj, "*.cpp")
-env.modules_sources += module_obj
-
-# Needed to force rebuilding the module files when the thirdparty library is updated.
-env.Depends(module_obj, thirdparty_obj)
diff --git a/modules/webm/config.py b/modules/webm/config.py
deleted file mode 100644
index 99f8ace114..0000000000
--- a/modules/webm/config.py
+++ /dev/null
@@ -1,19 +0,0 @@
-def can_build(env, platform):
- if platform in ["iphone"]:
- return False
-
- return env.module_check_dependencies("webm", ["ogg", "opus", "vorbis"])
-
-
-def configure(env):
- pass
-
-
-def get_doc_classes():
- return [
- "VideoStreamWebm",
- ]
-
-
-def get_doc_path():
- return "doc_classes"
diff --git a/modules/webm/doc_classes/VideoStreamWebm.xml b/modules/webm/doc_classes/VideoStreamWebm.xml
deleted file mode 100644
index e04d02d6ab..0000000000
--- a/modules/webm/doc_classes/VideoStreamWebm.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VideoStreamWebm" inherits="VideoStream" version="4.0">
- <brief_description>
- [VideoStream] resource for WebM videos.
- </brief_description>
- <description>
- [VideoStream] resource handling the [url=https://www.webmproject.org/]WebM[/url] video format with [code].webm[/code] extension. Both the VP8 and VP9 codecs are supported. The VP8 and VP9 codecs are more efficient than [VideoStreamTheora], but they require more CPU resources to decode (especially VP9). Both the VP8 and VP9 codecs are decoded on the CPU.
- [b]Note:[/b] Alpha channel (also known as transparency) is not supported. The video will always appear to have a black background, even if it originally contains an alpha channel.
- [b]Note:[/b] There are known bugs and performance issues with WebM video playback in Godot. If you run into problems, try using the Ogg Theora format instead: [VideoStreamTheora]
- </description>
- <tutorials>
- </tutorials>
- <methods>
- <method name="get_file">
- <return type="String" />
- <description>
- Returns the WebM video file handled by this [VideoStreamWebm].
- </description>
- </method>
- <method name="set_file">
- <return type="void" />
- <argument index="0" name="file" type="String" />
- <description>
- Sets the WebM video file that this [VideoStreamWebm] resource handles. The [code]file[/code] name should have the [code].webm[/code] extension.
- </description>
- </method>
- </methods>
-</class>
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
deleted file mode 100644
index 4334cf732b..0000000000
--- a/modules/webm/libvpx/SCsub
+++ /dev/null
@@ -1,382 +0,0 @@
-#!/usr/bin/env python
-
-Import("env")
-Import("env_modules")
-
-# Thirdparty sources
-
-libvpx_dir = "#thirdparty/libvpx/"
-
-libvpx_sources = [
- "vp8/vp8_dx_iface.c",
- "vp8/common/generic/systemdependent.c",
- "vp8/common/alloccommon.c",
- "vp8/common/blockd.c",
- "vp8/common/copy_c.c",
- "vp8/common/debugmodes.c",
- "vp8/common/dequantize.c",
- "vp8/common/entropy.c",
- "vp8/common/entropymode.c",
- "vp8/common/entropymv.c",
- "vp8/common/extend.c",
- "vp8/common/filter.c",
- "vp8/common/findnearmv.c",
- "vp8/common/idct_blk.c",
- "vp8/common/idctllm.c",
- "vp8/common/loopfilter_filters.c",
- "vp8/common/mbpitch.c",
- "vp8/common/modecont.c",
- "vp8/common/quant_common.c",
- "vp8/common/reconinter.c",
- "vp8/common/reconintra.c",
- "vp8/common/reconintra4x4.c",
- "vp8/common/rtcd.c",
- "vp8/common/setupintrarecon.c",
- "vp8/common/swapyv12buffer.c",
- "vp8/common/treecoder.c",
- "vp8/common/vp8_loopfilter.c",
- "vp8/decoder/dboolhuff.c",
- "vp8/decoder/decodeframe.c",
- "vp8/decoder/decodemv.c",
- "vp8/decoder/detokenize.c",
- "vp8/decoder/onyxd_if.c",
- "vp9/vp9_dx_iface.c",
- "vp9/common/vp9_alloccommon.c",
- "vp9/common/vp9_blockd.c",
- "vp9/common/vp9_common_data.c",
- "vp9/common/vp9_debugmodes.c",
- "vp9/common/vp9_entropy.c",
- "vp9/common/vp9_entropymode.c",
- "vp9/common/vp9_entropymv.c",
- "vp9/common/vp9_filter.c",
- "vp9/common/vp9_frame_buffers.c",
- "vp9/common/vp9_idct.c",
- "vp9/common/vp9_loopfilter.c",
- "vp9/common/vp9_mvref_common.c",
- "vp9/common/vp9_pred_common.c",
- "vp9/common/vp9_quant_common.c",
- "vp9/common/vp9_reconinter.c",
- "vp9/common/vp9_reconintra.c",
- "vp9/common/vp9_rtcd.c",
- "vp9/common/vp9_scale.c",
- "vp9/common/vp9_scan.c",
- "vp9/common/vp9_seg_common.c",
- "vp9/common/vp9_thread_common.c",
- "vp9/common/vp9_tile_common.c",
- "vp9/decoder/vp9_decodeframe.c",
- "vp9/decoder/vp9_decodemv.c",
- "vp9/decoder/vp9_decoder.c",
- "vp9/decoder/vp9_detokenize.c",
- "vp9/decoder/vp9_dsubexp.c",
- "vp9/decoder/vp9_dthread.c",
- "vpx/src/vpx_codec.c",
- "vpx/src/vpx_decoder.c",
- "vpx/src/vpx_image.c",
- "vpx/src/vpx_psnr.c",
- "vpx_dsp/bitreader.c",
- "vpx_dsp/bitreader_buffer.c",
- "vpx_dsp/intrapred.c",
- "vpx_dsp/inv_txfm.c",
- "vpx_dsp/loopfilter.c",
- "vpx_dsp/prob.c",
- "vpx_dsp/vpx_convolve.c",
- "vpx_dsp/vpx_dsp_rtcd.c",
- "vpx_mem/vpx_mem.c",
- "vpx_scale/vpx_scale_rtcd.c",
- "vpx_scale/generic/yv12config.c",
- "vpx_scale/generic/yv12extend.c",
- "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",
- "vp8/common/x86/vp8_asm_stubs.c",
- "vpx_dsp/x86/vpx_asm_stubs.c",
-]
-libvpx_sources_intrin_x86_mmx = [
- "vp8/common/x86/idct_blk_mmx.c",
-]
-libvpx_sources_intrin_x86_sse2 = [
- "vp8/common/x86/idct_blk_sse2.c",
- "vp9/common/x86/vp9_idct_intrin_sse2.c",
- "vpx_dsp/x86/inv_txfm_sse2.c",
- "vpx_dsp/x86/loopfilter_sse2.c",
-]
-libvpx_sources_intrin_x86_ssse3 = [
- "vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c",
-]
-libvpx_sources_intrin_x86_avx2 = [
- "vpx_dsp/x86/loopfilter_avx2.c",
- "vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c",
-]
-libvpx_sources_x86asm = [
- "vp8/common/x86/copy_sse2.asm",
- "vp8/common/x86/copy_sse3.asm",
- "vp8/common/x86/dequantize_mmx.asm",
- "vp8/common/x86/idctllm_mmx.asm",
- "vp8/common/x86/idctllm_sse2.asm",
- "vp8/common/x86/iwalsh_mmx.asm",
- "vp8/common/x86/iwalsh_sse2.asm",
- "vp8/common/x86/loopfilter_sse2.asm",
- "vp8/common/x86/recon_mmx.asm",
- "vp8/common/x86/recon_sse2.asm",
- "vp8/common/x86/subpixel_mmx.asm",
- "vp8/common/x86/subpixel_sse2.asm",
- "vp8/common/x86/subpixel_ssse3.asm",
- "vp8/common/x86/vp8_loopfilter_mmx.asm",
- "vpx_dsp/x86/intrapred_sse2.asm",
- "vpx_dsp/x86/intrapred_ssse3.asm",
- "vpx_dsp/x86/inv_wht_sse2.asm",
- "vpx_dsp/x86/vpx_convolve_copy_sse2.asm",
- "vpx_dsp/x86/vpx_subpixel_8t_sse2.asm",
- "vpx_dsp/x86/vpx_subpixel_8t_ssse3.asm",
- "vpx_dsp/x86/vpx_subpixel_bilinear_sse2.asm",
- "vpx_dsp/x86/vpx_subpixel_bilinear_ssse3.asm",
- "vpx_ports/emms.asm",
-]
-libvpx_sources_x86_64asm = [
- "vp8/common/x86/loopfilter_block_sse2_x86_64.asm",
- "vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm",
-]
-
-libvpx_sources_arm = [
- "vpx_ports/arm_cpudetect.c",
- "vp8/common/arm/loopfilter_arm.c",
-]
-libvpx_sources_arm_neon = [
- "vp8/common/arm/neon/bilinearpredict_neon.c",
- "vp8/common/arm/neon/copymem_neon.c",
- "vp8/common/arm/neon/dc_only_idct_add_neon.c",
- "vp8/common/arm/neon/dequant_idct_neon.c",
- "vp8/common/arm/neon/dequantizeb_neon.c",
- "vp8/common/arm/neon/idct_blk_neon.c",
- "vp8/common/arm/neon/idct_dequant_0_2x_neon.c",
- "vp8/common/arm/neon/idct_dequant_full_2x_neon.c",
- "vp8/common/arm/neon/iwalsh_neon.c",
- "vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.c",
- "vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.c",
- "vp8/common/arm/neon/mbloopfilter_neon.c",
- "vp8/common/arm/neon/shortidct4x4llm_neon.c",
- "vp8/common/arm/neon/sixtappredict_neon.c",
- "vp8/common/arm/neon/vp8_loopfilter_neon.c",
- "vp9/common/arm/neon/vp9_iht4x4_add_neon.c",
- "vp9/common/arm/neon/vp9_iht8x8_add_neon.c",
- "vpx_dsp/arm/idct16x16_1_add_neon.c",
- "vpx_dsp/arm/idct16x16_add_neon.c",
- "vpx_dsp/arm/idct16x16_neon.c",
- "vpx_dsp/arm/idct32x32_1_add_neon.c",
- "vpx_dsp/arm/idct32x32_add_neon.c",
- "vpx_dsp/arm/idct4x4_1_add_neon.c",
- "vpx_dsp/arm/idct4x4_add_neon.c",
- "vpx_dsp/arm/idct8x8_1_add_neon.c",
- "vpx_dsp/arm/idct8x8_add_neon.c",
- "vpx_dsp/arm/intrapred_neon.c",
- "vpx_dsp/arm/loopfilter_16_neon.c",
- "vpx_dsp/arm/loopfilter_4_neon.c",
- "vpx_dsp/arm/loopfilter_8_neon.c",
- "vpx_dsp/arm/loopfilter_neon.c",
- "vpx_dsp/arm/vpx_convolve8_avg_neon.c",
- "vpx_dsp/arm/vpx_convolve8_neon.c",
- "vpx_dsp/arm/vpx_convolve_avg_neon.c",
- "vpx_dsp/arm/vpx_convolve_copy_neon.c",
- "vpx_dsp/arm/vpx_convolve_neon.c",
-]
-libvpx_sources_arm_neon_gas = [
- "vpx_dsp/arm/gas/intrapred_neon_asm.s",
- "vpx_dsp/arm/gas/loopfilter_mb_neon.s",
- "vpx_dsp/arm/gas/save_reg_neon.s",
-]
-libvpx_sources_arm_neon_armasm_ms = [
- "vpx_dsp/arm/armasm_ms/intrapred_neon_asm.asm",
- "vpx_dsp/arm/armasm_ms/loopfilter_mb_neon.asm",
- "vpx_dsp/arm/armasm_ms/save_reg_neon.asm",
-]
-libvpx_sources_arm_neon_gas_apple = [
- "vpx_dsp/arm/gas_apple/intrapred_neon_asm.s",
- "vpx_dsp/arm/gas_apple/loopfilter_mb_neon.s",
- "vpx_dsp/arm/gas_apple/save_reg_neon.s",
-]
-
-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]
-libvpx_sources_intrin_x86_ssse3 = [libvpx_dir + file for file in libvpx_sources_intrin_x86_ssse3]
-libvpx_sources_intrin_x86_avx2 = [libvpx_dir + file for file in libvpx_sources_intrin_x86_avx2]
-libvpx_sources_x86asm = [libvpx_dir + file for file in libvpx_sources_x86asm]
-libvpx_sources_x86_64asm = [libvpx_dir + file for file in libvpx_sources_x86_64asm]
-libvpx_sources_arm = [libvpx_dir + file for file in libvpx_sources_arm]
-libvpx_sources_arm_neon = [libvpx_dir + file for file in libvpx_sources_arm_neon]
-libvpx_sources_arm_neon_gas = [libvpx_dir + file for file in libvpx_sources_arm_neon_gas]
-libvpx_sources_arm_neon_armasm_ms = [libvpx_dir + file for file in libvpx_sources_arm_neon_armasm_ms]
-libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_sources_arm_neon_gas_apple]
-
-
-env_libvpx = env_modules.Clone()
-env_libvpx.disable_warnings()
-env_libvpx.Prepend(CPPPATH=[libvpx_dir])
-
-webm_multithread = env["platform"] != "javascript"
-
-cpu_bits = env["bits"]
-webm_cpu_x86 = False
-webm_cpu_arm = False
-if env["platform"] == "uwp":
- if "arm" in env["PROGSUFFIX"]:
- webm_cpu_arm = True
- else:
- webm_cpu_x86 = True
-else:
- import platform
-
- is_x11_or_server_arm = env["platform"] == "linuxbsd" and (
- platform.machine().startswith("arm") or platform.machine().startswith("aarch")
- )
- is_macos_x86 = env["platform"] == "osx" and ("arch" in env and (env["arch"] != "arm64"))
- is_ios_x86 = env["platform"] == "iphone" and ("arch" in env and env["arch"].startswith("x86"))
- is_android_x86 = env["platform"] == "android" and env["android_arch"].startswith("x86")
- if is_android_x86:
- cpu_bits = "32" if env["android_arch"] == "x86" else "64"
- webm_cpu_x86 = (
- not is_x11_or_server_arm
- and (cpu_bits == "32" or cpu_bits == "64")
- and (
- env["platform"] == "windows"
- or env["platform"] == "linuxbsd"
- or env["platform"] == "haiku"
- or is_macos_x86
- or is_android_x86
- or is_ios_x86
- )
- )
- webm_cpu_arm = (
- is_x11_or_server_arm
- or (not is_macos_x86 and env["platform"] == "osx")
- or (not is_ios_x86 and env["platform"] == "iphone")
- or (not is_android_x86 and env["platform"] == "android")
- )
-
-if webm_cpu_x86:
- import subprocess
- import os
-
- yasm_paths = [
- "yasm",
- "../../../yasm",
- ]
-
- yasm_found = False
-
- devnull = open(os.devnull)
- for yasm_path in yasm_paths:
- try:
- yasm_found = True
- subprocess.Popen([yasm_path, "--version"], stdout=devnull, stderr=devnull).communicate()
- except Exception:
- yasm_found = False
- if yasm_found:
- break
-
- if not yasm_found:
- webm_cpu_x86 = False
- print("YASM is necessary for WebM SIMD optimizations.")
-
-webm_simd_optimizations = False
-
-if webm_cpu_x86:
- if env["platform"] == "windows" or env["platform"] == "uwp":
- env_libvpx["ASFORMAT"] = "win"
- elif env["platform"] == "osx" or env["platform"] == "iphone":
- env_libvpx["ASFORMAT"] = "macho"
- else:
- env_libvpx["ASFORMAT"] = "elf"
- env_libvpx["ASFORMAT"] += cpu_bits
-
- env_libvpx["AS"] = "yasm"
- env_libvpx["ASFLAGS"] = "-I" + libvpx_dir[1:] + " -f $ASFORMAT -D $ASCPU"
- env_libvpx["ASCOM"] = "$AS $ASFLAGS -o $TARGET $SOURCES"
-
- if cpu_bits == "32":
- env_libvpx["ASCPU"] = "X86_32"
- elif cpu_bits == "64":
- env_libvpx["ASCPU"] = "X86_64"
-
- env_libvpx.Append(CPPDEFINES=["WEBM_X86ASM"])
-
- webm_simd_optimizations = True
-
-if webm_cpu_arm:
- if env["platform"] == "iphone":
- env_libvpx["ASFLAGS"] = "-arch armv7"
- elif env["platform"] == "android" and env["android_arch"] == "armv7" or env["platform"] == "linuxbsd":
- env_libvpx["ASFLAGS"] = "-mfpu=neon"
- elif env["platform"] == "uwp":
- env_libvpx["AS"] = "armasm"
- env_libvpx["ASFLAGS"] = ""
- env_libvpx["ASCOM"] = "$AS $ASFLAGS -o $TARGET $SOURCES"
-
- env_libvpx.Append(CPPDEFINES=["WEBM_ARMASM"])
-
- webm_simd_optimizations = True
-
-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 os.path.basename(env["CC"])) or ("clang" in os.path.basename(env["CC"])) or ("osxcross" in env)
- )
-
- env_libvpx_mmx = env_libvpx.Clone()
- if cpu_bits == "32" and is_clang_or_gcc:
- env_libvpx_mmx.Append(CCFLAGS=["-mmmx"])
- env_libvpx_mmx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_mmx)
-
- env_libvpx_sse2 = env_libvpx.Clone()
- if cpu_bits == "32" and is_clang_or_gcc:
- env_libvpx_sse2.Append(CCFLAGS=["-msse2"])
- env_libvpx_sse2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_sse2)
-
- env_libvpx_ssse3 = env_libvpx.Clone()
- if is_clang_or_gcc:
- env_libvpx_ssse3.Append(CCFLAGS=["-mssse3"])
- env_libvpx_ssse3.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_ssse3)
-
- env_libvpx_avx2 = env_libvpx.Clone()
- if is_clang_or_gcc:
- env_libvpx_avx2.Append(CCFLAGS=["-mavx2"])
- env_libvpx_avx2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_avx2)
-
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86)
-
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86asm)
- if cpu_bits == "64":
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86_64asm)
-elif webm_cpu_arm:
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
- if env["platform"] == "android":
- env_libvpx.Prepend(CPPPATH=[libvpx_dir + "third_party/android"])
- env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"])
-
- env_libvpx_neon = env_libvpx.Clone()
- env_libvpx_neon.add_source_files(env.modules_sources, libvpx_sources_arm_neon)
-
- if env["platform"] == "uwp":
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms)
- elif env["platform"] == "iphone":
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple)
- elif (is_x11_or_server_arm and cpu_bits == "32") or (
- env["platform"] == "android" and not env["android_arch"] == "arm64v8"
- ):
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas)
diff --git a/modules/webm/register_types.cpp b/modules/webm/register_types.cpp
deleted file mode 100644
index 8f690a6892..0000000000
--- a/modules/webm/register_types.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*************************************************************************/
-/* register_types.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* 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_webm.h"
-
-static Ref<ResourceFormatLoaderWebm> resource_loader_webm;
-
-void register_webm_types() {
- resource_loader_webm.instantiate();
- ResourceLoader::add_resource_format_loader(resource_loader_webm, true);
-
- GDREGISTER_CLASS(VideoStreamWebm);
-}
-
-void unregister_webm_types() {
- ResourceLoader::remove_resource_format_loader(resource_loader_webm);
- resource_loader_webm.unref();
-}
diff --git a/modules/webm/register_types.h b/modules/webm/register_types.h
deleted file mode 100644
index d090fe745b..0000000000
--- a/modules/webm/register_types.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*************************************************************************/
-/* register_types.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* 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. */
-/*************************************************************************/
-
-#ifndef WEBM_REGISTER_TYPES_H
-#define WEBM_REGISTER_TYPES_H
-
-void register_webm_types();
-void unregister_webm_types();
-
-#endif // WEBM_REGISTER_TYPES_H
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
deleted file mode 100644
index 187a27b6c2..0000000000
--- a/modules/webm/video_stream_webm.cpp
+++ /dev/null
@@ -1,469 +0,0 @@
-/*************************************************************************/
-/* video_stream_webm.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* 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 "video_stream_webm.h"
-
-#include "core/config/project_settings.h"
-#include "core/io/file_access.h"
-#include "core/os/os.h"
-#include "servers/audio_server.h"
-
-#include "thirdparty/misc/yuv2rgb.h"
-
-// libsimplewebm
-#include <OpusVorbisDecoder.hpp>
-#include <VPXDecoder.hpp>
-
-// libvpx
-#include <vpx/vpx_image.h>
-
-// libwebm
-#include <mkvparser/mkvparser.h>
-
-class MkvReader : public mkvparser::IMkvReader {
-public:
- MkvReader(const String &p_file) {
- file = FileAccess::open(p_file, FileAccess::READ);
-
- ERR_FAIL_COND_MSG(!file, "Failed loading resource: '" + p_file + "'.");
- }
- ~MkvReader() {
- if (file) {
- memdelete(file);
- }
- }
-
- virtual int Read(long long pos, long len, unsigned char *buf) {
- if (file) {
- if (file->get_position() != (uint64_t)pos) {
- file->seek(pos);
- }
- if (file->get_buffer(buf, len) == (uint64_t)len) {
- return 0;
- }
- }
- return -1;
- }
-
- virtual int Length(long long *total, long long *available) {
- if (file) {
- const uint64_t len = file->get_length();
- if (total) {
- *total = len;
- }
- if (available) {
- *available = len;
- }
- return 0;
- }
- return -1;
- }
-
-private:
- FileAccess *file;
-};
-
-/**/
-
-VideoStreamPlaybackWebm::VideoStreamPlaybackWebm() :
-
- texture(memnew(ImageTexture)) {}
-VideoStreamPlaybackWebm::~VideoStreamPlaybackWebm() {
- delete_pointers();
-}
-
-bool VideoStreamPlaybackWebm::open_file(const String &p_file) {
- file_name = p_file;
- webm = memnew(WebMDemuxer(new MkvReader(file_name), 0, audio_track));
- if (webm->isOpen()) {
- video = memnew(VPXDecoder(*webm, OS::get_singleton()->get_processor_count()));
- if (video->isOpen()) {
- audio = memnew(OpusVorbisDecoder(*webm));
- if (audio->isOpen()) {
- audio_frame = memnew(WebMFrame);
- pcm = (float *)memalloc(sizeof(float) * audio->getBufferSamples() * webm->getChannels());
- } else {
- memdelete(audio);
- audio = nullptr;
- }
-
- frame_data.resize((webm->getWidth() * webm->getHeight()) << 2);
- Ref<Image> img;
- img.instantiate();
- img->create(webm->getWidth(), webm->getHeight(), false, Image::FORMAT_RGBA8);
- texture->create_from_image(img);
-
- return true;
- }
- memdelete(video);
- video = nullptr;
- }
- memdelete(webm);
- webm = nullptr;
- return false;
-}
-
-void VideoStreamPlaybackWebm::stop() {
- if (playing) {
- delete_pointers();
-
- pcm = nullptr;
-
- audio_frame = nullptr;
- video_frames = nullptr;
-
- video = nullptr;
- audio = nullptr;
-
- open_file(file_name); //Should not fail here...
-
- video_frames_capacity = video_frames_pos = 0;
- num_decoded_samples = 0;
- samples_offset = -1;
- video_frame_delay = video_pos = 0.0;
- }
- time = 0.0;
- playing = false;
-}
-
-void VideoStreamPlaybackWebm::play() {
- stop();
-
- delay_compensation = ProjectSettings::get_singleton()->get("audio/video/video_delay_compensation_ms");
- delay_compensation /= 1000.0;
-
- playing = true;
-}
-
-bool VideoStreamPlaybackWebm::is_playing() const {
- return playing;
-}
-
-void VideoStreamPlaybackWebm::set_paused(bool p_paused) {
- paused = p_paused;
-}
-
-bool VideoStreamPlaybackWebm::is_paused() const {
- return paused;
-}
-
-void VideoStreamPlaybackWebm::set_loop(bool p_enable) {
- //Empty
-}
-
-bool VideoStreamPlaybackWebm::has_loop() const {
- return false;
-}
-
-float VideoStreamPlaybackWebm::get_length() const {
- if (webm) {
- return webm->getLength();
- }
- return 0.0f;
-}
-
-float VideoStreamPlaybackWebm::get_playback_position() const {
- return video_pos;
-}
-
-void VideoStreamPlaybackWebm::seek(float p_time) {
- WARN_PRINT_ONCE("Seeking in Theora and WebM videos is not implemented yet (it's only supported for GDNative-provided video streams).");
-}
-
-void VideoStreamPlaybackWebm::set_audio_track(int p_idx) {
- audio_track = p_idx;
-}
-
-Ref<Texture2D> VideoStreamPlaybackWebm::get_texture() const {
- return texture;
-}
-
-void VideoStreamPlaybackWebm::update(float p_delta) {
- if ((!playing || paused) || !video) {
- return;
- }
-
- time += p_delta;
-
- if (time < video_pos) {
- return;
- }
-
- bool audio_buffer_full = false;
-
- if (samples_offset > -1) {
- //Mix remaining samples
- const int to_read = num_decoded_samples - samples_offset;
- const int mixed = mix_callback(mix_udata, pcm + samples_offset * webm->getChannels(), to_read);
- if (mixed != to_read) {
- samples_offset += mixed;
- audio_buffer_full = true;
- } else {
- samples_offset = -1;
- }
- }
-
- const bool hasAudio = (audio && mix_callback);
- while ((hasAudio && !audio_buffer_full && !has_enough_video_frames()) ||
- (!hasAudio && video_frames_pos == 0)) {
- if (hasAudio && !audio_buffer_full && audio_frame->isValid() &&
- audio->getPCMF(*audio_frame, pcm, num_decoded_samples) && num_decoded_samples > 0) {
- const int mixed = mix_callback(mix_udata, pcm, num_decoded_samples);
-
- if (mixed != num_decoded_samples) {
- samples_offset = mixed;
- audio_buffer_full = true;
- }
- }
-
- WebMFrame *video_frame;
- if (video_frames_pos >= video_frames_capacity) {
- WebMFrame **video_frames_new = (WebMFrame **)memrealloc(video_frames, ++video_frames_capacity * sizeof(void *));
- ERR_FAIL_COND(!video_frames_new); //Out of memory
- (video_frames = video_frames_new)[video_frames_capacity - 1] = memnew(WebMFrame);
- }
- video_frame = video_frames[video_frames_pos];
-
- if (!webm->readFrame(video_frame, audio_frame)) { //This will invalidate frames
- break; //Can't demux, EOS?
- }
-
- if (video_frame->isValid()) {
- ++video_frames_pos;
- }
- };
-
- bool video_frame_done = false;
- while (video_frames_pos > 0 && !video_frame_done) {
- WebMFrame *video_frame = video_frames[0];
-
- // It seems VPXDecoder::decode has to be executed even though we might skip this frame
- if (video->decode(*video_frame)) {
- VPXDecoder::IMAGE_ERROR err;
- VPXDecoder::Image image;
-
- if (should_process(*video_frame)) {
- if ((err = video->getImage(image)) != VPXDecoder::NO_FRAME) {
- if (err == VPXDecoder::NO_ERROR && image.w == webm->getWidth() && image.h == webm->getHeight()) {
- uint8_t *w = frame_data.ptrw();
- bool converted = false;
-
- if (image.chromaShiftW == 0 && image.chromaShiftH == 0 && image.cs == VPX_CS_SRGB) {
- uint8_t *wp = w;
- unsigned char *rRow = image.planes[2];
- unsigned char *gRow = image.planes[0];
- unsigned char *bRow = image.planes[1];
- for (int i = 0; i < image.h; i++) {
- for (int j = 0; j < image.w; j++) {
- *wp++ = rRow[j];
- *wp++ = gRow[j];
- *wp++ = bRow[j];
- *wp++ = 255;
- }
- rRow += image.linesize[2];
- gRow += image.linesize[0];
- bRow += image.linesize[1];
- }
- converted = true;
- } else if (image.chromaShiftW == 1 && image.chromaShiftH == 1) {
- yuv420_2_rgb8888(w, image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2);
- //libyuv::I420ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
- converted = true;
- } else if (image.chromaShiftW == 1 && image.chromaShiftH == 0) {
- yuv422_2_rgb8888(w, image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2);
- //libyuv::I422ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
- converted = true;
- } else if (image.chromaShiftW == 0 && image.chromaShiftH == 0) {
- yuv444_2_rgb8888(w, image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2);
- //libyuv::I444ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
- converted = true;
- } else if (image.chromaShiftW == 2 && image.chromaShiftH == 0) {
- //libyuv::I411ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2] image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
- //converted = true;
- }
-
- if (converted) {
- Ref<Image> img = memnew(Image(image.w, image.h, 0, Image::FORMAT_RGBA8, frame_data));
- texture->update(img); //Zero copy send to rendering server
- video_frame_done = true;
- }
- }
- }
- }
- }
-
- video_pos = video_frame->time;
- memmove(video_frames, video_frames + 1, (--video_frames_pos) * sizeof(void *));
- video_frames[video_frames_pos] = video_frame;
- }
-
- if (video_frames_pos == 0 && webm->isEOS()) {
- stop();
- }
-}
-
-void VideoStreamPlaybackWebm::set_mix_callback(VideoStreamPlayback::AudioMixCallback p_callback, void *p_userdata) {
- mix_callback = p_callback;
- mix_udata = p_userdata;
-}
-
-int VideoStreamPlaybackWebm::get_channels() const {
- if (audio) {
- return webm->getChannels();
- }
- return 0;
-}
-
-int VideoStreamPlaybackWebm::get_mix_rate() const {
- if (audio) {
- return webm->getSampleRate();
- }
- return 0;
-}
-
-inline bool VideoStreamPlaybackWebm::has_enough_video_frames() const {
- if (video_frames_pos > 0) {
- // FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to
- // systematically return 0. Now that it gives a proper latency, it broke this
- // code where the delay compensation likely never really worked.
- //const double audio_delay = AudioServer::get_singleton()->get_output_latency();
- const double video_time = video_frames[video_frames_pos - 1]->time;
- return video_time >= time + /* audio_delay + */ delay_compensation;
- }
- return false;
-}
-
-bool VideoStreamPlaybackWebm::should_process(WebMFrame &video_frame) {
- // FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to
- // systematically return 0. Now that it gives a proper latency, it broke this
- // code where the delay compensation likely never really worked.
- //const double audio_delay = AudioServer::get_singleton()->get_output_latency();
- return video_frame.time >= time + /* audio_delay + */ delay_compensation;
-}
-
-void VideoStreamPlaybackWebm::delete_pointers() {
- if (pcm) {
- memfree(pcm);
- }
-
- if (audio_frame) {
- memdelete(audio_frame);
- }
- if (video_frames) {
- for (int i = 0; i < video_frames_capacity; ++i) {
- memdelete(video_frames[i]);
- }
- memfree(video_frames);
- }
-
- if (video) {
- memdelete(video);
- }
- if (audio) {
- memdelete(audio);
- }
-
- if (webm) {
- memdelete(webm);
- }
-}
-
-/**/
-
-VideoStreamWebm::VideoStreamWebm() {}
-
-Ref<VideoStreamPlayback> VideoStreamWebm::instance_playback() {
- Ref<VideoStreamPlaybackWebm> pb = memnew(VideoStreamPlaybackWebm);
- pb->set_audio_track(audio_track);
- if (pb->open_file(file)) {
- return pb;
- }
- return nullptr;
-}
-
-void VideoStreamWebm::set_file(const String &p_file) {
- file = p_file;
-}
-
-String VideoStreamWebm::get_file() {
- return file;
-}
-
-void VideoStreamWebm::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStreamWebm::set_file);
- ClassDB::bind_method(D_METHOD("get_file"), &VideoStreamWebm::get_file);
-
- ADD_PROPERTY(PropertyInfo(Variant::STRING, "file", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_file", "get_file");
-}
-
-void VideoStreamWebm::set_audio_track(int p_track) {
- audio_track = p_track;
-}
-
-////////////
-
-RES ResourceFormatLoaderWebm::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
- FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
- if (!f) {
- if (r_error) {
- *r_error = ERR_CANT_OPEN;
- }
- return RES();
- }
-
- VideoStreamWebm *stream = memnew(VideoStreamWebm);
- stream->set_file(p_path);
-
- Ref<VideoStreamWebm> webm_stream = Ref<VideoStreamWebm>(stream);
-
- if (r_error) {
- *r_error = OK;
- }
-
- f->close();
- memdelete(f);
- return webm_stream;
-}
-
-void ResourceFormatLoaderWebm::get_recognized_extensions(List<String> *p_extensions) const {
- p_extensions->push_back("webm");
-}
-
-bool ResourceFormatLoaderWebm::handles_type(const String &p_type) const {
- return ClassDB::is_parent_class(p_type, "VideoStream");
-}
-
-String ResourceFormatLoaderWebm::get_resource_type(const String &p_path) const {
- String el = p_path.get_extension().to_lower();
- if (el == "webm") {
- return "VideoStreamWebm";
- }
- return "";
-}
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
deleted file mode 100644
index 60e02ab38b..0000000000
--- a/modules/webm/video_stream_webm.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*************************************************************************/
-/* video_stream_webm.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* 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. */
-/*************************************************************************/
-
-#ifndef VIDEO_STREAM_WEBM_H
-#define VIDEO_STREAM_WEBM_H
-
-#include "core/io/resource_loader.h"
-#include "scene/resources/video_stream.h"
-
-class WebMFrame;
-class WebMDemuxer;
-class VPXDecoder;
-class OpusVorbisDecoder;
-
-class VideoStreamPlaybackWebm : public VideoStreamPlayback {
- GDCLASS(VideoStreamPlaybackWebm, VideoStreamPlayback);
-
- String file_name;
- int audio_track = 0;
-
- WebMDemuxer *webm = nullptr;
- VPXDecoder *video = nullptr;
- OpusVorbisDecoder *audio = nullptr;
-
- WebMFrame **video_frames = nullptr, *audio_frame = nullptr;
- int video_frames_pos = 0, video_frames_capacity = 0;
-
- int num_decoded_samples = 0, samples_offset = -1;
- AudioMixCallback mix_callback = nullptr;
- void *mix_udata = nullptr;
-
- bool playing = false, paused = false;
- double delay_compensation = 0.0;
- double time = 0.0, video_frame_delay = 0.0, video_pos = 0.0;
-
- Vector<uint8_t> frame_data;
- Ref<ImageTexture> texture;
-
- float *pcm = nullptr;
-
-public:
- VideoStreamPlaybackWebm();
- ~VideoStreamPlaybackWebm();
-
- bool open_file(const String &p_file);
-
- virtual void stop() override;
- virtual void play() override;
-
- virtual bool is_playing() const override;
-
- virtual void set_paused(bool p_paused) override;
- virtual bool is_paused() const override;
-
- virtual void set_loop(bool p_enable) override;
- virtual bool has_loop() const override;
-
- virtual float get_length() const override;
-
- virtual float get_playback_position() const override;
- virtual void seek(float p_time) override;
-
- virtual void set_audio_track(int p_idx) override;
-
- virtual Ref<Texture2D> get_texture() const override;
- virtual void update(float p_delta) override;
-
- virtual void set_mix_callback(AudioMixCallback p_callback, void *p_userdata) override;
- virtual int get_channels() const override;
- virtual int get_mix_rate() const override;
-
-private:
- inline bool has_enough_video_frames() const;
- bool should_process(WebMFrame &video_frame);
-
- void delete_pointers();
-};
-
-/**/
-
-class VideoStreamWebm : public VideoStream {
- GDCLASS(VideoStreamWebm, VideoStream);
-
- String file;
- int audio_track = 0;
-
-protected:
- static void _bind_methods();
-
-public:
- VideoStreamWebm();
-
- virtual Ref<VideoStreamPlayback> instance_playback() override;
-
- virtual void set_file(const String &p_file);
- String get_file();
- virtual void set_audio_track(int p_track) override;
-};
-
-class ResourceFormatLoaderWebm : public ResourceFormatLoader {
-public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
-};
-
-#endif // VIDEO_STREAM_WEBM_H