mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-29 11:01:23 +00:00
code: Don't use try-catch as function definition
This breaks MSVC and results in leaked exceptions.
This commit is contained in:
parent
678399ce81
commit
0fe5c7e654
24 changed files with 1150 additions and 1023 deletions
|
@ -1278,12 +1278,14 @@ aom_av1_factory::~aom_av1_factory() {}
|
|||
std::shared_ptr<aom_av1_factory> _aom_av1_factory_instance = nullptr;
|
||||
|
||||
void aom_av1_factory::initialize()
|
||||
try {
|
||||
{
|
||||
try {
|
||||
if (!_aom_av1_factory_instance) {
|
||||
_aom_av1_factory_instance = std::make_shared<aom_av1_factory>();
|
||||
}
|
||||
} catch (std::exception const& ex) {
|
||||
} catch (std::exception const& ex) {
|
||||
D_LOG_ERROR("Failed to initialize AOM AV1 encoder: %s", ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
void aom_av1_factory::finalize()
|
||||
|
@ -1349,7 +1351,8 @@ 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
|
||||
try {
|
||||
{
|
||||
try {
|
||||
bool is_all_intra = false;
|
||||
if (obs_data_get_int(settings, ST_KEY_ENCODER_USAGE) == AOM_USAGE_ALL_INTRA) {
|
||||
is_all_intra = true;
|
||||
|
@ -1360,16 +1363,18 @@ try {
|
|||
obs_property_set_visible(obs_properties_get(props, ST_I18N_KEYFRAMES), !is_all_intra);
|
||||
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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_overundershoot_visible = false;
|
||||
bool is_quality_visible = false;
|
||||
|
@ -1405,26 +1410,29 @@ try {
|
|||
#endif
|
||||
}
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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_SECONDS), is_seconds);
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* aom_av1_factory::get_properties2(instance_t* data)
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
|
||||
// Create 8MB of precached Packet data for use later on.
|
||||
// Allocate a small packet for later use.
|
||||
av_init_packet(&_packet);
|
||||
av_new_packet(&_packet, 8 * 1024 * 1024); // 8 MB precached Packet size.
|
||||
|
||||
|
@ -1051,17 +1051,19 @@ 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
|
||||
try {
|
||||
{
|
||||
try {
|
||||
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_SECONDS), is_seconds);
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* ffmpeg_factory::get_properties2(instance_t* data)
|
||||
|
|
|
@ -1125,14 +1125,16 @@ 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
|
||||
try {
|
||||
{
|
||||
try {
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* autoframing_factory::get_properties2(autoframing_instance* data)
|
||||
|
@ -1315,13 +1317,15 @@ tracking_provider streamfx::filter::autoframing::autoframing_factory::find_ideal
|
|||
std::shared_ptr<autoframing_factory> _filter_autoframing_factory_instance = nullptr;
|
||||
|
||||
void autoframing_factory::initialize()
|
||||
try {
|
||||
{
|
||||
try {
|
||||
if (!_filter_autoframing_factory_instance)
|
||||
_filter_autoframing_factory_instance = std::make_shared<autoframing_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void autoframing_factory::finalize()
|
||||
|
|
|
@ -649,7 +649,8 @@ 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
|
||||
try {
|
||||
{
|
||||
try {
|
||||
obs_property_t* p;
|
||||
const char* propname = obs_property_name(prop);
|
||||
const char* vtype = obs_data_get_string(settings, ST_KEY_TYPE);
|
||||
|
@ -773,9 +774,10 @@ try {
|
|||
}
|
||||
|
||||
return true;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in modified_properties callback.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* blur_factory::get_properties2(blur_instance* data)
|
||||
|
@ -896,28 +898,32 @@ 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 {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} 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 {
|
||||
{
|
||||
try {
|
||||
if (!_filter_blur_factory_instance)
|
||||
_filter_blur_factory_instance = std::make_shared<blur_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::filter::blur::blur_factory::finalize()
|
||||
|
|
|
@ -882,28 +882,32 @@ 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 {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} 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 {
|
||||
{
|
||||
try {
|
||||
if (!_color_grade_factory_instance)
|
||||
_color_grade_factory_instance = std::make_shared<color_grade_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::filter::color_grade::color_grade_factory::finalize()
|
||||
|
|
|
@ -572,14 +572,16 @@ 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
|
||||
try {
|
||||
{
|
||||
try {
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* denoising_factory::get_properties2(denoising_instance* data)
|
||||
|
@ -649,13 +651,15 @@ denoising_provider streamfx::filter::denoising::denoising_factory::find_ideal_pr
|
|||
std::shared_ptr<denoising_factory> _video_denoising_factory_instance = nullptr;
|
||||
|
||||
void denoising_factory::initialize()
|
||||
try {
|
||||
{
|
||||
try {
|
||||
if (!_video_denoising_factory_instance)
|
||||
_video_denoising_factory_instance = std::make_shared<denoising_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void denoising_factory::finalize()
|
||||
|
|
|
@ -203,13 +203,15 @@ 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 {
|
||||
{
|
||||
try {
|
||||
if (!_filter_displacement_factory_instance)
|
||||
_filter_displacement_factory_instance = std::make_shared<displacement_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::filter::displacement::displacement_factory::finalize()
|
||||
|
|
|
@ -403,7 +403,8 @@ void streamfx::filter::dynamic_mask::dynamic_mask_instance::deactivate()
|
|||
}
|
||||
|
||||
bool dynamic_mask_instance::acquire(std::string_view name)
|
||||
try {
|
||||
{
|
||||
try {
|
||||
// Prevent us from creating a circle.
|
||||
if (auto v = obs_source_get_name(obs_filter_get_parent(_self)); (v != nullptr) && (name == v)) {
|
||||
return false;
|
||||
|
@ -424,12 +425,13 @@ try {
|
|||
show();
|
||||
|
||||
return true;
|
||||
} catch (const std::exception&) {
|
||||
} catch (const std::exception&) {
|
||||
release();
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
release();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void dynamic_mask_instance::release()
|
||||
|
@ -565,28 +567,32 @@ 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 {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} 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 {
|
||||
{
|
||||
try {
|
||||
if (!_filter_dynamic_mask_factory_instance)
|
||||
_filter_dynamic_mask_factory_instance = std::make_shared<dynamic_mask_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::filter::dynamic_mask::dynamic_mask_factory::finalize()
|
||||
|
|
|
@ -724,28 +724,32 @@ 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 {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} 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 {
|
||||
{
|
||||
try {
|
||||
if (!_filter_sdf_effects_factory_instance)
|
||||
_filter_sdf_effects_factory_instance = std::make_shared<sdf_effects_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::filter::sdf_effects::sdf_effects_factory::finalize()
|
||||
|
|
|
@ -218,28 +218,32 @@ 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 {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} 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 {
|
||||
{
|
||||
try {
|
||||
if (!_filter_shader_factory_instance)
|
||||
_filter_shader_factory_instance = std::make_shared<shader_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::filter::shader::shader_factory::finalize()
|
||||
|
|
|
@ -636,7 +636,8 @@ 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
|
||||
try {
|
||||
{
|
||||
try {
|
||||
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_perspective = (mode == transform_mode::PERSPECTIVE) && is_camera;
|
||||
|
@ -652,12 +653,13 @@ try {
|
|||
obs_property_set_visible(obs_properties_get(pr, ST_I18N_CORNERS), !is_camera);
|
||||
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
return true;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* transform_factory::get_properties2(transform_instance* data)
|
||||
|
@ -856,28 +858,32 @@ 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 {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} 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 {
|
||||
{
|
||||
try {
|
||||
if (!_filter_transform_factory_instance)
|
||||
_filter_transform_factory_instance = std::make_shared<transform_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void transform_factory::finalize()
|
||||
|
|
|
@ -573,14 +573,16 @@ 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
|
||||
try {
|
||||
{
|
||||
try {
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* upscaling_factory::get_properties2(upscaling_instance* data)
|
||||
|
@ -618,15 +620,17 @@ obs_properties_t* upscaling_factory::get_properties2(upscaling_instance* data)
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool upscaling_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
try {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -656,13 +660,15 @@ upscaling_provider streamfx::filter::upscaling::upscaling_factory::find_ideal_pr
|
|||
std::shared_ptr<upscaling_factory> _video_superresolution_factory_instance = nullptr;
|
||||
|
||||
void upscaling_factory::initialize()
|
||||
try {
|
||||
{
|
||||
try {
|
||||
if (!_video_superresolution_factory_instance)
|
||||
_video_superresolution_factory_instance = std::make_shared<upscaling_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void upscaling_factory::finalize()
|
||||
|
|
|
@ -574,14 +574,16 @@ 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
|
||||
try {
|
||||
{
|
||||
try {
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* virtual_greenscreen_factory::get_properties2(virtual_greenscreen_instance* data)
|
||||
|
@ -619,15 +621,17 @@ obs_properties_t* virtual_greenscreen_factory::get_properties2(virtual_greenscre
|
|||
|
||||
#ifdef ENABLE_FRONTEND
|
||||
bool virtual_greenscreen_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
|
||||
try {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to open manual due to unknown error.", "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -658,13 +662,15 @@ virtual_greenscreen_provider streamfx::filter::virtual_greenscreen::virtual_gree
|
|||
std::shared_ptr<virtual_greenscreen_factory> _video_superresolution_factory_instance = nullptr;
|
||||
|
||||
void virtual_greenscreen_factory::initialize()
|
||||
try {
|
||||
{
|
||||
try {
|
||||
if (!_video_superresolution_factory_instance)
|
||||
_video_superresolution_factory_instance = std::make_shared<virtual_greenscreen_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void virtual_greenscreen_factory::finalize()
|
||||
|
|
|
@ -65,7 +65,8 @@ streamfx::gfx::shader::shader::shader(obs_source_t* self, shader_mode mode)
|
|||
streamfx::gfx::shader::shader::~shader() = default;
|
||||
|
||||
bool streamfx::gfx::shader::shader::is_shader_different(const std::filesystem::path& file)
|
||||
try {
|
||||
{
|
||||
try {
|
||||
if (std::filesystem::exists(file)) {
|
||||
// Check if the file name differs.
|
||||
if (file != _shader_file)
|
||||
|
@ -83,9 +84,10 @@ try {
|
|||
}
|
||||
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Loading shader '%s' failed with error: %s", file.c_str(), ex.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool streamfx::gfx::shader::shader::is_technique_different(std::string_view tech)
|
||||
|
@ -99,7 +101,8 @@ 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& shader_dirty, bool& param_dirty)
|
||||
try {
|
||||
{
|
||||
try {
|
||||
if (!std::filesystem::exists(file))
|
||||
return false;
|
||||
|
||||
|
@ -171,11 +174,12 @@ try {
|
|||
}
|
||||
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Loading shader '%s' failed with error: %s", file.c_str(), ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::gfx::shader::shader::defaults(obs_data_t* data)
|
||||
|
|
|
@ -90,7 +90,7 @@ streamfx::nvidia::ar::ar::ar() : _library(), _model_path()
|
|||
DWORD env_size = GetEnvironmentVariableW(L"NVAR_MODEL_PATH", nullptr, 0);
|
||||
if (env_size > 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());
|
||||
|
||||
// The SDK is location one directory "up" from the model path.
|
||||
|
|
|
@ -58,7 +58,7 @@ static float find_closest_scale_factor(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++) {
|
||||
float delta = supported_scale_factors[idx];
|
||||
float value = abs(delta - factor);
|
||||
|
|
|
@ -83,7 +83,8 @@ streamfx::obs::gs::effect_parameter& streamfx::obs::gs::effect_parameter::operat
|
|||
}
|
||||
|
||||
streamfx::obs::gs::effect_parameter::effect_parameter(effect_parameter&& rhs) noexcept
|
||||
try {
|
||||
{
|
||||
try {
|
||||
reset(rhs.get(), [](gs_eparam_t*) {});
|
||||
_effect_parent = rhs._effect_parent;
|
||||
_pass_parent = rhs._pass_parent;
|
||||
|
@ -93,11 +94,13 @@ try {
|
|||
rhs._effect_parent = nullptr;
|
||||
rhs._pass_parent = nullptr;
|
||||
rhs._param_parent = nullptr;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
streamfx::obs::gs::effect_parameter& streamfx::obs::gs::effect_parameter::operator=(effect_parameter&& rhs) noexcept
|
||||
try {
|
||||
{
|
||||
try {
|
||||
reset(rhs.get(), [](gs_eparam_t*) {});
|
||||
_effect_parent = rhs._effect_parent;
|
||||
_pass_parent = rhs._pass_parent;
|
||||
|
@ -109,8 +112,9 @@ try {
|
|||
rhs._param_parent = nullptr;
|
||||
|
||||
return *this;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view streamfx::obs::gs::effect_parameter::get_name()
|
||||
|
|
|
@ -174,6 +174,7 @@ namespace streamfx::obs {
|
|||
|
||||
private /* Factory */:
|
||||
static const char* _get_name(void* type_data) noexcept
|
||||
{
|
||||
try {
|
||||
if (type_data)
|
||||
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__);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void* _create(obs_data_t* settings, obs_encoder_t* encoder) noexcept
|
||||
{
|
||||
try {
|
||||
auto* fac = reinterpret_cast<factory_t*>(obs_encoder_get_type_data(encoder));
|
||||
return fac->create(settings, encoder, false);
|
||||
|
@ -197,8 +200,10 @@ namespace streamfx::obs {
|
|||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void* _create_hw(obs_data_t* settings, obs_encoder_t* encoder) noexcept
|
||||
{
|
||||
try {
|
||||
auto* fac = reinterpret_cast<factory_t*>(obs_encoder_get_type_data(encoder));
|
||||
try {
|
||||
|
@ -213,8 +218,10 @@ namespace streamfx::obs {
|
|||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void _get_defaults2(obs_data_t* settings, void* type_data) noexcept
|
||||
{
|
||||
try {
|
||||
if (type_data)
|
||||
reinterpret_cast<factory_t*>(type_data)->get_defaults2(settings);
|
||||
|
@ -223,9 +230,11 @@ namespace streamfx::obs {
|
|||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
}
|
||||
}
|
||||
|
||||
static bool _properties_migrate_settings(void* priv, obs_properties_t*, obs_property_t* p,
|
||||
obs_data_t* settings) noexcept
|
||||
{
|
||||
try {
|
||||
obs_property_set_visible(p, false);
|
||||
reinterpret_cast<factory_t*>(priv)->_migrate(settings, nullptr);
|
||||
|
@ -237,8 +246,10 @@ namespace streamfx::obs {
|
|||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static obs_properties_t* _get_properties2(void* data, void* type_data) noexcept
|
||||
{
|
||||
try {
|
||||
if (type_data) {
|
||||
auto props =
|
||||
|
@ -261,9 +272,11 @@ namespace streamfx::obs {
|
|||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
private /* Instance */:
|
||||
static void _destroy(void* data) noexcept
|
||||
{
|
||||
try {
|
||||
if (data)
|
||||
delete reinterpret_cast<instance_t*>(data);
|
||||
|
@ -272,8 +285,10 @@ namespace streamfx::obs {
|
|||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
}
|
||||
}
|
||||
|
||||
static bool _update(void* data, obs_data_t* settings) noexcept
|
||||
{
|
||||
try {
|
||||
auto priv = reinterpret_cast<encoder_instance*>(data);
|
||||
if (priv) {
|
||||
|
@ -288,9 +303,11 @@ namespace streamfx::obs {
|
|||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool _encode(void* data, struct encoder_frame* frame, struct encoder_packet* packet,
|
||||
bool* received_packet) noexcept
|
||||
{
|
||||
try {
|
||||
if (data)
|
||||
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__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
try {
|
||||
if (data)
|
||||
return reinterpret_cast<encoder_instance*>(data)->encode_video(handle, pts, lock_key, next_key, packet,
|
||||
received_packet);
|
||||
return reinterpret_cast<encoder_instance*>(data)->encode_video(handle, pts, lock_key, next_key,
|
||||
packet, received_packet);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
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__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static size_t _get_frame_size(void* data) noexcept
|
||||
{
|
||||
try {
|
||||
if (data)
|
||||
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__);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static bool _get_extra_data(void* data, uint8_t** extra_data, size_t* size) noexcept
|
||||
{
|
||||
try {
|
||||
if (data)
|
||||
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__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool _get_sei_data(void* data, uint8_t** sei_data, size_t* size) noexcept
|
||||
{
|
||||
try {
|
||||
if (data)
|
||||
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__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void _get_audio_info(void* data, struct audio_convert_info* info) noexcept
|
||||
{
|
||||
try {
|
||||
if (data)
|
||||
reinterpret_cast<encoder_instance*>(data)->get_audio_info(info);
|
||||
|
@ -366,8 +393,10 @@ namespace streamfx::obs {
|
|||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
}
|
||||
}
|
||||
|
||||
static void _get_video_info(void* data, struct video_scale_info* info) noexcept
|
||||
{
|
||||
try {
|
||||
if (data)
|
||||
reinterpret_cast<encoder_instance*>(data)->get_video_info(info);
|
||||
|
@ -376,6 +405,7 @@ namespace streamfx::obs {
|
|||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const char* get_name()
|
||||
|
|
|
@ -44,11 +44,13 @@ namespace streamfx::obs {
|
|||
std::shared_ptr<obs_source_t> _keepalive;
|
||||
|
||||
static void handle_signal(void* ptr, calldata* cd) noexcept
|
||||
{
|
||||
try {
|
||||
auto p = reinterpret_cast<signal_handler<std::shared_ptr<obs_source_t>>*>(ptr);
|
||||
p->event(p->_keepalive, cd);
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
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;
|
||||
|
||||
static void handle_audio(void* ptr, obs_source_t*, const struct audio_data* audio_data, bool muted) noexcept
|
||||
{
|
||||
try {
|
||||
auto p = reinterpret_cast<audio_signal_handler*>(ptr);
|
||||
p->event(p->_keepalive, audio_data, muted);
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
audio_signal_handler(::streamfx::obs::source const& keepalive) : _keepalive(keepalive), event()
|
||||
|
|
|
@ -97,7 +97,8 @@ static std::shared_ptr<streamfx::gfx::opengl> _streamfx_gfx_opengl;
|
|||
static std::shared_ptr<streamfx::obs::source_tracker> _source_tracker;
|
||||
|
||||
MODULE_EXPORT bool obs_module_load(void)
|
||||
try {
|
||||
{
|
||||
try {
|
||||
DLOG_INFO("Loading Version %s", STREAMFX_VERSION_STRING);
|
||||
|
||||
// Initialize global configuration.
|
||||
|
@ -218,16 +219,18 @@ try {
|
|||
|
||||
DLOG_INFO("Loaded Version %s", STREAMFX_VERSION_STRING);
|
||||
return true;
|
||||
} catch (std::exception const& ex) {
|
||||
} catch (std::exception const& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s", __FUNCTION_NAME__, ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
MODULE_EXPORT void obs_module_unload(void)
|
||||
try {
|
||||
{
|
||||
try {
|
||||
DLOG_INFO("Unloading Version %s", STREAMFX_VERSION_STRING);
|
||||
|
||||
// Frontend
|
||||
|
@ -325,10 +328,11 @@ try {
|
|||
streamfx::configuration::finalize();
|
||||
|
||||
DLOG_INFO("Unloaded Version %s", STREAMFX_VERSION_STRING);
|
||||
} catch (std::exception const& ex) {
|
||||
} catch (std::exception const& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s", __FUNCTION_NAME__, ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<streamfx::util::threadpool> streamfx::threadpool()
|
||||
|
|
|
@ -184,7 +184,8 @@ void mirror_instance::enum_all_sources(obs_source_enum_proc_t cb, void* ptr)
|
|||
}
|
||||
|
||||
void mirror_instance::acquire(std::string source_name)
|
||||
try {
|
||||
{
|
||||
try {
|
||||
release();
|
||||
|
||||
// Find source by name if possible.
|
||||
|
@ -205,8 +206,9 @@ try {
|
|||
_signal_audio->event.add(std::bind(&mirror_instance::on_audio, this, std::placeholders::_1,
|
||||
std::placeholders::_2, std::placeholders::_3));
|
||||
}
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
release();
|
||||
}
|
||||
}
|
||||
|
||||
void mirror_instance::release()
|
||||
|
@ -306,15 +308,17 @@ 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
|
||||
try {
|
||||
{
|
||||
try {
|
||||
if (obs_properties_get(pr, ST_KEY_SOURCE_AUDIO) == p) {
|
||||
bool show = obs_data_get_bool(data, ST_KEY_SOURCE_AUDIO);
|
||||
obs_property_set_visible(obs_properties_get(pr, ST_KEY_SOURCE_AUDIO_LAYOUT), show);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* mirror_factory::get_properties2(mirror_instance* data)
|
||||
|
@ -384,28 +388,32 @@ 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 {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} 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 {
|
||||
{
|
||||
try {
|
||||
if (!_source_mirror_factory_instance)
|
||||
_source_mirror_factory_instance = std::make_shared<mirror_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::source::mirror::mirror_factory::finalize()
|
||||
|
|
|
@ -171,28 +171,32 @@ 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 {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} 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 {
|
||||
{
|
||||
try {
|
||||
if (!_source_shader_factory_instance)
|
||||
_source_shader_factory_instance = std::make_shared<shader_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::source::shader::shader_factory::finalize()
|
||||
|
|
|
@ -183,28 +183,32 @@ 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 {
|
||||
{
|
||||
try {
|
||||
streamfx::open_url(HELP_URL);
|
||||
return false;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to open manual due to error: %s", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
} 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 {
|
||||
{
|
||||
try {
|
||||
if (!_transition_shader_factory_instance)
|
||||
_transition_shader_factory_instance = std::make_shared<shader_factory>();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
D_LOG_ERROR("Failed to initialize due to error: %s", ex.what());
|
||||
} catch (...) {
|
||||
} catch (...) {
|
||||
D_LOG_ERROR("Failed to initialize due to unknown error.", "");
|
||||
}
|
||||
}
|
||||
|
||||
void streamfx::transition::shader::shader_factory::finalize()
|
||||
|
|
|
@ -226,7 +226,8 @@ streamfx::version_info::operator std::string()
|
|||
}
|
||||
|
||||
void streamfx::updater::task(streamfx::util::threadpool_data_t)
|
||||
try {
|
||||
{
|
||||
try {
|
||||
auto query_fn = [this](std::vector<char>& buffer) {
|
||||
static constexpr std::string_view ST_API_URL =
|
||||
"https://api.github.com/repos/Xaymar/obs-StreamFX/releases?per_page=25&page=1";
|
||||
|
@ -342,7 +343,8 @@ try {
|
|||
|
||||
// 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("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",
|
||||
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());
|
||||
|
@ -353,10 +355,11 @@ try {
|
|||
|
||||
// Notify listeners of the update.
|
||||
events.refreshed.call(*this);
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
// Notify about the error.
|
||||
std::string message = ex.what();
|
||||
events.error.call(*this, message);
|
||||
}
|
||||
}
|
||||
|
||||
bool streamfx::updater::can_check()
|
||||
|
|
Loading…
Reference in a new issue