diff --git a/.clang-format b/.clang-format index 1384260f..e1c8bfcd 100644 --- a/.clang-format +++ b/.clang-format @@ -20,10 +20,12 @@ NamespaceIndentation: All # Includes #IncludeBlocks: Regroup IncludeCategories: + - Regex: '^(<|")(common.hpp|obs.h)("|>)' + Priority: 0 - Regex: '^<' - Priority: 1 + Priority: 10 - Regex: '^"' - Priority: 2 + Priority: 20 SortIncludes: true # Alignment diff --git a/CMakeLists.txt b/CMakeLists.txt index ac1ac64e..f4996eb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") # using Intel C++ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(MSVC_EXTRA_FLAGS "/wd4061 /wd4100 /wd4180 /wd4201 /wd4464 /wd4505 /wd4514 /wd4571 /wd4623 /wd4625 /wd4626 /wd4668 /wd4710 /wd4774 /wd4820 /wd5026 /wd5027 /wd5039 /wd5045") + set(MSVC_EXTRA_FLAGS "/wd4061 /wd4100 /wd4180 /wd4201 /wd4464 /wd4505 /wd4514 /wd4571 /wd4623 /wd4625 /wd4626 /wd4668 /wd4710 /wd4774 /wd4820 /wd5026 /wd5027 /wd5039 /wd5045 /wd26812") # Force to always compile with W4 if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") string(REGEX REPLACE "/W[0-4]" "/Wall" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") @@ -342,6 +342,7 @@ if(WIN32) endif() list(APPEND PROJECT_PRIVATE_SOURCE # Plugin + "source/common.hpp" "source/plugin.hpp" "source/plugin.cpp" "source/strings.hpp" diff --git a/cmake/version.hpp.in b/cmake/version.hpp.in index 33c18bd3..033a208d 100644 --- a/cmake/version.hpp.in +++ b/cmake/version.hpp.in @@ -19,6 +19,7 @@ #pragma once #include +#include #define STREAMFX_MAKE_VERSION(major,minor,patch,tweak) ((uint64_t(major) & 0xFFFFull) << 48ull) | ((uint64_t(minor) & 0xFFFFull) << 32ull) | ((uint64_t(patch) & 0xFFFFull) << 16ull) | ((uint64_t(tweak) & 0xFFFFull)) diff --git a/source/common.hpp b/source/common.hpp new file mode 100644 index 00000000..c1a33250 --- /dev/null +++ b/source/common.hpp @@ -0,0 +1,90 @@ +/* + * Modern effects for a modern Streamer + * Copyright (C) 2020 Michael Fabian Dirks + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma once + +// Common C includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Common C++ includes +#include +#include +#include +#include +#include +#include +#include + +// Common Plugin includes +#include "strings.hpp" +#include "util-profiler.hpp" +#include "util-threadpool.hpp" +#include "utility.hpp" +#include "version.hpp" + +// Common OBS includes +extern "C" { +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4201) +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef _MSC_VER +#pragma warning(pop) +#endif +} + +// Common Global defines +/// Logging +#define LOG_(level, ...) blog(level, "[" PLUGIN_NAME "] " __VA_ARGS__) +#define LOG_ERROR(...) LOG_(LOG_ERROR, __VA_ARGS__) +#define LOG_WARNING(...) LOG_(LOG_WARNING, __VA_ARGS__) +#define LOG_INFO(...) LOG_(LOG_INFO, __VA_ARGS__) +#define LOG_DEBUG(...) LOG_(LOG_DEBUG, __VA_ARGS__) +/// Currrent function name (as const char*) +#ifdef _MSC_VER +// Microsoft Visual Studio +#define __FUNCTION_SIG__ __FUNCSIG__ +#define __FUNCTION_NAME__ __func__ +#elif defined(__GNUC__) || defined(__MINGW32__) +// GCC and MinGW +#define __FUNCTION_SIG__ __PRETTY_FUNCTION__ +#define __FUNCTION_NAME__ __func__ +#else +// Any other compiler +#define __FUNCTION_SIG__ __func__ +#define __FUNCTION_NAME__ __func__ +#endif diff --git a/source/encoders/ffmpeg-encoder.hpp b/source/encoders/ffmpeg-encoder.hpp index a6b9c166..727637f3 100644 --- a/source/encoders/ffmpeg-encoder.hpp +++ b/source/encoders/ffmpeg-encoder.hpp @@ -20,13 +20,12 @@ // SOFTWARE. #pragma once +#include "common.hpp" #include #include -#include #include #include #include -#include #include #include #include "ffmpeg/avframe-queue.hpp" @@ -42,7 +41,6 @@ extern "C" { #include #include #include -#include #ifdef _MSC_VER #pragma warning(pop) #endif diff --git a/source/encoders/handlers/handler.hpp b/source/encoders/handlers/handler.hpp index cfa12963..c2292e2a 100644 --- a/source/encoders/handlers/handler.hpp +++ b/source/encoders/handlers/handler.hpp @@ -20,16 +20,10 @@ // SOFTWARE. #pragma once - -#include +#include "common.hpp" #include "ffmpeg/hwapi/base.hpp" extern "C" { -#include - -#include -#include -#include #pragma warning(push) #pragma warning(disable : 4242 4244 4365) #include diff --git a/source/encoders/handlers/nvenc_h264_handler.hpp b/source/encoders/handlers/nvenc_h264_handler.hpp index a0ddbe4c..64cf0668 100644 --- a/source/encoders/handlers/nvenc_h264_handler.hpp +++ b/source/encoders/handlers/nvenc_h264_handler.hpp @@ -23,7 +23,6 @@ #include "handler.hpp" extern "C" { -#include #pragma warning(push) #pragma warning(disable : 4244) #include diff --git a/source/encoders/handlers/nvenc_hevc_handler.hpp b/source/encoders/handlers/nvenc_hevc_handler.hpp index f4ec036c..25f10b18 100644 --- a/source/encoders/handlers/nvenc_hevc_handler.hpp +++ b/source/encoders/handlers/nvenc_hevc_handler.hpp @@ -23,7 +23,6 @@ #include "handler.hpp" extern "C" { -#include #pragma warning(push) #pragma warning(disable : 4244) #include diff --git a/source/encoders/handlers/nvenc_shared.hpp b/source/encoders/handlers/nvenc_shared.hpp index 19c7a773..23965892 100644 --- a/source/encoders/handlers/nvenc_shared.hpp +++ b/source/encoders/handlers/nvenc_shared.hpp @@ -21,7 +21,6 @@ #pragma once #include -#include #include "handler.hpp" #include "utility.hpp" @@ -31,7 +30,6 @@ extern "C" { #pragma warning(disable : 4242 4244 4365) #endif #include -#include #ifdef _MSC_VER #pragma warning(pop) #endif diff --git a/source/encoders/handlers/prores_aw_handler.hpp b/source/encoders/handlers/prores_aw_handler.hpp index e134a9f4..38c214c3 100644 --- a/source/encoders/handlers/prores_aw_handler.hpp +++ b/source/encoders/handlers/prores_aw_handler.hpp @@ -23,7 +23,6 @@ #include "handler.hpp" extern "C" { -#include #pragma warning(push) #pragma warning(disable : 4244) #include diff --git a/source/ffmpeg/avframe-queue.hpp b/source/ffmpeg/avframe-queue.hpp index f3995267..55f467bd 100644 --- a/source/ffmpeg/avframe-queue.hpp +++ b/source/ffmpeg/avframe-queue.hpp @@ -20,6 +20,7 @@ // SOFTWARE. #pragma once +#include "common.hpp" #include #include diff --git a/source/ffmpeg/hwapi/base.hpp b/source/ffmpeg/hwapi/base.hpp index 6ca7f990..674e3dda 100644 --- a/source/ffmpeg/hwapi/base.hpp +++ b/source/ffmpeg/hwapi/base.hpp @@ -20,11 +20,8 @@ // SOFTWARE. #pragma once - -#include +#include "common.hpp" #include -#include -#include #include extern "C" { diff --git a/source/ffmpeg/hwapi/d3d11.hpp b/source/ffmpeg/hwapi/d3d11.hpp index 4880b287..84903daf 100644 --- a/source/ffmpeg/hwapi/d3d11.hpp +++ b/source/ffmpeg/hwapi/d3d11.hpp @@ -19,6 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +#pragma once #include "base.hpp" extern "C++" { diff --git a/source/ffmpeg/swscale.hpp b/source/ffmpeg/swscale.hpp index 68424845..7b4957dd 100644 --- a/source/ffmpeg/swscale.hpp +++ b/source/ffmpeg/swscale.hpp @@ -20,7 +20,7 @@ // SOFTWARE. #pragma once -#include +#include "common.hpp" #include extern "C" { diff --git a/source/ffmpeg/tools.hpp b/source/ffmpeg/tools.hpp index 143f5e53..b9567ab1 100644 --- a/source/ffmpeg/tools.hpp +++ b/source/ffmpeg/tools.hpp @@ -20,8 +20,8 @@ // SOFTWARE. #pragma once +#include "common.hpp" #include -#include #include #include diff --git a/source/filters/filter-blur.hpp b/source/filters/filter-blur.hpp index 7dc1970b..c161b6f8 100644 --- a/source/filters/filter-blur.hpp +++ b/source/filters/filter-blur.hpp @@ -18,11 +18,11 @@ */ #pragma once +#include "common.hpp" #include #include #include #include -#include #include "gfx/blur/gfx-blur-base.hpp" #include "gfx/gfx-source-texture.hpp" #include "obs/gs/gs-effect.hpp" @@ -30,17 +30,6 @@ #include "obs/gs/gs-rendertarget.hpp" #include "obs/gs/gs-texture.hpp" #include "obs/obs-source-factory.hpp" -#include "plugin.hpp" - -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif namespace filter::blur { enum class mask_type : int64_t { diff --git a/source/filters/filter-color-grade.hpp b/source/filters/filter-color-grade.hpp index a8d7181c..6a133484 100644 --- a/source/filters/filter-color-grade.hpp +++ b/source/filters/filter-color-grade.hpp @@ -18,14 +18,13 @@ */ #pragma once -#include +#include "plugin.hpp" #include #include "obs/gs/gs-mipmapper.hpp" #include "obs/gs/gs-rendertarget.hpp" #include "obs/gs/gs-texture.hpp" #include "obs/gs/gs-vertexbuffer.hpp" #include "obs/obs-source-factory.hpp" -#include "plugin.hpp" namespace filter::color_grade { enum class detection_mode { diff --git a/source/filters/filter-displacement.hpp b/source/filters/filter-displacement.hpp index 0b2733f6..df4b0be3 100644 --- a/source/filters/filter-displacement.hpp +++ b/source/filters/filter-displacement.hpp @@ -18,22 +18,9 @@ */ #pragma once -#include -#include +#include "common.hpp" #include "obs/gs/gs-effect.hpp" #include "obs/obs-source-factory.hpp" -#include "plugin.hpp" - -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif namespace filter::displacement { class displacement_instance : public obs::source_instance { diff --git a/source/filters/filter-dynamic-mask.hpp b/source/filters/filter-dynamic-mask.hpp index d5082a26..f2f05568 100644 --- a/source/filters/filter-dynamic-mask.hpp +++ b/source/filters/filter-dynamic-mask.hpp @@ -18,27 +18,14 @@ */ #pragma once +#include "common.hpp" #include #include -#include -#include #include "gfx/gfx-source-texture.hpp" #include "obs/gs/gs-effect.hpp" #include "obs/obs-source-factory.hpp" #include "obs/obs-source-tracker.hpp" #include "obs/obs-source.hpp" -#include "plugin.hpp" - -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif namespace filter::dynamic_mask { enum class channel : int8_t { Invalid = -1, Red, Green, Blue, Alpha }; diff --git a/source/filters/filter-nv-face-tracking.hpp b/source/filters/filter-nv-face-tracking.hpp index b41dbad5..b9915e6e 100644 --- a/source/filters/filter-nv-face-tracking.hpp +++ b/source/filters/filter-nv-face-tracking.hpp @@ -18,15 +18,13 @@ */ #pragma once +#include "common.hpp" #include -#include #include #include "obs/gs/gs-effect.hpp" #include "obs/gs/gs-rendertarget.hpp" #include "obs/gs/gs-vertexbuffer.hpp" #include "obs/obs-source-factory.hpp" -#include "plugin.hpp" -#include "util-profiler.hpp" // Nvidia #include "nvidia/ar/nvidia-ar.hpp" diff --git a/source/filters/filter-sdf-effects.hpp b/source/filters/filter-sdf-effects.hpp index 407bd8ef..b1daf587 100644 --- a/source/filters/filter-sdf-effects.hpp +++ b/source/filters/filter-sdf-effects.hpp @@ -18,24 +18,13 @@ */ #pragma once -#include +#include "common.hpp" #include "obs/gs/gs-effect.hpp" #include "obs/gs/gs-rendertarget.hpp" #include "obs/gs/gs-sampler.hpp" #include "obs/gs/gs-texture.hpp" #include "obs/gs/gs-vertexbuffer.hpp" #include "obs/obs-source-factory.hpp" -#include "plugin.hpp" - -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif namespace filter::sdf_effects { class sdf_effects_instance : public obs::source_instance { diff --git a/source/filters/filter-shader.hpp b/source/filters/filter-shader.hpp index b500fbf8..7f0351cd 100644 --- a/source/filters/filter-shader.hpp +++ b/source/filters/filter-shader.hpp @@ -18,15 +18,10 @@ */ #pragma once - +#include "common.hpp" #include "gfx/shader/gfx-shader.hpp" #include "obs/gs/gs-rendertarget.hpp" #include "obs/obs-source-factory.hpp" -#include "plugin.hpp" - -extern "C" { -#include -} namespace filter::shader { class shader_instance : public obs::source_instance { diff --git a/source/filters/filter-transform.hpp b/source/filters/filter-transform.hpp index b12fb9bb..dbac4758 100644 --- a/source/filters/filter-transform.hpp +++ b/source/filters/filter-transform.hpp @@ -18,14 +18,13 @@ */ #pragma once -#include +#include "common.hpp" #include #include "obs/gs/gs-mipmapper.hpp" #include "obs/gs/gs-rendertarget.hpp" #include "obs/gs/gs-texture.hpp" #include "obs/gs/gs-vertexbuffer.hpp" #include "obs/obs-source-factory.hpp" -#include "plugin.hpp" namespace filter::transform { class transform_instance : public obs::source_instance { diff --git a/source/gfx/blur/gfx-blur-base.hpp b/source/gfx/blur/gfx-blur-base.hpp index 30dcdaf6..cb5bf8de 100644 --- a/source/gfx/blur/gfx-blur-base.hpp +++ b/source/gfx/blur/gfx-blur-base.hpp @@ -16,9 +16,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once -#include -#include -#include +#include "common.hpp" #include "obs/gs/gs-texture.hpp" namespace gfx { diff --git a/source/gfx/blur/gfx-blur-box-linear.hpp b/source/gfx/blur/gfx-blur-box-linear.hpp index a789fa23..bf9abde7 100644 --- a/source/gfx/blur/gfx-blur-box-linear.hpp +++ b/source/gfx/blur/gfx-blur-box-linear.hpp @@ -16,8 +16,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once -#include -#include +#include "common.hpp" #include #include "gfx-blur-base.hpp" #include "obs/gs/gs-effect.hpp" diff --git a/source/gfx/blur/gfx-blur-box.hpp b/source/gfx/blur/gfx-blur-box.hpp index ad21ba29..b96ea7a2 100644 --- a/source/gfx/blur/gfx-blur-box.hpp +++ b/source/gfx/blur/gfx-blur-box.hpp @@ -16,8 +16,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once -#include -#include +#include "common.hpp" #include #include "gfx-blur-base.hpp" #include "obs/gs/gs-effect.hpp" diff --git a/source/gfx/blur/gfx-blur-dual-filtering.hpp b/source/gfx/blur/gfx-blur-dual-filtering.hpp index d23182f8..f32e6771 100644 --- a/source/gfx/blur/gfx-blur-dual-filtering.hpp +++ b/source/gfx/blur/gfx-blur-dual-filtering.hpp @@ -16,8 +16,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once -#include -#include +#include "common.hpp" #include #include #include "gfx-blur-base.hpp" diff --git a/source/gfx/blur/gfx-blur-gaussian-linear.hpp b/source/gfx/blur/gfx-blur-gaussian-linear.hpp index 6732902e..5c61b29e 100644 --- a/source/gfx/blur/gfx-blur-gaussian-linear.hpp +++ b/source/gfx/blur/gfx-blur-gaussian-linear.hpp @@ -16,6 +16,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once +#include "common.hpp" #include #include #include "gfx-blur-base.hpp" diff --git a/source/gfx/blur/gfx-blur-gaussian.hpp b/source/gfx/blur/gfx-blur-gaussian.hpp index 2f3bfab0..55d6a7bc 100644 --- a/source/gfx/blur/gfx-blur-gaussian.hpp +++ b/source/gfx/blur/gfx-blur-gaussian.hpp @@ -16,6 +16,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once +#include "common.hpp" #include #include #include "gfx-blur-base.hpp" diff --git a/source/gfx/gfx-source-texture.hpp b/source/gfx/gfx-source-texture.hpp index c280edf0..b5e0f70b 100644 --- a/source/gfx/gfx-source-texture.hpp +++ b/source/gfx/gfx-source-texture.hpp @@ -16,23 +16,12 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once +#include "common.hpp" #include -#include -#include #include "obs/gs/gs-rendertarget.hpp" #include "obs/gs/gs-texture.hpp" #include "obs/obs-source.hpp" -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace gfx { class source_texture { std::shared_ptr _parent; diff --git a/source/gfx/shader/gfx-shader-param-basic.hpp b/source/gfx/shader/gfx-shader-param-basic.hpp index 7063b222..6b64d174 100644 --- a/source/gfx/shader/gfx-shader-param-basic.hpp +++ b/source/gfx/shader/gfx-shader-param-basic.hpp @@ -16,7 +16,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once -#include +#include "common.hpp" #include #include "gfx-shader-param.hpp" #include "obs/gs/gs-effect-parameter.hpp" diff --git a/source/gfx/shader/gfx-shader-param.hpp b/source/gfx/shader/gfx-shader-param.hpp index af831f4f..d34043dd 100644 --- a/source/gfx/shader/gfx-shader-param.hpp +++ b/source/gfx/shader/gfx-shader-param.hpp @@ -16,22 +16,10 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once -#include #include +#include #include "obs/gs/gs-effect-parameter.hpp" -// OBS -extern "C" { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -} - namespace gfx { namespace shader { enum class parameter_type { diff --git a/source/gfx/shader/gfx-shader.hpp b/source/gfx/shader/gfx-shader.hpp index 117cedf7..078758ae 100644 --- a/source/gfx/shader/gfx-shader.hpp +++ b/source/gfx/shader/gfx-shader.hpp @@ -16,27 +16,14 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #pragma once +#include "common.hpp" #include #include #include #include -#include #include "gfx/shader/gfx-shader-param.hpp" #include "obs/gs/gs-effect.hpp" -// OBS -extern "C" { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -} - namespace gfx { namespace shader { enum class size_type { diff --git a/source/obs/gs/gs-effect-parameter.hpp b/source/obs/gs/gs-effect-parameter.hpp index 12ac1364..3595d751 100644 --- a/source/obs/gs/gs-effect-parameter.hpp +++ b/source/obs/gs/gs-effect-parameter.hpp @@ -18,26 +18,10 @@ */ #pragma once -#include -#include -#include +#include "common.hpp" #include "gs-sampler.hpp" #include "gs-texture.hpp" -// OBS -extern "C" { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#include -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -} - namespace gs { class effect_parameter : public std::shared_ptr { std::shared_ptr* _effect_parent; diff --git a/source/obs/gs/gs-effect-pass.hpp b/source/obs/gs/gs-effect-pass.hpp index 61e6a7d8..8304b508 100644 --- a/source/obs/gs/gs-effect-pass.hpp +++ b/source/obs/gs/gs-effect-pass.hpp @@ -18,23 +18,9 @@ */ #pragma once -#include -#include -#include +#include "common.hpp" #include "gs-effect-parameter.hpp" -// OBS -extern "C" { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -} - namespace gs { class effect_pass : public std::shared_ptr { std::shared_ptr* _parent; diff --git a/source/obs/gs/gs-effect-technique.hpp b/source/obs/gs/gs-effect-technique.hpp index 639741da..065d840e 100644 --- a/source/obs/gs/gs-effect-technique.hpp +++ b/source/obs/gs/gs-effect-technique.hpp @@ -18,23 +18,9 @@ */ #pragma once -#include -#include -#include +#include "common.hpp" #include "gs-effect-pass.hpp" -// OBS -extern "C" { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -} - namespace gs { class effect_technique : public std::shared_ptr { std::shared_ptr* _parent; diff --git a/source/obs/gs/gs-effect.hpp b/source/obs/gs/gs-effect.hpp index 60805df3..28a14012 100644 --- a/source/obs/gs/gs-effect.hpp +++ b/source/obs/gs/gs-effect.hpp @@ -18,26 +18,12 @@ */ #pragma once -#include +#include "common.hpp" #include #include -#include -#include #include "gs-effect-parameter.hpp" #include "gs-effect-technique.hpp" -// OBS -extern "C" { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -} - namespace gs { class effect : public std::shared_ptr { public: diff --git a/source/obs/gs/gs-helper.hpp b/source/obs/gs/gs-helper.hpp index b6ec46c9..675cba39 100644 --- a/source/obs/gs/gs-helper.hpp +++ b/source/obs/gs/gs-helper.hpp @@ -18,20 +18,10 @@ */ #pragma once -#include +#include "common.hpp" #include #include "plugin.hpp" -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace gs { class context { public: diff --git a/source/obs/gs/gs-indexbuffer.hpp b/source/obs/gs/gs-indexbuffer.hpp index 381f7535..de6fb4be 100644 --- a/source/obs/gs/gs-indexbuffer.hpp +++ b/source/obs/gs/gs-indexbuffer.hpp @@ -18,19 +18,9 @@ */ #pragma once -#include +#include "common.hpp" #include -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace gs { class index_buffer : public std::vector { public: diff --git a/source/obs/gs/gs-limits.hpp b/source/obs/gs/gs-limits.hpp index 3b878ba8..155cfaf1 100644 --- a/source/obs/gs/gs-limits.hpp +++ b/source/obs/gs/gs-limits.hpp @@ -18,7 +18,7 @@ */ #pragma once -#include +#include "common.hpp" namespace gs { static const uint32_t MAXIMUM_VERTICES = 0xFFFFFFu; diff --git a/source/obs/gs/gs-mipmapper.hpp b/source/obs/gs/gs-mipmapper.hpp index 127d95d2..92cfdbdb 100644 --- a/source/obs/gs/gs-mipmapper.hpp +++ b/source/obs/gs/gs-mipmapper.hpp @@ -18,21 +18,12 @@ */ #pragma once +#include "common.hpp" #include "gs-effect.hpp" #include "gs-rendertarget.hpp" #include "gs-texture.hpp" #include "gs-vertexbuffer.hpp" -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace gs { class mipmapper { std::unique_ptr _vb; diff --git a/source/obs/gs/gs-rendertarget.hpp b/source/obs/gs/gs-rendertarget.hpp index 5c7dcecc..561acd69 100644 --- a/source/obs/gs/gs-rendertarget.hpp +++ b/source/obs/gs/gs-rendertarget.hpp @@ -18,20 +18,9 @@ */ #pragma once -#include -#include +#include "common.hpp" #include "gs-texture.hpp" -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace gs { class rendertarget_op; diff --git a/source/obs/gs/gs-sampler.hpp b/source/obs/gs/gs-sampler.hpp index 621fbc0f..3535ac43 100644 --- a/source/obs/gs/gs-sampler.hpp +++ b/source/obs/gs/gs-sampler.hpp @@ -18,17 +18,7 @@ */ #pragma once -#include - -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif +#include "common.hpp" namespace gs { class sampler { diff --git a/source/obs/gs/gs-texture.hpp b/source/obs/gs/gs-texture.hpp index 70335824..f28ad42b 100644 --- a/source/obs/gs/gs-texture.hpp +++ b/source/obs/gs/gs-texture.hpp @@ -18,20 +18,9 @@ */ #pragma once -#include -#include +#include "common.hpp" #include "utility.hpp" -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace gs { class texture { public: diff --git a/source/obs/gs/gs-vertex.hpp b/source/obs/gs/gs-vertex.hpp index 32f16c52..b71e2e69 100644 --- a/source/obs/gs/gs-vertex.hpp +++ b/source/obs/gs/gs-vertex.hpp @@ -18,20 +18,10 @@ */ #pragma once -#include +#include "common.hpp" #include #include "gs-limits.hpp" -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace gs { struct vertex { vec3* position; diff --git a/source/obs/gs/gs-vertexbuffer.hpp b/source/obs/gs/gs-vertexbuffer.hpp index db9859d3..d4b70379 100644 --- a/source/obs/gs/gs-vertexbuffer.hpp +++ b/source/obs/gs/gs-vertexbuffer.hpp @@ -18,21 +18,11 @@ */ #pragma once -#include +#include "common.hpp" #include "gs-limits.hpp" #include "gs-vertex.hpp" #include "utility.hpp" -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace gs { class vertex_buffer { uint32_t _size; diff --git a/source/obs/obs-signal-handler.hpp b/source/obs/obs-signal-handler.hpp index 599c08ef..4fd1a60e 100644 --- a/source/obs/obs-signal-handler.hpp +++ b/source/obs/obs-signal-handler.hpp @@ -18,12 +18,9 @@ */ #pragma once -#include -#include +#include "common.hpp" #include "util-event.hpp" -#include - namespace obs { template class signal_handler_base { diff --git a/source/obs/obs-source-factory.hpp b/source/obs/obs-source-factory.hpp index 895916cd..7c42c34e 100644 --- a/source/obs/obs-source-factory.hpp +++ b/source/obs/obs-source-factory.hpp @@ -17,23 +17,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef STREAMFX_SOURCE_FACTORY_HPP -#define STREAMFX_SOURCE_FACTORY_HPP - #pragma once -#include +#include "common.hpp" #include "plugin.hpp" -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace obs { template class source_factory { @@ -610,5 +597,3 @@ namespace obs { }; } // namespace obs - -#endif diff --git a/source/obs/obs-source-tracker.hpp b/source/obs/obs-source-tracker.hpp index 38bf6124..2b750885 100644 --- a/source/obs/obs-source-tracker.hpp +++ b/source/obs/obs-source-tracker.hpp @@ -18,19 +18,9 @@ */ #pragma once +#include "common.hpp" #include #include -#include - -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif namespace obs { class source_tracker { diff --git a/source/obs/obs-source.hpp b/source/obs/obs-source.hpp index 1a163e68..5cc894a0 100644 --- a/source/obs/obs-source.hpp +++ b/source/obs/obs-source.hpp @@ -17,24 +17,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef OBS_STREAM_EFFECTS_OBS_SOURCE_HPP -#define OBS_STREAM_EFFECTS_OBS_SOURCE_HPP #pragma once - -#include -#include +#include "common.hpp" #include "util-event.hpp" -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - namespace obs { class deprecated_source { obs_source_t* _self; @@ -149,5 +135,3 @@ namespace obs { } events; }; } // namespace obs - -#endif diff --git a/source/obs/obs-tools.hpp b/source/obs/obs-tools.hpp index efda77bd..3834e74e 100644 --- a/source/obs/obs-tools.hpp +++ b/source/obs/obs-tools.hpp @@ -17,23 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef OBS_STREAM_EFFECTS_OBS_TOOLS_HPP -#define OBS_STREAM_EFFECTS_OBS_TOOLS_HPP #pragma once - -#include -#include -#include - -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif +#include "common.hpp" namespace obs { namespace tools { @@ -73,5 +58,3 @@ namespace obs { obs_sceneitem_remove(v); } } // namespace obs - -#endif diff --git a/source/plugin.hpp b/source/plugin.hpp index 3d55e03c..12bd28e3 100644 --- a/source/plugin.hpp +++ b/source/plugin.hpp @@ -18,35 +18,7 @@ */ #pragma once -#include "strings.hpp" -#include "version.hpp" -#include "util-threadpool.hpp" - -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include "obs-module.h" -#include "util/platform.h" -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -// Logging -#define LOG_(level, ...) blog(level, "[" PLUGIN_NAME "] " __VA_ARGS__) -#define LOG_ERROR(...) LOG_(LOG_ERROR, __VA_ARGS__) -#define LOG_WARNING(...) LOG_(LOG_WARNING, __VA_ARGS__) -#define LOG_INFO(...) LOG_(LOG_INFO, __VA_ARGS__) -#define LOG_DEBUG(...) LOG_(LOG_DEBUG, __VA_ARGS__) - -#ifndef __FUNCTION_NAME__ -#ifdef WIN32 // WINDOWS -#define __FUNCTION_NAME__ __FUNCTION__ -#else // *NIX -#define __FUNCTION_NAME__ __func__ -#endif -#endif +#include "common.hpp" // Threadpool std::shared_ptr get_global_threadpool(); diff --git a/source/sources/source-mirror.hpp b/source/sources/source-mirror.hpp index d16fff2f..9454c5a7 100644 --- a/source/sources/source-mirror.hpp +++ b/source/sources/source-mirror.hpp @@ -18,8 +18,8 @@ */ #pragma once +#include "common.hpp" #include -#include #include #include #include @@ -31,17 +31,6 @@ #include "obs/obs-source-factory.hpp" #include "obs/obs-source.hpp" #include "obs/obs-tools.hpp" -#include "plugin.hpp" - -// OBS -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4201) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif namespace source::mirror { struct mirror_audio_data { diff --git a/source/sources/source-shader.hpp b/source/sources/source-shader.hpp index 17156a31..0442bfb7 100644 --- a/source/sources/source-shader.hpp +++ b/source/sources/source-shader.hpp @@ -18,16 +18,12 @@ */ #pragma once - +#include "common.hpp" #include "gfx/shader/gfx-shader.hpp" #include "obs/gs/gs-rendertarget.hpp" #include "obs/obs-source-factory.hpp" #include "plugin.hpp" -extern "C" { -#include -} - namespace source::shader { class shader_instance : public obs::source_instance { std::shared_ptr _fx; diff --git a/source/strings.hpp b/source/strings.hpp index b5dfaa83..dbb7cec1 100644 --- a/source/strings.hpp +++ b/source/strings.hpp @@ -18,7 +18,7 @@ */ #pragma once -#include "plugin.hpp" +#include "common.hpp" #define PLUGIN_NAME "StreamFX" diff --git a/source/transitions/transition-shader.hpp b/source/transitions/transition-shader.hpp index 3ac47158..d33189d7 100644 --- a/source/transitions/transition-shader.hpp +++ b/source/transitions/transition-shader.hpp @@ -18,16 +18,12 @@ */ #pragma once - +#include "common.hpp" #include "gfx/shader/gfx-shader.hpp" #include "obs/gs/gs-rendertarget.hpp" #include "obs/obs-source-factory.hpp" #include "plugin.hpp" -extern "C" { -#include -} - namespace transition::shader { class shader_instance : public obs::source_instance { std::shared_ptr _fx; diff --git a/source/util-event.hpp b/source/util-event.hpp index 9df2c2ba..6b992141 100644 --- a/source/util-event.hpp +++ b/source/util-event.hpp @@ -21,6 +21,7 @@ #include #include #include +#include "common.hpp" namespace util { template diff --git a/source/util-profiler.hpp b/source/util-profiler.hpp index 5e632e2a..f6ec32c1 100644 --- a/source/util-profiler.hpp +++ b/source/util-profiler.hpp @@ -17,11 +17,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma once +#include "common.hpp" #include -#include -#include #include -#include #include namespace util { diff --git a/source/util-threadpool.hpp b/source/util-threadpool.hpp index 17dfd1fe..73562225 100644 --- a/source/util-threadpool.hpp +++ b/source/util-threadpool.hpp @@ -24,6 +24,7 @@ #include #include #include +#include #include namespace util { diff --git a/source/utility.hpp b/source/utility.hpp index 9c4abbee..89cd774f 100644 --- a/source/utility.hpp +++ b/source/utility.hpp @@ -18,11 +18,7 @@ */ #pragma once -#include -#include -#include -#include -#include +#include "common.hpp" extern "C" { #ifdef _MSC_VER