mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-29 11:01:23 +00:00
project: Don't leak exceptions if possible
This commit is contained in:
parent
91c9df3097
commit
b8f23fa8ab
12 changed files with 306 additions and 37 deletions
|
@ -31,6 +31,21 @@
|
|||
#include "gfx/blur/gfx-blur-gaussian.hpp"
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "obs/obs-source-tracker.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<filter::blur> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
|
@ -880,18 +895,28 @@ std::string blur_factory::translate_string(const char* format, ...)
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool blur_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<blur_factory> _filter_blur_factory_instance = nullptr;
|
||||
|
||||
void streamfx::filter::blur::blur_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_filter_blur_factory_instance)
|
||||
_filter_blur_factory_instance = std::make_shared<blur_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::filter::blur::blur_factory::finalize()
|
||||
|
|
|
@ -21,6 +21,21 @@
|
|||
#include "strings.hpp"
|
||||
#include <stdexcept>
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<filter::color_grade> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
|
@ -110,8 +125,6 @@ static constexpr std::string_view HELP_URL = "https://github.com/Xaymar/obs-Stre
|
|||
// TODO: Figure out a way to merge _lut_rt, _lut_texture, _rt_source, _rt_grad, _tex_source, _tex_grade, _source_updated and _grade_updated.
|
||||
// Seriously this is too much GPU space wasted on unused trash.
|
||||
|
||||
#define ST_PREFIX "<filter::color-grade> "
|
||||
|
||||
color_grade_instance::~color_grade_instance() {}
|
||||
|
||||
color_grade_instance::color_grade_instance(obs_data_t* data, obs_source_t* self)
|
||||
|
@ -127,13 +140,13 @@ color_grade_instance::color_grade_instance(obs_data_t* data, obs_source_t* self)
|
|||
// Load the color grading effect.
|
||||
auto path = streamfx::data_file_path("effects/color-grade.effect");
|
||||
if (!std::filesystem::exists(path)) {
|
||||
DLOG_ERROR(ST_PREFIX "Failed to locate effect file '%s'.", path.u8string().c_str());
|
||||
D_LOG_ERROR("Failed to locate effect file '%s'.", path.u8string().c_str());
|
||||
throw std::runtime_error("Failed to load color grade effect.");
|
||||
} else {
|
||||
try {
|
||||
_effect = streamfx::obs::gs::effect::create(path.u8string());
|
||||
} catch (std::exception const& ex) {
|
||||
DLOG_ERROR(ST_PREFIX "Failed to load effect '%s': %s", path.u8string().c_str(), ex.what());
|
||||
D_LOG_ERROR("Failed to load effect '%s': %s", path.u8string().c_str(), ex.what());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +157,7 @@ color_grade_instance::color_grade_instance(obs_data_t* data, obs_source_t* self)
|
|||
_lut_consumer = std::make_shared<streamfx::gfx::lut::consumer>();
|
||||
_lut_initialized = true;
|
||||
} catch (std::exception const& ex) {
|
||||
DLOG_WARNING(ST_PREFIX "Failed to initialize LUT rendering, falling back to direct rendering.\n%s", ex.what());
|
||||
D_LOG_WARNING("Failed to initialize LUT rendering, falling back to direct rendering.\n%s", ex.what());
|
||||
_lut_initialized = false;
|
||||
}
|
||||
|
||||
|
@ -152,7 +165,7 @@ color_grade_instance::color_grade_instance(obs_data_t* data, obs_source_t* self)
|
|||
try {
|
||||
allocate_rendertarget(GS_RGBA);
|
||||
} catch (std::exception const& ex) {
|
||||
DLOG_ERROR(ST_PREFIX "Failed to acquire render target for rendering: %s", ex.what());
|
||||
D_LOG_ERROR("Failed to acquire render target for rendering: %s", ex.what());
|
||||
throw;
|
||||
}
|
||||
|
||||
|
@ -487,7 +500,7 @@ void color_grade_instance::video_render(gs_effect_t* shader)
|
|||
_lut_rt.reset();
|
||||
_lut_texture.reset();
|
||||
_lut_enabled = false;
|
||||
DLOG_WARNING(ST_PREFIX "Reverting to direct rendering due to error: %s", ex.what());
|
||||
D_LOG_WARNING("Reverting to direct rendering due to error: %s", ex.what());
|
||||
}
|
||||
}
|
||||
if ((!_lut_initialized || !_lut_enabled) && !_cache_fresh) {
|
||||
|
@ -868,18 +881,28 @@ obs_properties_t* color_grade_factory::get_properties2(color_grade_instance* dat
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool color_grade_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<color_grade_factory> _color_grade_factory_instance = nullptr;
|
||||
|
||||
void streamfx::filter::color_grade::color_grade_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_color_grade_factory_instance)
|
||||
_color_grade_factory_instance = std::make_shared<color_grade_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::filter::color_grade::color_grade_factory::finalize()
|
||||
|
|
|
@ -22,6 +22,21 @@
|
|||
#include <stdexcept>
|
||||
#include <sys/stat.h>
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<filter::displacement> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define ST_I18N "Filter.Displacement"
|
||||
#define ST_I18N_FILE "Filter.Displacement.File"
|
||||
|
@ -165,9 +180,13 @@ obs_properties_t* displacement_factory::get_properties2(displacement_instance* d
|
|||
std::shared_ptr<displacement_factory> _filter_displacement_factory_instance = nullptr;
|
||||
|
||||
void streamfx::filter::displacement::displacement_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_filter_displacement_factory_instance)
|
||||
_filter_displacement_factory_instance = std::make_shared<displacement_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::filter::displacement::displacement_factory::finalize()
|
||||
|
|
|
@ -23,6 +23,21 @@
|
|||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<filter::dynamic_mask> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
// Filter to allow dynamic masking
|
||||
// Allow any channel to affect any other channel
|
||||
|
@ -520,18 +535,28 @@ std::string dynamic_mask_factory::translate_string(const char* format, ...)
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool dynamic_mask_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<dynamic_mask_factory> _filter_dynamic_mask_factory_instance = nullptr;
|
||||
|
||||
void streamfx::filter::dynamic_mask::dynamic_mask_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_filter_dynamic_mask_factory_instance)
|
||||
_filter_dynamic_mask_factory_instance = std::make_shared<dynamic_mask_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::filter::dynamic_mask::dynamic_mask_factory::finalize()
|
||||
|
|
|
@ -24,6 +24,21 @@
|
|||
#include "nvidia/cuda/nvidia-cuda-context.hpp"
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "obs/obs-tools.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<filter::face_tracking> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define ST_I18N "Filter.NVIDIA.FaceTracking"
|
||||
#define ST_I18N_ROI ST_I18N ".ROI"
|
||||
|
@ -706,12 +721,13 @@ std::shared_ptr<::streamfx::nvidia::ar::ar> face_tracking_factory::get_ar()
|
|||
std::shared_ptr<face_tracking_factory> _filter_nvidia_face_tracking_factory_instance = nullptr;
|
||||
|
||||
void streamfx::filter::nvidia::face_tracking_factory::initialize()
|
||||
{
|
||||
try {
|
||||
try {
|
||||
if (!_filter_nvidia_face_tracking_factory_instance)
|
||||
_filter_nvidia_face_tracking_factory_instance = std::make_shared<filter::nvidia::face_tracking_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("<NVIDIA Face Tracking Filter> %s", ex.what());
|
||||
}
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::filter::nvidia::face_tracking_factory::finalize()
|
||||
|
|
|
@ -21,8 +21,21 @@
|
|||
#include "strings.hpp"
|
||||
#include <stdexcept>
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#define ST_PREFIX "<filter-sdf-effects> "
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<filter::sdf_effects> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
// Translation Strings
|
||||
#define ST_I18N "Filter.SDFEffects"
|
||||
|
@ -136,8 +149,8 @@ sdf_effects_instance::sdf_effects_instance(obs_data_t* settings, obs_source_t* s
|
|||
try {
|
||||
kv.second = streamfx::obs::gs::effect::create(path);
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR(ST_PREFIX "Failed to load effect '%s' (located at '%s') with error(s): %s", kv.first,
|
||||
path.c_str(), ex.what());
|
||||
D_LOG_ERROR("Failed to load effect '%s' (located at '%s') with error(s): %s", kv.first, path.c_str(),
|
||||
ex.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -711,18 +724,28 @@ obs_properties_t* sdf_effects_factory::get_properties2(sdf_effects_instance* dat
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool sdf_effects_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<sdf_effects_factory> _filter_sdf_effects_factory_instance = nullptr;
|
||||
|
||||
void streamfx::filter::sdf_effects::sdf_effects_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_filter_sdf_effects_factory_instance)
|
||||
_filter_sdf_effects_factory_instance = std::make_shared<sdf_effects_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::filter::sdf_effects::sdf_effects_factory::finalize()
|
||||
|
|
|
@ -21,6 +21,21 @@
|
|||
#include "strings.hpp"
|
||||
#include <stdexcept>
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<filter::shader> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define ST_I18N "Filter.Shader"
|
||||
|
||||
|
@ -192,18 +207,28 @@ obs_properties_t* shader_factory::get_properties2(shader::shader_instance* data)
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool shader_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<shader_factory> _filter_shader_factory_instance = nullptr;
|
||||
|
||||
void streamfx::filter::shader::shader_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_filter_shader_factory_instance)
|
||||
_filter_shader_factory_instance = std::make_shared<shader_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::filter::shader::shader_factory::finalize()
|
||||
|
|
|
@ -22,6 +22,21 @@
|
|||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<filter::transform> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
|
@ -611,18 +626,28 @@ obs_properties_t* transform_factory::get_properties2(transform_instance* data)
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool transform_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<transform_factory> _filter_transform_factory_instance = nullptr;
|
||||
|
||||
void transform_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_filter_transform_factory_instance)
|
||||
_filter_transform_factory_instance = std::make_shared<transform_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void transform_factory::finalize()
|
||||
|
|
|
@ -572,9 +572,15 @@ obs_properties_t* video_superresolution_factory::get_properties2(video_superreso
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool video_superresolution_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -594,9 +600,13 @@ bool streamfx::filter::video_superresolution::video_superresolution_factory::is_
|
|||
std::shared_ptr<video_superresolution_factory> _video_denoising_factory_instance = nullptr;
|
||||
|
||||
void video_superresolution_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_video_denoising_factory_instance)
|
||||
_video_denoising_factory_instance = std::make_shared<video_superresolution_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void video_superresolution_factory::finalize()
|
||||
|
|
|
@ -29,6 +29,21 @@
|
|||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "obs/obs-source-tracker.hpp"
|
||||
#include "obs/obs-tools.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<source::mirror> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
|
@ -380,21 +395,34 @@ obs_properties_t* mirror_factory::get_properties2(mirror_instance* data)
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool mirror_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<mirror_factory> _source_mirror_factory_instance;
|
||||
|
||||
void streamfx::source::mirror::mirror_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_source_mirror_factory_instance)
|
||||
_source_mirror_factory_instance = std::make_shared<mirror_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::source::mirror::mirror_factory::finalize() {}
|
||||
void streamfx::source::mirror::mirror_factory::finalize()
|
||||
{
|
||||
_source_mirror_factory_instance.reset();
|
||||
}
|
||||
|
||||
std::shared_ptr<mirror_factory> streamfx::source::mirror::mirror_factory::get()
|
||||
{
|
||||
|
|
|
@ -21,6 +21,21 @@
|
|||
#include "strings.hpp"
|
||||
#include <stdexcept>
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<source::shader> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define ST_I18N "Source.Shader"
|
||||
|
||||
|
@ -145,18 +160,28 @@ obs_properties_t* shader_factory::get_properties2(shader_instance* data)
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool shader_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<shader_factory> _source_shader_factory_instance = nullptr;
|
||||
|
||||
void streamfx::source::shader::shader_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_source_shader_factory_instance)
|
||||
_source_shader_factory_instance = std::make_shared<shader_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::source::shader::shader_factory::finalize()
|
||||
|
|
|
@ -21,6 +21,21 @@
|
|||
#include "strings.hpp"
|
||||
#include <stdexcept>
|
||||
#include "obs/gs/gs-helper.hpp"
|
||||
#include "util/util-logging.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ST_PREFIX "<%s> "
|
||||
#define D_LOG_ERROR(x, ...) P_LOG_ERROR(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_WARNING(x, ...) P_LOG_WARN(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_INFO(x, ...) P_LOG_INFO(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(x, ...) P_LOG_DEBUG(ST_PREFIX##x, __FUNCTION_SIG__, __VA_ARGS__)
|
||||
#else
|
||||
#define ST_PREFIX "<transition::shader> "
|
||||
#define D_LOG_ERROR(...) P_LOG_ERROR(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_WARNING(...) P_LOG_WARN(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_INFO(...) P_LOG_INFO(ST_PREFIX __VA_ARGS__)
|
||||
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define ST_I18N "Transition.Shader"
|
||||
|
||||
|
@ -166,18 +181,28 @@ obs_properties_t* shader_factory::get_properties2(shader::shader_instance* data)
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool shader_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<shader_factory> _transition_shader_factory_instance = nullptr;
|
||||
|
||||
void streamfx::transition::shader::shader_factory::initialize()
|
||||
{
|
||||
try {
|
||||
if (!_transition_shader_factory_instance)
|
||||
_transition_shader_factory_instance = std::make_shared<shader_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
|
||||
void streamfx::transition::shader::shader_factory::finalize()
|
||||
|
|
Loading…
Reference in a new issue