mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-27 22:03:01 +00:00
gfx-effect-source: Catch exceptions as const
This commit is contained in:
parent
e832dbd628
commit
03c2a68846
3 changed files with 33 additions and 31 deletions
|
@ -67,7 +67,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
_source_info.create = [](obs_data_t* data, obs_source_t* self) {
|
||||
try {
|
||||
return static_cast<void*>(new filter::shader::shader_instance(data, self));
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to create source, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to create source.");
|
||||
|
@ -77,7 +77,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
_source_info.destroy = [](void* ptr) {
|
||||
try {
|
||||
delete reinterpret_cast<filter::shader::shader_instance*>(ptr);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to delete source, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to delete source.");
|
||||
|
@ -88,7 +88,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<filter::shader::shader_instance*>(ptr)->properties(pr);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to retrieve options, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to retrieve options.");
|
||||
|
@ -99,7 +99,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
return reinterpret_cast<filter::shader::shader_instance*>(ptr)->width();
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to retrieve width, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to retrieve width.");
|
||||
|
@ -110,7 +110,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
return reinterpret_cast<filter::shader::shader_instance*>(ptr)->height();
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to retrieve height, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to retrieve height.");
|
||||
|
@ -121,7 +121,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<filter::shader::shader_instance*>(ptr)->load(data);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to load, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to load.");
|
||||
|
@ -131,7 +131,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<filter::shader::shader_instance*>(ptr)->update(data);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to update, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to update.");
|
||||
|
@ -141,7 +141,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<filter::shader::shader_instance*>(ptr)->activate();
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to activate, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to activate.");
|
||||
|
@ -151,7 +151,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<filter::shader::shader_instance*>(ptr)->deactivate();
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to deactivate, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to deactivate.");
|
||||
|
@ -161,7 +161,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<filter::shader::shader_instance*>(ptr)->video_tick(time);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to tick, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to tick.");
|
||||
|
@ -171,7 +171,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<filter::shader::shader_instance*>(ptr)->video_render(effect);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to render, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to render.");
|
||||
|
@ -181,7 +181,7 @@ filter::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<filter::shader::shader_instance*>(ptr)->enum_active_sources(enum_callback, param);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to enumerate sources, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<filter-shader> Failed to enumerate sources.");
|
||||
|
@ -223,6 +223,8 @@ bool modifiedcb3(obs_properties_t* props, obs_property_t* property, obs_data_t*
|
|||
obs_property_set_visible(obs_properties_get(props, ST_SCALE_WIDTH), !obs_data_get_bool(settings, ST_SCALE_LOCKED));
|
||||
obs_property_set_visible(obs_properties_get(props, ST_SCALE_HEIGHT), !obs_data_get_bool(settings, ST_SCALE_LOCKED));
|
||||
return true;
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
return false;
|
||||
|
|
|
@ -873,7 +873,7 @@ void gfx::effect_source::texture_parameter::update(obs_data_t* data)
|
|||
_source_renderer = std::make_shared<gfx::source_texture>(_source, _parent.lock()->get_self());
|
||||
}
|
||||
}
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("Update failed, error: %s", ex.what());
|
||||
}
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ void gfx::effect_source::texture_parameter::tick(float_t time)
|
|||
if (changed) {
|
||||
try {
|
||||
load_texture(_file_name);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("Loading texture \"%s\" failed, error: %s", _file_name.c_str(), ex.what());
|
||||
}
|
||||
}
|
||||
|
@ -941,7 +941,7 @@ bool gfx::effect_source::effect_source::modified2(obs_properties_t* props, obs_p
|
|||
try {
|
||||
const char* str = obs_data_get_string(settings, ST_FILE);
|
||||
load_file(str ? str : "");
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<gfx::effect_source> Failed to load effect \"%s\" due to error: %s", _file.c_str(), ex.what());
|
||||
}
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ void gfx::effect_source::effect_source::update(obs_data_t* data)
|
|||
if (file != _file) {
|
||||
try {
|
||||
load_file(file);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<gfx::effect_source> Failed to load effect \"%s\" due to error: %s", _file.c_str(), ex.what());
|
||||
}
|
||||
}
|
||||
|
@ -1084,7 +1084,7 @@ bool gfx::effect_source::effect_source::tick(float_t time)
|
|||
if (changed) {
|
||||
try {
|
||||
load_file(_file);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("Loading shader \"%s\" failed, error: %s", _file.c_str(), ex.what());
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -63,7 +63,7 @@ source::shader::shader_factory::shader_factory()
|
|||
_source_info.create = [](obs_data_t* data, obs_source_t* self) {
|
||||
try {
|
||||
return static_cast<void*>(new source::shader::shader_instance(data, self));
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to create source, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to create source.");
|
||||
|
@ -73,7 +73,7 @@ source::shader::shader_factory::shader_factory()
|
|||
_source_info.destroy = [](void* ptr) {
|
||||
try {
|
||||
delete reinterpret_cast<source::shader::shader_instance*>(ptr);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to delete source, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to delete source.");
|
||||
|
@ -84,7 +84,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<source::shader::shader_instance*>(ptr)->properties(pr);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to retrieve options, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to retrieve options.");
|
||||
|
@ -95,7 +95,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
return reinterpret_cast<source::shader::shader_instance*>(ptr)->width();
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to retrieve width, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to retrieve width.");
|
||||
|
@ -106,7 +106,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
return reinterpret_cast<source::shader::shader_instance*>(ptr)->height();
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to retrieve height, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to retrieve height.");
|
||||
|
@ -117,7 +117,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<source::shader::shader_instance*>(ptr)->load(data);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to load, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to load.");
|
||||
|
@ -127,7 +127,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<source::shader::shader_instance*>(ptr)->update(data);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to update, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to update.");
|
||||
|
@ -137,7 +137,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<source::shader::shader_instance*>(ptr)->activate();
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to activate, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to activate.");
|
||||
|
@ -147,7 +147,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<source::shader::shader_instance*>(ptr)->deactivate();
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to deactivate, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to deactivate.");
|
||||
|
@ -157,7 +157,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<source::shader::shader_instance*>(ptr)->video_tick(time);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to tick, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to tick.");
|
||||
|
@ -167,7 +167,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<source::shader::shader_instance*>(ptr)->video_render(effect);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to render, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to render.");
|
||||
|
@ -177,7 +177,7 @@ source::shader::shader_factory::shader_factory()
|
|||
try {
|
||||
if (ptr)
|
||||
reinterpret_cast<source::shader::shader_instance*>(ptr)->enum_active_sources(enum_callback, param);
|
||||
} catch (std::exception& ex) {
|
||||
} catch (const std::exception& ex) {
|
||||
P_LOG_ERROR("<source-shader> Failed to enumerate sources, error: %s", ex.what());
|
||||
} catch (...) {
|
||||
P_LOG_ERROR("<source-shader> Failed to enumerate sources.");
|
||||
|
@ -228,8 +228,8 @@ void source::shader::shader_instance::load(obs_data_t* data)
|
|||
|
||||
void source::shader::shader_instance::update(obs_data_t* data)
|
||||
{
|
||||
_width = obs_data_get_int(data, ST_WIDTH);
|
||||
_height = obs_data_get_int(data, ST_HEIGHT);
|
||||
_width = static_cast<uint32_t>(obs_data_get_int(data, ST_WIDTH));
|
||||
_height = static_cast<uint32_t>(obs_data_get_int(data, ST_HEIGHT));
|
||||
|
||||
_fx->update(data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue