some corrections on windows

This commit is contained in:
itsmattkc
2019-01-20 23:11:19 +11:00
parent 3882288238
commit 6d49f598a3
4 changed files with 39 additions and 40 deletions
+21 -22
View File
@@ -19,44 +19,43 @@ Frei0rEffect::Frei0rEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
// Windows DLL loading routine
QString dll_fn = QDir(em->path).filePath(em->filename);
handle = LibLoad(dll_fn);
if(handle == nullptr) {
QString dll_error;
handle = LibLoad(dll_fn);
if(handle == nullptr) {
QString dll_error;
#ifdef _WIN32
DWORD dll_err = GetLastError();
dll_error = QString::number(dll_err);
qCritical() << "Failed to load Frei0r plugin" << dll_fn_w << "-" << dll_err;
dll_error = QString::number(dll_err);
#elif __linux__
dll_error = dlerror();
qCritical() << "Failed to load Frei0r plugin" << dll_fn << "-" << dll_error;
dll_error = dlerror();
#endif
qCritical() << "Failed to load Frei0r plugin" << dll_fn << "-" << dll_error;
QString msg_err = tr("Failed to load Frei0r plugin \"%1\": %2").arg(dll_fn, dll_error);
QString msg_err = tr("Failed to load Frei0r plugin \"%1\": %2").arg(dll_fn, dll_error);
#ifdef _WIN32
if (dll_err == 193) {
#ifdef _WIN64
msg_err += "\n\n" + tr("NOTE: You can't load 32-bit Frei0r plugins into a 64-bit build of Olive. Please find a 64-bit version of this plugin or switch to a 32-bit build of Olive.");
msg_err += "\n\n" + tr("NOTE: You can't load 32-bit Frei0r plugins into a 64-bit build of Olive. Please find a 64-bit version of this plugin or switch to a 32-bit build of Olive.");
#elif _WIN32
msg_err += "\n\n" + tr("NOTE: You can't load 64-bit Frei0r plugins into a 32-bit build of Olive. Please find a 32-bit version of this plugin or switch to a 64-bit build of Olive.");
msg_err += "\n\n" + tr("NOTE: You can't load 64-bit Frei0r plugins into a 32-bit build of Olive. Please find a 32-bit version of this plugin or switch to a 64-bit build of Olive.");
#endif
}
#endif
QMessageBox::critical(nullptr, tr("Error loading Frei0r plugin"), msg_err);
QMessageBox::critical(nullptr, tr("Error loading Frei0r plugin"), msg_err);
return;
}
}
f0rInitFunc init = reinterpret_cast<f0rInitFunc>(LibAddress(handle, "f0r_init"));
f0rInitFunc init = reinterpret_cast<f0rInitFunc>(LibAddress(handle, "f0r_init"));
init();
f0rConstructFunc construct = reinterpret_cast<f0rConstructFunc>(LibAddress(handle, "f0r_construct"));
f0rConstructFunc construct = reinterpret_cast<f0rConstructFunc>(LibAddress(handle, "f0r_construct"));
instance = construct(1920, 1080);
f0r_plugin_info_t info;
f0rGetPluginInfo info_func = reinterpret_cast<f0rGetPluginInfo>(LibAddress(handle, "f0r_get_plugin_info"));
f0rGetPluginInfo info_func = reinterpret_cast<f0rGetPluginInfo>(LibAddress(handle, "f0r_get_plugin_info"));
info_func(&info);
param_count = info.num_params;
@@ -65,7 +64,7 @@ Frei0rEffect::Frei0rEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
qDebug() << "Frei0r Param Count:" << info.num_params;
qDebug() << "Frei0r Explanation:" << info.explanation;
get_param_info = reinterpret_cast<f0rGetParamInfo>(LibAddress(handle, "f0r_get_param_info"));
get_param_info = reinterpret_cast<f0rGetParamInfo>(LibAddress(handle, "f0r_get_param_info"));
for (int i=0;i<param_count;i++) {
f0r_param_info_t param_info;
get_param_info(&param_info, i);
@@ -105,19 +104,19 @@ Frei0rEffect::Frei0rEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
}
Frei0rEffect::~Frei0rEffect() {
if (handle != nullptr) {
f0rDestructFunc destruct = reinterpret_cast<f0rDestructFunc>(LibAddress(handle, "f0r_destruct"));
if (handle != nullptr) {
f0rDestructFunc destruct = reinterpret_cast<f0rDestructFunc>(LibAddress(handle, "f0r_destruct"));
destruct(instance);
f0rDeinitFunc deinit = reinterpret_cast<f0rDeinitFunc>(LibAddress(handle, "f0r_deinit"));
f0rDeinitFunc deinit = reinterpret_cast<f0rDeinitFunc>(LibAddress(handle, "f0r_deinit"));
deinit();
LibClose(handle);
LibClose(handle);
}
}
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>(LibAddress(handle, "f0r_update"));
for (int i=0;i<param_count;i++) {
EffectRow* param_row = row(i);
@@ -125,7 +124,7 @@ void Frei0rEffect::process_image(double timecode, uint8_t *input, uint8_t *outpu
f0r_param_info_t param_info;
get_param_info(&param_info, i);
f0rSetParamValue set_param = reinterpret_cast<f0rSetParamValue>(LibAddress(handle, "f0r_set_param_value"));
f0rSetParamValue set_param = reinterpret_cast<f0rSetParamValue>(LibAddress(handle, "f0r_set_param_value"));
switch (param_info.type) {
case F0R_PARAM_BOOL:
{
+9 -9
View File
@@ -2,24 +2,24 @@
#include <QDebug>
void *LibLoad(const QString &filename) {
ModulePtr LibLoad(const QString &filename) {
#ifdef _WIN32
LPCWSTR dll_fn_w = reinterpret_cast<const wchar_t*>(filename.utf16());
return LoadLibrary(dll_fn_w);
LPCWSTR dll_fn_w = reinterpret_cast<const wchar_t*>(filename.utf16());
return LoadLibrary(dll_fn_w);
#elif __linux__
return dlopen(filename.toUtf8(), RTLD_LAZY);
return dlopen(filename.toUtf8(), RTLD_LAZY);
#else
qWarning() << "Olive doesn't know how to open dynamic libraries on this platform, external libraries will not be functional";
return nullptr;
qWarning() << "Olive doesn't know how to open dynamic libraries on this platform, external libraries will not be functional";
return nullptr;
#endif
}
QStringList LibFilter() {
#ifdef _WIN32
return QStringList("*.dll");
return QStringList("*.dll");
#elif __linux__
return QStringList("*.so");
return QStringList("*.so");
#elif __APPLE__
return QStringList("*.dylib");
return QStringList("*.dylib");
#endif
}
+8 -8
View File
@@ -4,15 +4,15 @@
#include <QString>
#ifdef _WIN32
#include <Windows.h>
#define LibAddress GetProcAddress
#define CloseLib FreeModule
#define ModulePtr HMODULE
#include <Windows.h>
#define LibAddress GetProcAddress
#define LibClose FreeModule
#define ModulePtr HMODULE
#elif __linux__
#include <dlfcn.h>
#define LibAddress dlsym
#define LibClose dlclose
#define ModulePtr void*
#include <dlfcn.h>
#define LibAddress dlsym
#define LibClose dlclose
#define ModulePtr void*
#endif
ModulePtr LibLoad(const QString& filename);
+1 -1
View File
@@ -264,7 +264,7 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
for (int i=0;i<c->effects.size();i++) {
Effect* e = c->effects.at(i);
if (e->enable_image) {
if (e->enable_image && e->is_enabled()) {
if (data_buffer_1 == target_frame->data[0]) {
frame_size = target_frame->linesize[0]*target_frame->height;