code: Don't use try-catch as function definition

This breaks MSVC and results in leaked exceptions.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2022-08-27 13:17:47 +02:00
parent 678399ce81
commit 0fe5c7e654
24 changed files with 1150 additions and 1023 deletions

View File

@ -1278,6 +1278,7 @@ aom_av1_factory::~aom_av1_factory() {}
std::shared_ptr<aom_av1_factory> _aom_av1_factory_instance = nullptr; std::shared_ptr<aom_av1_factory> _aom_av1_factory_instance = nullptr;
void aom_av1_factory::initialize() void aom_av1_factory::initialize()
{
try { try {
if (!_aom_av1_factory_instance) { if (!_aom_av1_factory_instance) {
_aom_av1_factory_instance = std::make_shared<aom_av1_factory>(); _aom_av1_factory_instance = std::make_shared<aom_av1_factory>();
@ -1285,6 +1286,7 @@ try {
} catch (std::exception const& ex) { } catch (std::exception const& ex) {
D_LOG_ERROR("Failed to initialize AOM AV1 encoder: %s", ex.what()); D_LOG_ERROR("Failed to initialize AOM AV1 encoder: %s", ex.what());
} }
}
void aom_av1_factory::finalize() void aom_av1_factory::finalize()
{ {
@ -1349,6 +1351,7 @@ void aom_av1_factory::get_defaults2(obs_data_t* settings)
} }
static bool modified_usage(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept static bool modified_usage(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept
{
try { try {
bool is_all_intra = false; bool is_all_intra = false;
if (obs_data_get_int(settings, ST_KEY_ENCODER_USAGE) == AOM_USAGE_ALL_INTRA) { if (obs_data_get_int(settings, ST_KEY_ENCODER_USAGE) == AOM_USAGE_ALL_INTRA) {
@ -1367,8 +1370,10 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
static bool modified_ratecontrol_mode(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept static bool modified_ratecontrol_mode(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept
{
try { try {
bool is_bitrate_visible = false; bool is_bitrate_visible = false;
bool is_overundershoot_visible = false; bool is_overundershoot_visible = false;
@ -1412,8 +1417,10 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
static bool modified_keyframes(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept static bool modified_keyframes(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept
{
try { try {
bool is_seconds = obs_data_get_int(settings, ST_KEY_KEYFRAMES_INTERVALTYPE) == 0; bool is_seconds = obs_data_get_int(settings, ST_KEY_KEYFRAMES_INTERVALTYPE) == 0;
obs_property_set_visible(obs_properties_get(props, ST_KEY_KEYFRAMES_INTERVAL_FRAMES), !is_seconds); obs_property_set_visible(obs_properties_get(props, ST_KEY_KEYFRAMES_INTERVAL_FRAMES), !is_seconds);
@ -1426,6 +1433,7 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
obs_properties_t* aom_av1_factory::get_properties2(instance_t* data) obs_properties_t* aom_av1_factory::get_properties2(instance_t* data)
{ {

View File

@ -129,7 +129,7 @@ ffmpeg_instance::ffmpeg_instance(obs_data_t* settings, obs_encoder_t* self, bool
throw std::runtime_error("Failed to create encoder context."); throw std::runtime_error("Failed to create encoder context.");
} }
// Create 8MB of precached Packet data for use later on. // Allocate a small packet for later use.
av_init_packet(&_packet); av_init_packet(&_packet);
av_new_packet(&_packet, 8 * 1024 * 1024); // 8 MB precached Packet size. av_new_packet(&_packet, 8 * 1024 * 1024); // 8 MB precached Packet size.
@ -1051,6 +1051,7 @@ void ffmpeg_factory::migrate(obs_data_t* data, uint64_t version)
} }
static bool modified_keyframes(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept static bool modified_keyframes(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept
{
try { try {
bool is_seconds = obs_data_get_int(settings, ST_KEY_KEYFRAMES_INTERVALTYPE) == 0; bool is_seconds = obs_data_get_int(settings, ST_KEY_KEYFRAMES_INTERVALTYPE) == 0;
obs_property_set_visible(obs_properties_get(props, ST_KEY_KEYFRAMES_INTERVAL_FRAMES), !is_seconds); obs_property_set_visible(obs_properties_get(props, ST_KEY_KEYFRAMES_INTERVAL_FRAMES), !is_seconds);
@ -1063,6 +1064,7 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
obs_properties_t* ffmpeg_factory::get_properties2(instance_t* data) obs_properties_t* ffmpeg_factory::get_properties2(instance_t* data)
{ {

View File

@ -1125,6 +1125,7 @@ void autoframing_factory::get_defaults2(obs_data_t* data)
} }
static bool modified_provider(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept static bool modified_provider(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept
{
try { try {
return true; return true;
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
@ -1134,6 +1135,7 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
obs_properties_t* autoframing_factory::get_properties2(autoframing_instance* data) obs_properties_t* autoframing_factory::get_properties2(autoframing_instance* data)
{ {
@ -1315,6 +1317,7 @@ tracking_provider streamfx::filter::autoframing::autoframing_factory::find_ideal
std::shared_ptr<autoframing_factory> _filter_autoframing_factory_instance = nullptr; std::shared_ptr<autoframing_factory> _filter_autoframing_factory_instance = nullptr;
void autoframing_factory::initialize() void autoframing_factory::initialize()
{
try { try {
if (!_filter_autoframing_factory_instance) if (!_filter_autoframing_factory_instance)
_filter_autoframing_factory_instance = std::make_shared<autoframing_factory>(); _filter_autoframing_factory_instance = std::make_shared<autoframing_factory>();
@ -1323,6 +1326,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void autoframing_factory::finalize() void autoframing_factory::finalize()
{ {

View File

@ -649,6 +649,7 @@ void blur_factory::get_defaults2(obs_data_t* settings)
} }
bool modified_properties(void*, obs_properties_t* props, obs_property* prop, obs_data_t* settings) noexcept bool modified_properties(void*, obs_properties_t* props, obs_property* prop, obs_data_t* settings) noexcept
{
try { try {
obs_property_t* p; obs_property_t* p;
const char* propname = obs_property_name(prop); const char* propname = obs_property_name(prop);
@ -777,6 +778,7 @@ try {
DLOG_ERROR("Unexpected exception in modified_properties callback."); DLOG_ERROR("Unexpected exception in modified_properties callback.");
return false; return false;
} }
}
obs_properties_t* blur_factory::get_properties2(blur_instance* data) obs_properties_t* blur_factory::get_properties2(blur_instance* data)
{ {
@ -896,6 +898,7 @@ std::string blur_factory::translate_string(const char* format, ...)
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool blur_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool blur_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -906,11 +909,13 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
std::shared_ptr<blur_factory> _filter_blur_factory_instance = nullptr; std::shared_ptr<blur_factory> _filter_blur_factory_instance = nullptr;
void streamfx::filter::blur::blur_factory::initialize() void streamfx::filter::blur::blur_factory::initialize()
{
try { try {
if (!_filter_blur_factory_instance) if (!_filter_blur_factory_instance)
_filter_blur_factory_instance = std::make_shared<blur_factory>(); _filter_blur_factory_instance = std::make_shared<blur_factory>();
@ -919,6 +924,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void streamfx::filter::blur::blur_factory::finalize() void streamfx::filter::blur::blur_factory::finalize()
{ {

View File

@ -882,6 +882,7 @@ obs_properties_t* color_grade_factory::get_properties2(color_grade_instance* dat
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool color_grade_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool color_grade_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -892,11 +893,13 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
std::shared_ptr<color_grade_factory> _color_grade_factory_instance = nullptr; std::shared_ptr<color_grade_factory> _color_grade_factory_instance = nullptr;
void streamfx::filter::color_grade::color_grade_factory::initialize() void streamfx::filter::color_grade::color_grade_factory::initialize()
{
try { try {
if (!_color_grade_factory_instance) if (!_color_grade_factory_instance)
_color_grade_factory_instance = std::make_shared<color_grade_factory>(); _color_grade_factory_instance = std::make_shared<color_grade_factory>();
@ -905,6 +908,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void streamfx::filter::color_grade::color_grade_factory::finalize() void streamfx::filter::color_grade::color_grade_factory::finalize()
{ {

View File

@ -572,6 +572,7 @@ void denoising_factory::get_defaults2(obs_data_t* data)
} }
static bool modified_provider(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept static bool modified_provider(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept
{
try { try {
return true; return true;
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
@ -581,6 +582,7 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
obs_properties_t* denoising_factory::get_properties2(denoising_instance* data) obs_properties_t* denoising_factory::get_properties2(denoising_instance* data)
{ {
@ -649,6 +651,7 @@ denoising_provider streamfx::filter::denoising::denoising_factory::find_ideal_pr
std::shared_ptr<denoising_factory> _video_denoising_factory_instance = nullptr; std::shared_ptr<denoising_factory> _video_denoising_factory_instance = nullptr;
void denoising_factory::initialize() void denoising_factory::initialize()
{
try { try {
if (!_video_denoising_factory_instance) if (!_video_denoising_factory_instance)
_video_denoising_factory_instance = std::make_shared<denoising_factory>(); _video_denoising_factory_instance = std::make_shared<denoising_factory>();
@ -657,6 +660,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void denoising_factory::finalize() void denoising_factory::finalize()
{ {

View File

@ -203,6 +203,7 @@ obs_properties_t* displacement_factory::get_properties2(displacement_instance* d
std::shared_ptr<displacement_factory> _filter_displacement_factory_instance = nullptr; std::shared_ptr<displacement_factory> _filter_displacement_factory_instance = nullptr;
void streamfx::filter::displacement::displacement_factory::initialize() void streamfx::filter::displacement::displacement_factory::initialize()
{
try { try {
if (!_filter_displacement_factory_instance) if (!_filter_displacement_factory_instance)
_filter_displacement_factory_instance = std::make_shared<displacement_factory>(); _filter_displacement_factory_instance = std::make_shared<displacement_factory>();
@ -211,6 +212,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void streamfx::filter::displacement::displacement_factory::finalize() void streamfx::filter::displacement::displacement_factory::finalize()
{ {

View File

@ -403,6 +403,7 @@ void streamfx::filter::dynamic_mask::dynamic_mask_instance::deactivate()
} }
bool dynamic_mask_instance::acquire(std::string_view name) bool dynamic_mask_instance::acquire(std::string_view name)
{
try { try {
// Prevent us from creating a circle. // Prevent us from creating a circle.
if (auto v = obs_source_get_name(obs_filter_get_parent(_self)); (v != nullptr) && (name == v)) { if (auto v = obs_source_get_name(obs_filter_get_parent(_self)); (v != nullptr) && (name == v)) {
@ -431,6 +432,7 @@ try {
release(); release();
return false; return false;
} }
}
void dynamic_mask_instance::release() void dynamic_mask_instance::release()
{ {
@ -565,6 +567,7 @@ std::string dynamic_mask_factory::translate_string(const char* format, ...)
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool dynamic_mask_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool dynamic_mask_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -575,11 +578,13 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
std::shared_ptr<dynamic_mask_factory> _filter_dynamic_mask_factory_instance = nullptr; std::shared_ptr<dynamic_mask_factory> _filter_dynamic_mask_factory_instance = nullptr;
void streamfx::filter::dynamic_mask::dynamic_mask_factory::initialize() void streamfx::filter::dynamic_mask::dynamic_mask_factory::initialize()
{
try { try {
if (!_filter_dynamic_mask_factory_instance) if (!_filter_dynamic_mask_factory_instance)
_filter_dynamic_mask_factory_instance = std::make_shared<dynamic_mask_factory>(); _filter_dynamic_mask_factory_instance = std::make_shared<dynamic_mask_factory>();
@ -588,6 +593,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void streamfx::filter::dynamic_mask::dynamic_mask_factory::finalize() void streamfx::filter::dynamic_mask::dynamic_mask_factory::finalize()
{ {

View File

@ -724,6 +724,7 @@ obs_properties_t* sdf_effects_factory::get_properties2(sdf_effects_instance* dat
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool sdf_effects_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool sdf_effects_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -734,11 +735,13 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
std::shared_ptr<sdf_effects_factory> _filter_sdf_effects_factory_instance = nullptr; std::shared_ptr<sdf_effects_factory> _filter_sdf_effects_factory_instance = nullptr;
void streamfx::filter::sdf_effects::sdf_effects_factory::initialize() void streamfx::filter::sdf_effects::sdf_effects_factory::initialize()
{
try { try {
if (!_filter_sdf_effects_factory_instance) if (!_filter_sdf_effects_factory_instance)
_filter_sdf_effects_factory_instance = std::make_shared<sdf_effects_factory>(); _filter_sdf_effects_factory_instance = std::make_shared<sdf_effects_factory>();
@ -747,6 +750,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void streamfx::filter::sdf_effects::sdf_effects_factory::finalize() void streamfx::filter::sdf_effects::sdf_effects_factory::finalize()
{ {

View File

@ -218,6 +218,7 @@ obs_properties_t* shader_factory::get_properties2(shader::shader_instance* data)
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool shader_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool shader_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -228,11 +229,13 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
std::shared_ptr<shader_factory> _filter_shader_factory_instance = nullptr; std::shared_ptr<shader_factory> _filter_shader_factory_instance = nullptr;
void streamfx::filter::shader::shader_factory::initialize() void streamfx::filter::shader::shader_factory::initialize()
{
try { try {
if (!_filter_shader_factory_instance) if (!_filter_shader_factory_instance)
_filter_shader_factory_instance = std::make_shared<shader_factory>(); _filter_shader_factory_instance = std::make_shared<shader_factory>();
@ -241,6 +244,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void streamfx::filter::shader::shader_factory::finalize() void streamfx::filter::shader::shader_factory::finalize()
{ {

View File

@ -636,6 +636,7 @@ void transform_factory::get_defaults2(obs_data_t* settings)
} }
static bool modified_camera_mode(obs_properties_t* pr, obs_property_t*, obs_data_t* d) noexcept static bool modified_camera_mode(obs_properties_t* pr, obs_property_t*, obs_data_t* d) noexcept
{
try { try {
auto mode = static_cast<transform_mode>(obs_data_get_int(d, ST_KEY_CAMERA_MODE)); auto mode = static_cast<transform_mode>(obs_data_get_int(d, ST_KEY_CAMERA_MODE));
bool is_camera = mode != transform_mode::CORNER_PIN; bool is_camera = mode != transform_mode::CORNER_PIN;
@ -659,6 +660,7 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return true; return true;
} }
}
obs_properties_t* transform_factory::get_properties2(transform_instance* data) obs_properties_t* transform_factory::get_properties2(transform_instance* data)
{ {
@ -856,6 +858,7 @@ obs_properties_t* transform_factory::get_properties2(transform_instance* data)
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool transform_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool transform_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -866,11 +869,13 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
std::shared_ptr<transform_factory> _filter_transform_factory_instance = nullptr; std::shared_ptr<transform_factory> _filter_transform_factory_instance = nullptr;
void transform_factory::initialize() void transform_factory::initialize()
{
try { try {
if (!_filter_transform_factory_instance) if (!_filter_transform_factory_instance)
_filter_transform_factory_instance = std::make_shared<transform_factory>(); _filter_transform_factory_instance = std::make_shared<transform_factory>();
@ -879,6 +884,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void transform_factory::finalize() void transform_factory::finalize()
{ {

View File

@ -573,6 +573,7 @@ void upscaling_factory::get_defaults2(obs_data_t* data)
} }
static bool modified_provider(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept static bool modified_provider(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept
{
try { try {
return true; return true;
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
@ -582,6 +583,7 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
obs_properties_t* upscaling_factory::get_properties2(upscaling_instance* data) obs_properties_t* upscaling_factory::get_properties2(upscaling_instance* data)
{ {
@ -618,6 +620,7 @@ obs_properties_t* upscaling_factory::get_properties2(upscaling_instance* data)
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool upscaling_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool upscaling_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -628,6 +631,7 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
bool streamfx::filter::upscaling::upscaling_factory::is_provider_available(upscaling_provider provider) bool streamfx::filter::upscaling::upscaling_factory::is_provider_available(upscaling_provider provider)
@ -656,6 +660,7 @@ upscaling_provider streamfx::filter::upscaling::upscaling_factory::find_ideal_pr
std::shared_ptr<upscaling_factory> _video_superresolution_factory_instance = nullptr; std::shared_ptr<upscaling_factory> _video_superresolution_factory_instance = nullptr;
void upscaling_factory::initialize() void upscaling_factory::initialize()
{
try { try {
if (!_video_superresolution_factory_instance) if (!_video_superresolution_factory_instance)
_video_superresolution_factory_instance = std::make_shared<upscaling_factory>(); _video_superresolution_factory_instance = std::make_shared<upscaling_factory>();
@ -664,6 +669,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void upscaling_factory::finalize() void upscaling_factory::finalize()
{ {

View File

@ -574,6 +574,7 @@ void virtual_greenscreen_factory::get_defaults2(obs_data_t* data)
} }
static bool modified_provider(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept static bool modified_provider(obs_properties_t* props, obs_property_t*, obs_data_t* settings) noexcept
{
try { try {
return true; return true;
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
@ -583,6 +584,7 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
obs_properties_t* virtual_greenscreen_factory::get_properties2(virtual_greenscreen_instance* data) obs_properties_t* virtual_greenscreen_factory::get_properties2(virtual_greenscreen_instance* data)
{ {
@ -619,6 +621,7 @@ obs_properties_t* virtual_greenscreen_factory::get_properties2(virtual_greenscre
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool virtual_greenscreen_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool virtual_greenscreen_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -629,6 +632,7 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
bool streamfx::filter::virtual_greenscreen::virtual_greenscreen_factory::is_provider_available( bool streamfx::filter::virtual_greenscreen::virtual_greenscreen_factory::is_provider_available(
@ -658,6 +662,7 @@ virtual_greenscreen_provider streamfx::filter::virtual_greenscreen::virtual_gree
std::shared_ptr<virtual_greenscreen_factory> _video_superresolution_factory_instance = nullptr; std::shared_ptr<virtual_greenscreen_factory> _video_superresolution_factory_instance = nullptr;
void virtual_greenscreen_factory::initialize() void virtual_greenscreen_factory::initialize()
{
try { try {
if (!_video_superresolution_factory_instance) if (!_video_superresolution_factory_instance)
_video_superresolution_factory_instance = std::make_shared<virtual_greenscreen_factory>(); _video_superresolution_factory_instance = std::make_shared<virtual_greenscreen_factory>();
@ -666,6 +671,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void virtual_greenscreen_factory::finalize() void virtual_greenscreen_factory::finalize()
{ {

View File

@ -65,6 +65,7 @@ streamfx::gfx::shader::shader::shader(obs_source_t* self, shader_mode mode)
streamfx::gfx::shader::shader::~shader() = default; streamfx::gfx::shader::shader::~shader() = default;
bool streamfx::gfx::shader::shader::is_shader_different(const std::filesystem::path& file) bool streamfx::gfx::shader::shader::is_shader_different(const std::filesystem::path& file)
{
try { try {
if (std::filesystem::exists(file)) { if (std::filesystem::exists(file)) {
// Check if the file name differs. // Check if the file name differs.
@ -87,6 +88,7 @@ try {
DLOG_ERROR("Loading shader '%s' failed with error: %s", file.c_str(), ex.what()); DLOG_ERROR("Loading shader '%s' failed with error: %s", file.c_str(), ex.what());
return false; return false;
} }
}
bool streamfx::gfx::shader::shader::is_technique_different(std::string_view tech) bool streamfx::gfx::shader::shader::is_technique_different(std::string_view tech)
{ {
@ -99,6 +101,7 @@ bool streamfx::gfx::shader::shader::is_technique_different(std::string_view tech
bool streamfx::gfx::shader::shader::load_shader(const std::filesystem::path& file, std::string_view tech, bool streamfx::gfx::shader::shader::load_shader(const std::filesystem::path& file, std::string_view tech,
bool& shader_dirty, bool& param_dirty) bool& shader_dirty, bool& param_dirty)
{
try { try {
if (!std::filesystem::exists(file)) if (!std::filesystem::exists(file))
return false; return false;
@ -177,6 +180,7 @@ try {
} catch (...) { } catch (...) {
return false; return false;
} }
}
void streamfx::gfx::shader::shader::defaults(obs_data_t* data) void streamfx::gfx::shader::shader::defaults(obs_data_t* data)
{ {

View File

@ -90,7 +90,7 @@ streamfx::nvidia::ar::ar::ar() : _library(), _model_path()
DWORD env_size = GetEnvironmentVariableW(L"NVAR_MODEL_PATH", nullptr, 0); DWORD env_size = GetEnvironmentVariableW(L"NVAR_MODEL_PATH", nullptr, 0);
if (env_size > 0) { if (env_size > 0) {
std::vector<wchar_t> buffer(static_cast<size_t>(env_size) + 1, 0); std::vector<wchar_t> buffer(static_cast<size_t>(env_size) + 1, 0);
env_size = GetEnvironmentVariableW(L"NVAR_MODEL_PATH", buffer.data(), buffer.size()); env_size = GetEnvironmentVariableW(L"NVAR_MODEL_PATH", buffer.data(), static_cast<DWORD>(buffer.size()));
_model_path = std::wstring(buffer.data(), buffer.size()); _model_path = std::wstring(buffer.data(), buffer.size());
// The SDK is location one directory "up" from the model path. // The SDK is location one directory "up" from the model path.

View File

@ -58,7 +58,7 @@ static float find_closest_scale_factor(float factor)
static size_t find_closest_scale_factor_index(float factor) static size_t find_closest_scale_factor_index(float factor)
{ {
std::pair<size_t, float> minimal = {0.f, std::numeric_limits<float>::max()}; std::pair<size_t, float> minimal = {0, std::numeric_limits<float>::max()};
for (size_t idx = 0; idx < supported_scale_factors.size(); idx++) { for (size_t idx = 0; idx < supported_scale_factors.size(); idx++) {
float delta = supported_scale_factors[idx]; float delta = supported_scale_factors[idx];
float value = abs(delta - factor); float value = abs(delta - factor);

View File

@ -83,6 +83,7 @@ streamfx::obs::gs::effect_parameter& streamfx::obs::gs::effect_parameter::operat
} }
streamfx::obs::gs::effect_parameter::effect_parameter(effect_parameter&& rhs) noexcept streamfx::obs::gs::effect_parameter::effect_parameter(effect_parameter&& rhs) noexcept
{
try { try {
reset(rhs.get(), [](gs_eparam_t*) {}); reset(rhs.get(), [](gs_eparam_t*) {});
_effect_parent = rhs._effect_parent; _effect_parent = rhs._effect_parent;
@ -95,8 +96,10 @@ try {
rhs._param_parent = nullptr; rhs._param_parent = nullptr;
} catch (...) { } catch (...) {
} }
}
streamfx::obs::gs::effect_parameter& streamfx::obs::gs::effect_parameter::operator=(effect_parameter&& rhs) noexcept streamfx::obs::gs::effect_parameter& streamfx::obs::gs::effect_parameter::operator=(effect_parameter&& rhs) noexcept
{
try { try {
reset(rhs.get(), [](gs_eparam_t*) {}); reset(rhs.get(), [](gs_eparam_t*) {});
_effect_parent = rhs._effect_parent; _effect_parent = rhs._effect_parent;
@ -112,6 +115,7 @@ try {
} catch (...) { } catch (...) {
return *this; return *this;
} }
}
std::string_view streamfx::obs::gs::effect_parameter::get_name() std::string_view streamfx::obs::gs::effect_parameter::get_name()
{ {

View File

@ -174,6 +174,7 @@ namespace streamfx::obs {
private /* Factory */: private /* Factory */:
static const char* _get_name(void* type_data) noexcept static const char* _get_name(void* type_data) noexcept
{
try { try {
if (type_data) if (type_data)
return reinterpret_cast<factory_t*>(type_data)->get_name(); return reinterpret_cast<factory_t*>(type_data)->get_name();
@ -185,8 +186,10 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return nullptr; return nullptr;
} }
}
static void* _create(obs_data_t* settings, obs_encoder_t* encoder) noexcept static void* _create(obs_data_t* settings, obs_encoder_t* encoder) noexcept
{
try { try {
auto* fac = reinterpret_cast<factory_t*>(obs_encoder_get_type_data(encoder)); auto* fac = reinterpret_cast<factory_t*>(obs_encoder_get_type_data(encoder));
return fac->create(settings, encoder, false); return fac->create(settings, encoder, false);
@ -197,8 +200,10 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return nullptr; return nullptr;
} }
}
static void* _create_hw(obs_data_t* settings, obs_encoder_t* encoder) noexcept static void* _create_hw(obs_data_t* settings, obs_encoder_t* encoder) noexcept
{
try { try {
auto* fac = reinterpret_cast<factory_t*>(obs_encoder_get_type_data(encoder)); auto* fac = reinterpret_cast<factory_t*>(obs_encoder_get_type_data(encoder));
try { try {
@ -213,8 +218,10 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return nullptr; return nullptr;
} }
}
static void _get_defaults2(obs_data_t* settings, void* type_data) noexcept static void _get_defaults2(obs_data_t* settings, void* type_data) noexcept
{
try { try {
if (type_data) if (type_data)
reinterpret_cast<factory_t*>(type_data)->get_defaults2(settings); reinterpret_cast<factory_t*>(type_data)->get_defaults2(settings);
@ -223,9 +230,11 @@ namespace streamfx::obs {
} catch (...) { } catch (...) {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
} }
}
static bool _properties_migrate_settings(void* priv, obs_properties_t*, obs_property_t* p, static bool _properties_migrate_settings(void* priv, obs_properties_t*, obs_property_t* p,
obs_data_t* settings) noexcept obs_data_t* settings) noexcept
{
try { try {
obs_property_set_visible(p, false); obs_property_set_visible(p, false);
reinterpret_cast<factory_t*>(priv)->_migrate(settings, nullptr); reinterpret_cast<factory_t*>(priv)->_migrate(settings, nullptr);
@ -237,8 +246,10 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
static obs_properties_t* _get_properties2(void* data, void* type_data) noexcept static obs_properties_t* _get_properties2(void* data, void* type_data) noexcept
{
try { try {
if (type_data) { if (type_data) {
auto props = auto props =
@ -261,9 +272,11 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return nullptr; return nullptr;
} }
}
private /* Instance */: private /* Instance */:
static void _destroy(void* data) noexcept static void _destroy(void* data) noexcept
{
try { try {
if (data) if (data)
delete reinterpret_cast<instance_t*>(data); delete reinterpret_cast<instance_t*>(data);
@ -272,8 +285,10 @@ namespace streamfx::obs {
} catch (...) { } catch (...) {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
} }
}
static bool _update(void* data, obs_data_t* settings) noexcept static bool _update(void* data, obs_data_t* settings) noexcept
{
try { try {
auto priv = reinterpret_cast<encoder_instance*>(data); auto priv = reinterpret_cast<encoder_instance*>(data);
if (priv) { if (priv) {
@ -288,9 +303,11 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
static bool _encode(void* data, struct encoder_frame* frame, struct encoder_packet* packet, static bool _encode(void* data, struct encoder_frame* frame, struct encoder_packet* packet,
bool* received_packet) noexcept bool* received_packet) noexcept
{
try { try {
if (data) if (data)
return reinterpret_cast<encoder_instance*>(data)->encode_video(frame, packet, received_packet); return reinterpret_cast<encoder_instance*>(data)->encode_video(frame, packet, received_packet);
@ -302,13 +319,15 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
static bool _encode_texture(void* data, uint32_t handle, int64_t pts, uint64_t lock_key, uint64_t* next_key, static bool _encode_texture(void* data, uint32_t handle, int64_t pts, uint64_t lock_key, uint64_t* next_key,
struct encoder_packet* packet, bool* received_packet) noexcept struct encoder_packet* packet, bool* received_packet) noexcept
{
try { try {
if (data) if (data)
return reinterpret_cast<encoder_instance*>(data)->encode_video(handle, pts, lock_key, next_key, packet, return reinterpret_cast<encoder_instance*>(data)->encode_video(handle, pts, lock_key, next_key,
received_packet); packet, received_packet);
return false; return false;
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what()); DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
@ -317,8 +336,10 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
static size_t _get_frame_size(void* data) noexcept static size_t _get_frame_size(void* data) noexcept
{
try { try {
if (data) if (data)
return reinterpret_cast<encoder_instance*>(data)->get_frame_size(); return reinterpret_cast<encoder_instance*>(data)->get_frame_size();
@ -330,8 +351,10 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return 0; return 0;
} }
}
static bool _get_extra_data(void* data, uint8_t** extra_data, size_t* size) noexcept static bool _get_extra_data(void* data, uint8_t** extra_data, size_t* size) noexcept
{
try { try {
if (data) if (data)
return reinterpret_cast<encoder_instance*>(data)->get_extra_data(extra_data, size); return reinterpret_cast<encoder_instance*>(data)->get_extra_data(extra_data, size);
@ -343,8 +366,10 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
static bool _get_sei_data(void* data, uint8_t** sei_data, size_t* size) noexcept static bool _get_sei_data(void* data, uint8_t** sei_data, size_t* size) noexcept
{
try { try {
if (data) if (data)
return reinterpret_cast<encoder_instance*>(data)->get_sei_data(sei_data, size); return reinterpret_cast<encoder_instance*>(data)->get_sei_data(sei_data, size);
@ -356,8 +381,10 @@ namespace streamfx::obs {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
static void _get_audio_info(void* data, struct audio_convert_info* info) noexcept static void _get_audio_info(void* data, struct audio_convert_info* info) noexcept
{
try { try {
if (data) if (data)
reinterpret_cast<encoder_instance*>(data)->get_audio_info(info); reinterpret_cast<encoder_instance*>(data)->get_audio_info(info);
@ -366,8 +393,10 @@ namespace streamfx::obs {
} catch (...) { } catch (...) {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
} }
}
static void _get_video_info(void* data, struct video_scale_info* info) noexcept static void _get_video_info(void* data, struct video_scale_info* info) noexcept
{
try { try {
if (data) if (data)
reinterpret_cast<encoder_instance*>(data)->get_video_info(info); reinterpret_cast<encoder_instance*>(data)->get_video_info(info);
@ -376,6 +405,7 @@ namespace streamfx::obs {
} catch (...) { } catch (...) {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
} }
}
public: public:
virtual const char* get_name() virtual const char* get_name()

View File

@ -44,11 +44,13 @@ namespace streamfx::obs {
std::shared_ptr<obs_source_t> _keepalive; std::shared_ptr<obs_source_t> _keepalive;
static void handle_signal(void* ptr, calldata* cd) noexcept static void handle_signal(void* ptr, calldata* cd) noexcept
{
try { try {
auto p = reinterpret_cast<signal_handler<std::shared_ptr<obs_source_t>>*>(ptr); auto p = reinterpret_cast<signal_handler<std::shared_ptr<obs_source_t>>*>(ptr);
p->event(p->_keepalive, cd); p->event(p->_keepalive, cd);
} catch (...) { } catch (...) {
} }
}
public: public:
signal_handler(std::string_view signal, std::shared_ptr<obs_source_t> keepalive) : _keepalive(keepalive) signal_handler(std::string_view signal, std::shared_ptr<obs_source_t> keepalive) : _keepalive(keepalive)
@ -72,11 +74,13 @@ namespace streamfx::obs {
::streamfx::obs::source _keepalive; ::streamfx::obs::source _keepalive;
static void handle_audio(void* ptr, obs_source_t*, const struct audio_data* audio_data, bool muted) noexcept static void handle_audio(void* ptr, obs_source_t*, const struct audio_data* audio_data, bool muted) noexcept
{
try { try {
auto p = reinterpret_cast<audio_signal_handler*>(ptr); auto p = reinterpret_cast<audio_signal_handler*>(ptr);
p->event(p->_keepalive, audio_data, muted); p->event(p->_keepalive, audio_data, muted);
} catch (...) { } catch (...) {
} }
}
public: public:
audio_signal_handler(::streamfx::obs::source const& keepalive) : _keepalive(keepalive), event() audio_signal_handler(::streamfx::obs::source const& keepalive) : _keepalive(keepalive), event()

View File

@ -97,6 +97,7 @@ static std::shared_ptr<streamfx::gfx::opengl> _streamfx_gfx_opengl;
static std::shared_ptr<streamfx::obs::source_tracker> _source_tracker; static std::shared_ptr<streamfx::obs::source_tracker> _source_tracker;
MODULE_EXPORT bool obs_module_load(void) MODULE_EXPORT bool obs_module_load(void)
{
try { try {
DLOG_INFO("Loading Version %s", STREAMFX_VERSION_STRING); DLOG_INFO("Loading Version %s", STREAMFX_VERSION_STRING);
@ -225,8 +226,10 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
return false; return false;
} }
}
MODULE_EXPORT void obs_module_unload(void) MODULE_EXPORT void obs_module_unload(void)
{
try { try {
DLOG_INFO("Unloading Version %s", STREAMFX_VERSION_STRING); DLOG_INFO("Unloading Version %s", STREAMFX_VERSION_STRING);
@ -330,6 +333,7 @@ try {
} catch (...) { } catch (...) {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
} }
}
std::shared_ptr<streamfx::util::threadpool> streamfx::threadpool() std::shared_ptr<streamfx::util::threadpool> streamfx::threadpool()
{ {

View File

@ -184,6 +184,7 @@ void mirror_instance::enum_all_sources(obs_source_enum_proc_t cb, void* ptr)
} }
void mirror_instance::acquire(std::string source_name) void mirror_instance::acquire(std::string source_name)
{
try { try {
release(); release();
@ -208,6 +209,7 @@ try {
} catch (...) { } catch (...) {
release(); release();
} }
}
void mirror_instance::release() void mirror_instance::release()
{ {
@ -306,6 +308,7 @@ void mirror_factory::get_defaults2(obs_data_t* data)
} }
static bool modified_properties(obs_properties_t* pr, obs_property_t* p, obs_data_t* data) noexcept static bool modified_properties(obs_properties_t* pr, obs_property_t* p, obs_data_t* data) noexcept
{
try { try {
if (obs_properties_get(pr, ST_KEY_SOURCE_AUDIO) == p) { if (obs_properties_get(pr, ST_KEY_SOURCE_AUDIO) == p) {
bool show = obs_data_get_bool(data, ST_KEY_SOURCE_AUDIO); bool show = obs_data_get_bool(data, ST_KEY_SOURCE_AUDIO);
@ -316,6 +319,7 @@ try {
} catch (...) { } catch (...) {
return false; return false;
} }
}
obs_properties_t* mirror_factory::get_properties2(mirror_instance* data) obs_properties_t* mirror_factory::get_properties2(mirror_instance* data)
{ {
@ -384,6 +388,7 @@ obs_properties_t* mirror_factory::get_properties2(mirror_instance* data)
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool mirror_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool mirror_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -394,11 +399,13 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
std::shared_ptr<mirror_factory> _source_mirror_factory_instance; std::shared_ptr<mirror_factory> _source_mirror_factory_instance;
void streamfx::source::mirror::mirror_factory::initialize() void streamfx::source::mirror::mirror_factory::initialize()
{
try { try {
if (!_source_mirror_factory_instance) if (!_source_mirror_factory_instance)
_source_mirror_factory_instance = std::make_shared<mirror_factory>(); _source_mirror_factory_instance = std::make_shared<mirror_factory>();
@ -407,6 +414,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void streamfx::source::mirror::mirror_factory::finalize() void streamfx::source::mirror::mirror_factory::finalize()
{ {

View File

@ -171,6 +171,7 @@ obs_properties_t* shader_factory::get_properties2(shader_instance* data)
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool shader_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool shader_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -181,11 +182,13 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
std::shared_ptr<shader_factory> _source_shader_factory_instance = nullptr; std::shared_ptr<shader_factory> _source_shader_factory_instance = nullptr;
void streamfx::source::shader::shader_factory::initialize() void streamfx::source::shader::shader_factory::initialize()
{
try { try {
if (!_source_shader_factory_instance) if (!_source_shader_factory_instance)
_source_shader_factory_instance = std::make_shared<shader_factory>(); _source_shader_factory_instance = std::make_shared<shader_factory>();
@ -194,6 +197,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void streamfx::source::shader::shader_factory::finalize() void streamfx::source::shader::shader_factory::finalize()
{ {

View File

@ -183,6 +183,7 @@ obs_properties_t* shader_factory::get_properties2(shader::shader_instance* data)
#ifdef ENABLE_FRONTEND #ifdef ENABLE_FRONTEND
bool shader_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data) bool shader_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try { try {
streamfx::open_url(HELP_URL); streamfx::open_url(HELP_URL);
return false; return false;
@ -193,11 +194,13 @@ try {
D_LOG_ERROR("Failed to open manual due to unknown error.", ""); D_LOG_ERROR("Failed to open manual due to unknown error.", "");
return false; return false;
} }
}
#endif #endif
std::shared_ptr<shader_factory> _transition_shader_factory_instance = nullptr; std::shared_ptr<shader_factory> _transition_shader_factory_instance = nullptr;
void streamfx::transition::shader::shader_factory::initialize() void streamfx::transition::shader::shader_factory::initialize()
{
try { try {
if (!_transition_shader_factory_instance) if (!_transition_shader_factory_instance)
_transition_shader_factory_instance = std::make_shared<shader_factory>(); _transition_shader_factory_instance = std::make_shared<shader_factory>();
@ -206,6 +209,7 @@ try {
} catch (...) { } catch (...) {
D_LOG_ERROR("Failed to initialize due to unknown error.", ""); D_LOG_ERROR("Failed to initialize due to unknown error.", "");
} }
}
void streamfx::transition::shader::shader_factory::finalize() void streamfx::transition::shader::shader_factory::finalize()
{ {

View File

@ -226,6 +226,7 @@ streamfx::version_info::operator std::string()
} }
void streamfx::updater::task(streamfx::util::threadpool_data_t) void streamfx::updater::task(streamfx::util::threadpool_data_t)
{
try { try {
auto query_fn = [this](std::vector<char>& buffer) { auto query_fn = [this](std::vector<char>& buffer) {
static constexpr std::string_view ST_API_URL = static constexpr std::string_view ST_API_URL =
@ -342,7 +343,8 @@ try {
// Print all update information to the log file. // Print all update information to the log file.
D_LOG_INFO("Current Version: %s", static_cast<std::string>(_current_info).c_str()); D_LOG_INFO("Current Version: %s", static_cast<std::string>(_current_info).c_str());
D_LOG_INFO("Latest Stable Version: %s", static_cast<std::string>(get_update_info(version_stage::STABLE)).c_str()); D_LOG_INFO("Latest Stable Version: %s",
static_cast<std::string>(get_update_info(version_stage::STABLE)).c_str());
D_LOG_INFO("Latest Candidate Version: %s", D_LOG_INFO("Latest Candidate Version: %s",
static_cast<std::string>(get_update_info(version_stage::CANDIDATE)).c_str()); static_cast<std::string>(get_update_info(version_stage::CANDIDATE)).c_str());
D_LOG_INFO("Latest Beta Version: %s", static_cast<std::string>(get_update_info(version_stage::BETA)).c_str()); D_LOG_INFO("Latest Beta Version: %s", static_cast<std::string>(get_update_info(version_stage::BETA)).c_str());
@ -358,6 +360,7 @@ try {
std::string message = ex.what(); std::string message = ex.what();
events.error.call(*this, message); events.error.call(*this, message);
} }
}
bool streamfx::updater::can_check() bool streamfx::updater::can_check()
{ {