mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-29 11:01:23 +00:00
project: Apply clang-format
This commit is contained in:
parent
1482cb1d11
commit
7e5cbe18cf
20 changed files with 41 additions and 36 deletions
|
@ -108,7 +108,7 @@ filter::color_grade::color_grade_instance::color_grade_instance(obs_data_t* data
|
||||||
}
|
}
|
||||||
_tex_grade = _rt_grade->get_texture();
|
_tex_grade = _rt_grade->get_texture();
|
||||||
}
|
}
|
||||||
|
|
||||||
update(data);
|
update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ filter::color_grade::color_grade_factory::color_grade_factory()
|
||||||
_info.id = "obs-stream-effects-filter-color-grade";
|
_info.id = "obs-stream-effects-filter-color-grade";
|
||||||
_info.type = OBS_SOURCE_TYPE_FILTER;
|
_info.type = OBS_SOURCE_TYPE_FILTER;
|
||||||
_info.output_flags = OBS_SOURCE_VIDEO;
|
_info.output_flags = OBS_SOURCE_VIDEO;
|
||||||
|
|
||||||
set_resolution_enabled(false);
|
set_resolution_enabled(false);
|
||||||
finish_setup();
|
finish_setup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ filter::displacement::displacement_instance::displacement_instance(obs_data_t* d
|
||||||
}
|
}
|
||||||
|
|
||||||
_effect = gs::effect::create(effect);
|
_effect = gs::effect::create(effect);
|
||||||
|
|
||||||
update(data);
|
update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ filter::displacement::displacement_factory::displacement_factory()
|
||||||
_info.id = "obs-stream-effects-filter-displacement";
|
_info.id = "obs-stream-effects-filter-displacement";
|
||||||
_info.type = OBS_SOURCE_TYPE_FILTER;
|
_info.type = OBS_SOURCE_TYPE_FILTER;
|
||||||
_info.output_flags = OBS_SOURCE_VIDEO;
|
_info.output_flags = OBS_SOURCE_VIDEO;
|
||||||
|
|
||||||
set_resolution_enabled(false);
|
set_resolution_enabled(false);
|
||||||
finish_setup();
|
finish_setup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
namespace filter {
|
namespace filter {
|
||||||
namespace sdf_effects {
|
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_producer_effect;
|
||||||
gs::effect _sdf_consumer_effect;
|
gs::effect _sdf_consumer_effect;
|
||||||
|
|
||||||
|
|
|
@ -166,8 +166,7 @@ void gfx::shader::float_parameter::properties(obs_properties_t* props, obs_data_
|
||||||
_param.get_default_value(defaults, _len);
|
_param.get_default_value(defaults, _len);
|
||||||
|
|
||||||
for (size_t len = 0; len < _len; len++) {
|
for (size_t len = 0; len < _len; len++) {
|
||||||
auto p =
|
auto p = obs_properties_add_float(grp, _key[len].c_str(), _name[len].c_str(), _min[len], _max[len], _step[len]);
|
||||||
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_property_set_long_description(p, _desc.c_str());
|
||||||
obs_data_set_default_double(settings, _key[len].c_str(), static_cast<double_t>(defaults[len]));
|
obs_data_set_default_double(settings, _key[len].c_str(), static_cast<double_t>(defaults[len]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace gfx {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct float_parameter : public parameter {
|
struct float_parameter : public parameter {
|
||||||
size_t _len;
|
size_t _len;
|
||||||
std::string _key[5];
|
std::string _key[5];
|
||||||
std::string _name[5];
|
std::string _name[5];
|
||||||
std::string _desc;
|
std::string _desc;
|
||||||
|
|
|
@ -58,6 +58,6 @@ std::shared_ptr<gfx::shader::parameter> gfx::shader::parameter::make_parameter(g
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,16 +48,16 @@ namespace gs {
|
||||||
//gs::shader get_pixel_shader();
|
//gs::shader get_pixel_shader();
|
||||||
//gs::shader get_vertex_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(size_t idx);
|
||||||
gs::effect_parameter get_vertex_parameter(std::string name);
|
gs::effect_parameter get_vertex_parameter(std::string name);
|
||||||
bool has_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, 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(size_t idx);
|
||||||
gs::effect_parameter get_pixel_parameter(std::string name);
|
gs::effect_parameter get_pixel_parameter(std::string name);
|
||||||
bool has_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, gs::effect_parameter::type type);
|
||||||
};
|
};
|
||||||
} // namespace gs
|
} // namespace gs
|
||||||
|
|
|
@ -33,8 +33,8 @@ gs::effect_technique::~effect_technique() {}
|
||||||
|
|
||||||
std::string gs::effect_technique::name()
|
std::string gs::effect_technique::name()
|
||||||
{
|
{
|
||||||
const char* name_c = get()->name;
|
const char* name_c = get()->name;
|
||||||
size_t name_len = strnlen_s(name_c, 256);
|
size_t name_len = strnlen_s(name_c, 256);
|
||||||
return name_c ? std::string(name_c, name_c + name_len) : std::string();
|
return name_c ? std::string(name_c, name_c + name_len) : std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ extern "C" {
|
||||||
namespace gs {
|
namespace gs {
|
||||||
class effect : public std::shared_ptr<gs_effect_t> {
|
class effect : public std::shared_ptr<gs_effect_t> {
|
||||||
public:
|
public:
|
||||||
effect() {};
|
effect(){};
|
||||||
effect(std::string code, std::string name);
|
effect(std::string code, std::string name);
|
||||||
effect(std::filesystem::path file);
|
effect(std::filesystem::path file);
|
||||||
~effect();
|
~effect();
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
|
|
||||||
// OBS
|
// OBS
|
||||||
|
|
|
@ -45,8 +45,8 @@ namespace gs {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
gs_texture_t* _texture;
|
gs_texture_t* _texture;
|
||||||
bool _is_owner = true;
|
bool _is_owner = true;
|
||||||
type _type = type::Normal;
|
type _type = type::Normal;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~texture();
|
~texture();
|
||||||
|
|
|
@ -18,4 +18,3 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "obs-source-factory.hpp"
|
#include "obs-source-factory.hpp"
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#define STREAMEFFECTS_SOURCE_FACTORY_HPP
|
#define STREAMEFFECTS_SOURCE_FACTORY_HPP
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "plugin.hpp"
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include "plugin.hpp"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
|
|
||||||
static std::shared_ptr<obs::source_tracker> source_tracker_instance;
|
static std::shared_ptr<obs::source_tracker> 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<obs::source_tracker*>(ptr);
|
obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr);
|
||||||
|
|
||||||
obs_source_t* target = nullptr;
|
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__);
|
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<obs::source_tracker*>(ptr);
|
obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr);
|
||||||
|
|
||||||
obs_source_t* target = nullptr;
|
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__);
|
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<obs::source_tracker*>(ptr);
|
obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr);
|
||||||
|
|
||||||
obs_source_t* target = nullptr;
|
obs_source_t* target = nullptr;
|
||||||
|
|
|
@ -30,14 +30,16 @@ struct scs_searchdata {
|
||||||
|
|
||||||
static bool scs_contains(scs_searchdata& sd, obs_source_t* source);
|
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<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata));
|
scs_searchdata& sd = reinterpret_cast<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata));
|
||||||
scs_contains(sd, child);
|
scs_contains(sd, child);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
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<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata));
|
scs_searchdata& sd = reinterpret_cast<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata));
|
||||||
obs_source_t* source = obs_sceneitem_get_source(item);
|
obs_source_t* source = obs_sceneitem_get_source(item);
|
||||||
return scs_contains(sd, source);
|
return scs_contains(sd, source);
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
#include "sources/source-mirror.hpp"
|
#include "sources/source-mirror.hpp"
|
||||||
#include "sources/source-shader.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);
|
P_LOG_INFO("Loading Version %s", STREAMEFFECTS_VERSION_STRING);
|
||||||
|
|
||||||
// Initialize Source Tracker
|
// Initialize Source Tracker
|
||||||
|
@ -55,7 +56,8 @@ MODULE_EXPORT bool obs_module_load(void) try {
|
||||||
return false;
|
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);
|
P_LOG_INFO("Unloading Version %s", STREAMEFFECTS_VERSION_STRING);
|
||||||
|
|
||||||
// Clean up Sources
|
// Clean up Sources
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern "C" {
|
||||||
|
|
||||||
namespace source {
|
namespace source {
|
||||||
namespace shader {
|
namespace shader {
|
||||||
class shader_instance : public obs::source_instance {
|
class shader_instance : public obs::source_instance {
|
||||||
std::shared_ptr<gfx::shader::shader> _fx;
|
std::shared_ptr<gfx::shader::shader> _fx;
|
||||||
|
|
||||||
bool _is_main;
|
bool _is_main;
|
||||||
|
|
|
@ -115,7 +115,7 @@ namespace util {
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma push_macro("P_IS_POWER_OF_TWO_AS_LOOP")
|
#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<> \
|
template<> \
|
||||||
inline bool is_power_of_two(x v) \
|
inline bool is_power_of_two(x v) \
|
||||||
{ \
|
{ \
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "plugin.hpp"
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include "plugin.hpp"
|
||||||
|
|
||||||
// OBS
|
// OBS
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <type_traits>
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <obs-config.h>
|
#include <obs-config.h>
|
||||||
|
@ -48,7 +48,7 @@ typename std::enable_if<enable_bitmask_operators<Enum>::enable, Enum>::type oper
|
||||||
return static_cast<Enum>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs));
|
return static_cast<Enum>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define P_ENABLE_BITMASK_OPERATORS(x) \
|
#define P_ENABLE_BITMASK_OPERATORS(x) \
|
||||||
template<> \
|
template<> \
|
||||||
struct enable_bitmask_operators<x> { \
|
struct enable_bitmask_operators<x> { \
|
||||||
static const bool enable = true; \
|
static const bool enable = true; \
|
||||||
|
@ -62,4 +62,4 @@ namespace util {
|
||||||
{
|
{
|
||||||
return obs_get_version() < MAKE_SEMANTIC_VERSION(24, 0, 0);
|
return obs_get_version() < MAKE_SEMANTIC_VERSION(24, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
} // namespace util
|
||||||
|
|
Loading…
Reference in a new issue