some corrections on windows
This commit is contained in:
@@ -19,44 +19,43 @@ Frei0rEffect::Frei0rEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
|
|||||||
// Windows DLL loading routine
|
// Windows DLL loading routine
|
||||||
QString dll_fn = QDir(em->path).filePath(em->filename);
|
QString dll_fn = QDir(em->path).filePath(em->filename);
|
||||||
|
|
||||||
handle = LibLoad(dll_fn);
|
handle = LibLoad(dll_fn);
|
||||||
if(handle == nullptr) {
|
if(handle == nullptr) {
|
||||||
QString dll_error;
|
QString dll_error;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD dll_err = GetLastError();
|
DWORD dll_err = GetLastError();
|
||||||
dll_error = QString::number(dll_err);
|
dll_error = QString::number(dll_err);
|
||||||
qCritical() << "Failed to load Frei0r plugin" << dll_fn_w << "-" << dll_err;
|
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
dll_error = dlerror();
|
dll_error = dlerror();
|
||||||
qCritical() << "Failed to load Frei0r plugin" << dll_fn << "-" << dll_error;
|
|
||||||
#endif
|
#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
|
#ifdef _WIN32
|
||||||
if (dll_err == 193) {
|
if (dll_err == 193) {
|
||||||
#ifdef _WIN64
|
#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
|
#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
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QMessageBox::critical(nullptr, tr("Error loading Frei0r plugin"), msg_err);
|
QMessageBox::critical(nullptr, tr("Error loading Frei0r plugin"), msg_err);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f0rInitFunc init = reinterpret_cast<f0rInitFunc>(LibAddress(handle, "f0r_init"));
|
f0rInitFunc init = reinterpret_cast<f0rInitFunc>(LibAddress(handle, "f0r_init"));
|
||||||
init();
|
init();
|
||||||
|
|
||||||
f0rConstructFunc construct = reinterpret_cast<f0rConstructFunc>(LibAddress(handle, "f0r_construct"));
|
f0rConstructFunc construct = reinterpret_cast<f0rConstructFunc>(LibAddress(handle, "f0r_construct"));
|
||||||
instance = construct(1920, 1080);
|
instance = construct(1920, 1080);
|
||||||
|
|
||||||
f0r_plugin_info_t info;
|
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);
|
info_func(&info);
|
||||||
|
|
||||||
param_count = info.num_params;
|
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 Param Count:" << info.num_params;
|
||||||
qDebug() << "Frei0r Explanation:" << info.explanation;
|
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++) {
|
for (int i=0;i<param_count;i++) {
|
||||||
f0r_param_info_t param_info;
|
f0r_param_info_t param_info;
|
||||||
get_param_info(¶m_info, i);
|
get_param_info(¶m_info, i);
|
||||||
@@ -105,19 +104,19 @@ Frei0rEffect::Frei0rEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Frei0rEffect::~Frei0rEffect() {
|
Frei0rEffect::~Frei0rEffect() {
|
||||||
if (handle != nullptr) {
|
if (handle != nullptr) {
|
||||||
f0rDestructFunc destruct = reinterpret_cast<f0rDestructFunc>(LibAddress(handle, "f0r_destruct"));
|
f0rDestructFunc destruct = reinterpret_cast<f0rDestructFunc>(LibAddress(handle, "f0r_destruct"));
|
||||||
destruct(instance);
|
destruct(instance);
|
||||||
|
|
||||||
f0rDeinitFunc deinit = reinterpret_cast<f0rDeinitFunc>(LibAddress(handle, "f0r_deinit"));
|
f0rDeinitFunc deinit = reinterpret_cast<f0rDeinitFunc>(LibAddress(handle, "f0r_deinit"));
|
||||||
deinit();
|
deinit();
|
||||||
|
|
||||||
LibClose(handle);
|
LibClose(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Frei0rEffect::process_image(double timecode, uint8_t *input, uint8_t *output, int) {
|
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++) {
|
for (int i=0;i<param_count;i++) {
|
||||||
EffectRow* param_row = row(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;
|
f0r_param_info_t param_info;
|
||||||
get_param_info(¶m_info, i);
|
get_param_info(¶m_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) {
|
switch (param_info.type) {
|
||||||
case F0R_PARAM_BOOL:
|
case F0R_PARAM_BOOL:
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,24 +2,24 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
void *LibLoad(const QString &filename) {
|
ModulePtr LibLoad(const QString &filename) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
LPCWSTR dll_fn_w = reinterpret_cast<const wchar_t*>(filename.utf16());
|
LPCWSTR dll_fn_w = reinterpret_cast<const wchar_t*>(filename.utf16());
|
||||||
return LoadLibrary(dll_fn_w);
|
return LoadLibrary(dll_fn_w);
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
return dlopen(filename.toUtf8(), RTLD_LAZY);
|
return dlopen(filename.toUtf8(), RTLD_LAZY);
|
||||||
#else
|
#else
|
||||||
qWarning() << "Olive doesn't know how to open dynamic libraries on this platform, external libraries will not be functional";
|
qWarning() << "Olive doesn't know how to open dynamic libraries on this platform, external libraries will not be functional";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList LibFilter() {
|
QStringList LibFilter() {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return QStringList("*.dll");
|
return QStringList("*.dll");
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
return QStringList("*.so");
|
return QStringList("*.so");
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
return QStringList("*.dylib");
|
return QStringList("*.dylib");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,15 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#define LibAddress GetProcAddress
|
#define LibAddress GetProcAddress
|
||||||
#define CloseLib FreeModule
|
#define LibClose FreeModule
|
||||||
#define ModulePtr HMODULE
|
#define ModulePtr HMODULE
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#define LibAddress dlsym
|
#define LibAddress dlsym
|
||||||
#define LibClose dlclose
|
#define LibClose dlclose
|
||||||
#define ModulePtr void*
|
#define ModulePtr void*
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ModulePtr LibLoad(const QString& filename);
|
ModulePtr LibLoad(const QString& filename);
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
|
|||||||
|
|
||||||
for (int i=0;i<c->effects.size();i++) {
|
for (int i=0;i<c->effects.size();i++) {
|
||||||
Effect* e = c->effects.at(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]) {
|
if (data_buffer_1 == target_frame->data[0]) {
|
||||||
frame_size = target_frame->linesize[0]*target_frame->height;
|
frame_size = target_frame->linesize[0]*target_frame->height;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user