From 7e5cbe18cf3ebf95efca6de0e637f2be28aabd2e Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sat, 21 Dec 2019 17:04:38 +0100 Subject: [PATCH] project: Apply clang-format --- source/filters/filter-color-grade.cpp | 4 ++-- source/filters/filter-displacement.cpp | 4 ++-- source/filters/filter-sdf-effects.hpp | 2 +- source/gfx/shader/gfx-shader-param-basic.cpp | 3 +-- source/gfx/shader/gfx-shader-param-basic.hpp | 2 +- source/gfx/shader/gfx-shader-param.cpp | 2 +- source/obs/gs/gs-effect-pass.hpp | 12 ++++++------ source/obs/gs/gs-effect-technique.cpp | 4 ++-- source/obs/gs/gs-effect.hpp | 2 +- source/obs/gs/gs-helper.hpp | 2 +- source/obs/gs/gs-texture.hpp | 4 ++-- source/obs/obs-source-factory.cpp | 1 - source/obs/obs-source-factory.hpp | 2 +- source/obs/obs-source-tracker.cpp | 9 ++++++--- source/obs/obs-tools.cpp | 6 ++++-- source/plugin.cpp | 6 ++++-- source/sources/source-shader.hpp | 2 +- source/util-math.hpp | 2 +- source/utility.cpp | 2 +- source/utility.hpp | 6 +++--- 20 files changed, 41 insertions(+), 36 deletions(-) diff --git a/source/filters/filter-color-grade.cpp b/source/filters/filter-color-grade.cpp index 8f96a3e8..399ebc70 100644 --- a/source/filters/filter-color-grade.cpp +++ b/source/filters/filter-color-grade.cpp @@ -108,7 +108,7 @@ filter::color_grade::color_grade_instance::color_grade_instance(obs_data_t* data } _tex_grade = _rt_grade->get_texture(); } - + update(data); } @@ -260,7 +260,7 @@ filter::color_grade::color_grade_factory::color_grade_factory() _info.id = "obs-stream-effects-filter-color-grade"; _info.type = OBS_SOURCE_TYPE_FILTER; _info.output_flags = OBS_SOURCE_VIDEO; - + set_resolution_enabled(false); finish_setup(); } diff --git a/source/filters/filter-displacement.cpp b/source/filters/filter-displacement.cpp index c3f2761c..e498b59e 100644 --- a/source/filters/filter-displacement.cpp +++ b/source/filters/filter-displacement.cpp @@ -38,7 +38,7 @@ filter::displacement::displacement_instance::displacement_instance(obs_data_t* d } _effect = gs::effect::create(effect); - + update(data); } @@ -128,7 +128,7 @@ filter::displacement::displacement_factory::displacement_factory() _info.id = "obs-stream-effects-filter-displacement"; _info.type = OBS_SOURCE_TYPE_FILTER; _info.output_flags = OBS_SOURCE_VIDEO; - + set_resolution_enabled(false); finish_setup(); } diff --git a/source/filters/filter-sdf-effects.hpp b/source/filters/filter-sdf-effects.hpp index 0075488c..d90a7453 100644 --- a/source/filters/filter-sdf-effects.hpp +++ b/source/filters/filter-sdf-effects.hpp @@ -39,7 +39,7 @@ namespace filter { namespace sdf_effects { - class sdf_effects_instance : public obs::source_instance { + class sdf_effects_instance : public obs::source_instance { gs::effect _sdf_producer_effect; gs::effect _sdf_consumer_effect; diff --git a/source/gfx/shader/gfx-shader-param-basic.cpp b/source/gfx/shader/gfx-shader-param-basic.cpp index e0be04ce..a42486a6 100644 --- a/source/gfx/shader/gfx-shader-param-basic.cpp +++ b/source/gfx/shader/gfx-shader-param-basic.cpp @@ -166,8 +166,7 @@ void gfx::shader::float_parameter::properties(obs_properties_t* props, obs_data_ _param.get_default_value(defaults, _len); for (size_t len = 0; len < _len; len++) { - auto p = - obs_properties_add_float(grp, _key[len].c_str(), _name[len].c_str(), _min[len], _max[len], _step[len]); + auto p = obs_properties_add_float(grp, _key[len].c_str(), _name[len].c_str(), _min[len], _max[len], _step[len]); obs_property_set_long_description(p, _desc.c_str()); obs_data_set_default_double(settings, _key[len].c_str(), static_cast(defaults[len])); } diff --git a/source/gfx/shader/gfx-shader-param-basic.hpp b/source/gfx/shader/gfx-shader-param-basic.hpp index e038bfca..c2309e7a 100644 --- a/source/gfx/shader/gfx-shader-param-basic.hpp +++ b/source/gfx/shader/gfx-shader-param-basic.hpp @@ -42,7 +42,7 @@ namespace gfx { }; struct float_parameter : public parameter { - size_t _len; + size_t _len; std::string _key[5]; std::string _name[5]; std::string _desc; diff --git a/source/gfx/shader/gfx-shader-param.cpp b/source/gfx/shader/gfx-shader-param.cpp index 7bff7815..88c9cef6 100644 --- a/source/gfx/shader/gfx-shader-param.cpp +++ b/source/gfx/shader/gfx-shader-param.cpp @@ -58,6 +58,6 @@ std::shared_ptr gfx::shader::parameter::make_parameter(g return el; } default: - return nullptr; + return nullptr; } } diff --git a/source/obs/gs/gs-effect-pass.hpp b/source/obs/gs/gs-effect-pass.hpp index 9aefa51e..61e6a7d8 100644 --- a/source/obs/gs/gs-effect-pass.hpp +++ b/source/obs/gs/gs-effect-pass.hpp @@ -48,16 +48,16 @@ namespace gs { //gs::shader get_pixel_shader(); //gs::shader get_vertex_shader(); - size_t count_vertex_parameters(); + size_t count_vertex_parameters(); gs::effect_parameter get_vertex_parameter(size_t idx); gs::effect_parameter get_vertex_parameter(std::string name); - bool has_vertex_parameter(std::string name); - bool has_vertex_parameter(std::string name, gs::effect_parameter::type type); + bool has_vertex_parameter(std::string name); + bool has_vertex_parameter(std::string name, gs::effect_parameter::type type); - size_t count_pixel_parameters(); + size_t count_pixel_parameters(); gs::effect_parameter get_pixel_parameter(size_t idx); gs::effect_parameter get_pixel_parameter(std::string name); - bool has_pixel_parameter(std::string name); - bool has_pixel_parameter(std::string name, gs::effect_parameter::type type); + bool has_pixel_parameter(std::string name); + bool has_pixel_parameter(std::string name, gs::effect_parameter::type type); }; } // namespace gs diff --git a/source/obs/gs/gs-effect-technique.cpp b/source/obs/gs/gs-effect-technique.cpp index eec742ac..7dbeaea1 100644 --- a/source/obs/gs/gs-effect-technique.cpp +++ b/source/obs/gs/gs-effect-technique.cpp @@ -33,8 +33,8 @@ gs::effect_technique::~effect_technique() {} std::string gs::effect_technique::name() { - const char* name_c = get()->name; - size_t name_len = strnlen_s(name_c, 256); + const char* name_c = get()->name; + size_t name_len = strnlen_s(name_c, 256); return name_c ? std::string(name_c, name_c + name_len) : std::string(); } diff --git a/source/obs/gs/gs-effect.hpp b/source/obs/gs/gs-effect.hpp index ff77b098..ea7e75ad 100644 --- a/source/obs/gs/gs-effect.hpp +++ b/source/obs/gs/gs-effect.hpp @@ -41,7 +41,7 @@ extern "C" { namespace gs { class effect : public std::shared_ptr { public: - effect() {}; + effect(){}; effect(std::string code, std::string name); effect(std::filesystem::path file); ~effect(); diff --git a/source/obs/gs/gs-helper.hpp b/source/obs/gs/gs-helper.hpp index a55c7497..e8899767 100644 --- a/source/obs/gs/gs-helper.hpp +++ b/source/obs/gs/gs-helper.hpp @@ -18,8 +18,8 @@ */ #pragma once -#include #include +#include #include "plugin.hpp" // OBS diff --git a/source/obs/gs/gs-texture.hpp b/source/obs/gs/gs-texture.hpp index af0fcf80..70335824 100644 --- a/source/obs/gs/gs-texture.hpp +++ b/source/obs/gs/gs-texture.hpp @@ -45,8 +45,8 @@ namespace gs { protected: gs_texture_t* _texture; - bool _is_owner = true; - type _type = type::Normal; + bool _is_owner = true; + type _type = type::Normal; public: ~texture(); diff --git a/source/obs/obs-source-factory.cpp b/source/obs/obs-source-factory.cpp index f547d75f..be07b0e9 100644 --- a/source/obs/obs-source-factory.cpp +++ b/source/obs/obs-source-factory.cpp @@ -18,4 +18,3 @@ */ #include "obs-source-factory.hpp" - diff --git a/source/obs/obs-source-factory.hpp b/source/obs/obs-source-factory.hpp index 38b26c2d..b844b33a 100644 --- a/source/obs/obs-source-factory.hpp +++ b/source/obs/obs-source-factory.hpp @@ -21,8 +21,8 @@ #define STREAMEFFECTS_SOURCE_FACTORY_HPP #pragma once -#include "plugin.hpp" #include +#include "plugin.hpp" #ifdef _MSC_VER #pragma warning(push) diff --git a/source/obs/obs-source-tracker.cpp b/source/obs/obs-source-tracker.cpp index d0df6ba1..6669f916 100644 --- a/source/obs/obs-source-tracker.cpp +++ b/source/obs/obs-source-tracker.cpp @@ -23,7 +23,8 @@ static std::shared_ptr source_tracker_instance; -void obs::source_tracker::source_create_handler(void* ptr, calldata_t* data) noexcept try { +void obs::source_tracker::source_create_handler(void* ptr, calldata_t* data) noexcept +try { obs::source_tracker* self = reinterpret_cast(ptr); obs_source_t* target = nullptr; @@ -49,7 +50,8 @@ void obs::source_tracker::source_create_handler(void* ptr, calldata_t* data) noe P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); } -void obs::source_tracker::source_destroy_handler(void* ptr, calldata_t* data) noexcept try { +void obs::source_tracker::source_destroy_handler(void* ptr, calldata_t* data) noexcept +try { obs::source_tracker* self = reinterpret_cast(ptr); obs_source_t* target = nullptr; @@ -76,7 +78,8 @@ void obs::source_tracker::source_destroy_handler(void* ptr, calldata_t* data) no P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); } -void obs::source_tracker::source_rename_handler(void* ptr, calldata_t* data) noexcept try { +void obs::source_tracker::source_rename_handler(void* ptr, calldata_t* data) noexcept +try { obs::source_tracker* self = reinterpret_cast(ptr); obs_source_t* target = nullptr; diff --git a/source/obs/obs-tools.cpp b/source/obs/obs-tools.cpp index a705b3a8..c29b3f39 100644 --- a/source/obs/obs-tools.cpp +++ b/source/obs/obs-tools.cpp @@ -30,14 +30,16 @@ struct scs_searchdata { static bool scs_contains(scs_searchdata& sd, obs_source_t* source); -static void scs_enum_active_cb(obs_source_t*, obs_source_t* child, void* searchdata) noexcept try { +static void scs_enum_active_cb(obs_source_t*, obs_source_t* child, void* searchdata) noexcept +try { scs_searchdata& sd = reinterpret_cast(*reinterpret_cast(searchdata)); scs_contains(sd, child); } catch (...) { P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); } -static bool scs_enum_items_cb(obs_scene_t*, obs_sceneitem_t* item, void* searchdata) noexcept try { +static bool scs_enum_items_cb(obs_scene_t*, obs_sceneitem_t* item, void* searchdata) noexcept +try { scs_searchdata& sd = reinterpret_cast(*reinterpret_cast(searchdata)); obs_source_t* source = obs_sceneitem_get_source(item); return scs_contains(sd, source); diff --git a/source/plugin.cpp b/source/plugin.cpp index be374843..44923d98 100644 --- a/source/plugin.cpp +++ b/source/plugin.cpp @@ -30,7 +30,8 @@ #include "sources/source-mirror.hpp" #include "sources/source-shader.hpp" -MODULE_EXPORT bool obs_module_load(void) try { +MODULE_EXPORT bool obs_module_load(void) +try { P_LOG_INFO("Loading Version %s", STREAMEFFECTS_VERSION_STRING); // Initialize Source Tracker @@ -55,7 +56,8 @@ MODULE_EXPORT bool obs_module_load(void) try { return false; } -MODULE_EXPORT void obs_module_unload(void) try { +MODULE_EXPORT void obs_module_unload(void) +try { P_LOG_INFO("Unloading Version %s", STREAMEFFECTS_VERSION_STRING); // Clean up Sources diff --git a/source/sources/source-shader.hpp b/source/sources/source-shader.hpp index 40b9ea20..1120fbbd 100644 --- a/source/sources/source-shader.hpp +++ b/source/sources/source-shader.hpp @@ -30,7 +30,7 @@ extern "C" { namespace source { namespace shader { - class shader_instance : public obs::source_instance { + class shader_instance : public obs::source_instance { std::shared_ptr _fx; bool _is_main; diff --git a/source/util-math.hpp b/source/util-math.hpp index a596b746..237d59c8 100644 --- a/source/util-math.hpp +++ b/source/util-math.hpp @@ -115,7 +115,7 @@ namespace util { } #pragma push_macro("P_IS_POWER_OF_TWO_AS_LOOP") -#define P_IS_POWER_OF_TWO_AS_LOOP(x) \ +#define P_IS_POWER_OF_TWO_AS_LOOP(x) \ template<> \ inline bool is_power_of_two(x v) \ { \ diff --git a/source/utility.cpp b/source/utility.cpp index 117d015e..2afbff52 100644 --- a/source/utility.cpp +++ b/source/utility.cpp @@ -20,8 +20,8 @@ #include "utility.hpp" #include #include -#include "plugin.hpp" #include +#include "plugin.hpp" // OBS #ifdef _MSC_VER diff --git a/source/utility.hpp b/source/utility.hpp index 50e9da9a..9e2d2a78 100644 --- a/source/utility.hpp +++ b/source/utility.hpp @@ -18,9 +18,9 @@ */ #pragma once -#include #include #include +#include extern "C" { #include @@ -48,7 +48,7 @@ typename std::enable_if::enable, Enum>::type oper return static_cast(static_cast(lhs) & static_cast(rhs)); } -#define P_ENABLE_BITMASK_OPERATORS(x) \ +#define P_ENABLE_BITMASK_OPERATORS(x) \ template<> \ struct enable_bitmask_operators { \ static const bool enable = true; \ @@ -62,4 +62,4 @@ namespace util { { return obs_get_version() < MAKE_SEMANTIC_VERSION(24, 0, 0); } -} +} // namespace util