use QLibrary to load external libs instead of direct OS calls
This commit is contained in:
@@ -46,8 +46,10 @@ Frei0rEffect::Frei0rEffect(Clip* c, const EffectMeta *em) :
|
||||
// Windows DLL loading routine
|
||||
QString dll_fn = QDir(em->path).filePath(em->filename);
|
||||
|
||||
handle = LibLoad(dll_fn);
|
||||
if(handle == nullptr) {
|
||||
handle.setFileName(dll_fn);
|
||||
|
||||
|
||||
if (!handle.load()) {
|
||||
QString dll_error;
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -75,18 +77,18 @@ Frei0rEffect::Frei0rEffect(Clip* c, const EffectMeta *em) :
|
||||
return;
|
||||
}
|
||||
|
||||
f0rInitFunc init = reinterpret_cast<f0rInitFunc>(LibAddress(handle, "f0r_init"));
|
||||
f0rInitFunc init = reinterpret_cast<f0rInitFunc>(handle.resolve("f0r_init"));
|
||||
init();
|
||||
|
||||
construct_module();
|
||||
|
||||
f0r_plugin_info_t info;
|
||||
f0rGetPluginInfo info_func = reinterpret_cast<f0rGetPluginInfo>(LibAddress(handle, "f0r_get_plugin_info"));
|
||||
f0rGetPluginInfo info_func = reinterpret_cast<f0rGetPluginInfo>(handle.resolve("f0r_get_plugin_info"));
|
||||
info_func(&info);
|
||||
|
||||
param_count = info.num_params;
|
||||
|
||||
get_param_info = reinterpret_cast<f0rGetParamInfo>(LibAddress(handle, "f0r_get_param_info"));
|
||||
get_param_info = reinterpret_cast<f0rGetParamInfo>(handle.resolve("f0r_get_param_info"));
|
||||
for (int i=0;i<param_count;i++) {
|
||||
f0r_param_info_t param_info;
|
||||
get_param_info(¶m_info, i);
|
||||
@@ -126,16 +128,16 @@ Frei0rEffect::Frei0rEffect(Clip* c, const EffectMeta *em) :
|
||||
}
|
||||
|
||||
Frei0rEffect::~Frei0rEffect() {
|
||||
if (handle != nullptr) {
|
||||
f0rDeinitFunc deinit = reinterpret_cast<f0rDeinitFunc>(LibAddress(handle, "f0r_deinit"));
|
||||
if (handle.isLoaded()) {
|
||||
f0rDeinitFunc deinit = reinterpret_cast<f0rDeinitFunc>(handle.resolve("f0r_deinit"));
|
||||
deinit();
|
||||
|
||||
LibClose(handle);
|
||||
handle.unload();
|
||||
}
|
||||
}
|
||||
|
||||
void Frei0rEffect::process_image(double timecode, uint8_t *input, uint8_t *output, int) {
|
||||
f0rUpdateFunc update_func = reinterpret_cast<f0rUpdateFunc>(LibAddress(handle, "f0r_update"));
|
||||
f0rUpdateFunc update_func = reinterpret_cast<f0rUpdateFunc>(handle.resolve("f0r_update"));
|
||||
|
||||
for (int i=0;i<param_count;i++) {
|
||||
EffectRow* param_row = row(i);
|
||||
@@ -143,7 +145,7 @@ void Frei0rEffect::process_image(double timecode, uint8_t *input, uint8_t *outpu
|
||||
f0r_param_info_t param_info;
|
||||
get_param_info(¶m_info, i);
|
||||
|
||||
f0rSetParamValue set_param = reinterpret_cast<f0rSetParamValue>(LibAddress(handle, "f0r_set_param_value"));
|
||||
f0rSetParamValue set_param = reinterpret_cast<f0rSetParamValue>(handle.resolve("f0r_set_param_value"));
|
||||
switch (param_info.type) {
|
||||
case F0R_PARAM_BOOL:
|
||||
{
|
||||
@@ -197,7 +199,7 @@ void Frei0rEffect::refresh() {
|
||||
|
||||
void Frei0rEffect::destruct_module() {
|
||||
if (open) {
|
||||
f0rDestructFunc destruct = reinterpret_cast<f0rDestructFunc>(LibAddress(handle, "f0r_destruct"));
|
||||
f0rDestructFunc destruct = reinterpret_cast<f0rDestructFunc>(handle.resolve("f0r_destruct"));
|
||||
destruct(instance);
|
||||
|
||||
open = false;
|
||||
@@ -205,7 +207,7 @@ void Frei0rEffect::destruct_module() {
|
||||
}
|
||||
|
||||
void Frei0rEffect::construct_module() {
|
||||
f0rConstructFunc construct = reinterpret_cast<f0rConstructFunc>(LibAddress(handle, "f0r_construct"));
|
||||
f0rConstructFunc construct = reinterpret_cast<f0rConstructFunc>(handle.resolve("f0r_construct"));
|
||||
instance = construct(parent_clip->media_width(), parent_clip->media_height());
|
||||
|
||||
open = true;
|
||||
|
||||
Reference in New Issue
Block a user