windows frei0r support done

This commit is contained in:
itsmattkc
2019-01-20 21:06:21 +11:00
parent 80b77a382b
commit d5eab3673c
15 changed files with 305 additions and 136 deletions
+58 -6
View File
@@ -11,6 +11,9 @@
#include <QDebug>
#include <frei0r/frei0r.h>
typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info);
void load_internal_effects() {
if (!shaders_are_enabled) qWarning() << "Shaders are disabled, some effects may be nonfunctional";
@@ -48,12 +51,6 @@ void load_internal_effects() {
em.subtype = EFFECT_TYPE_VIDEO;
// TEMPORARY begin
em.name = "Frei0r Plugin";
em.internal = EFFECT_INTERNAL_FREI0R;
effects.append(em);
// TEMPORARY end
em.name = "Transform";
em.category = "Distort";
em.internal = EFFECT_INTERNAL_TRANSFORM;
@@ -165,6 +162,60 @@ void init_effects() {
init_thread->start();
}
void load_frei0r_effects() {
QList<QString> effect_dirs = get_effects_paths();
int lim = effect_dirs.size();
// add extra search paths for frei0r effects
for (int i=0;i<lim;i++) {
effect_dirs.append(QDir(effect_dirs.at(i)).filePath("frei0r"));
}
// add defined paths for frei0r plugins on unix
#if defined(__APPLE__) || defined(__linux__)
#endif
// search for paths
EffectMeta em;
em.category = "Frei0r";
em.type = EFFECT_TYPE_EFFECT;
em.subtype = EFFECT_TYPE_VIDEO;
em.internal = EFFECT_INTERNAL_FREI0R;
for (int i=0;i<effect_dirs.size();i++) {
QDir search_dir(effect_dirs.at(i));
if (search_dir.exists()) {
QList<QString> entry_list = search_dir.entryList(QStringList("*.dll"));
for (int j=0;j<entry_list.size();j++) {
HMODULE effect = LoadLibrary(reinterpret_cast<const wchar_t*>(search_dir.filePath(entry_list.at(j)).utf16()));
if (effect != nullptr) {
f0rGetPluginInfo get_info_func = reinterpret_cast<f0rGetPluginInfo>(GetProcAddress(effect, "f0r_get_plugin_info"));
if (get_info_func != nullptr) {
f0r_plugin_info_t info;
get_info_func(&info);
if (info.plugin_type == F0R_PLUGIN_TYPE_FILTER
&& info.color_model == F0R_COLOR_MODEL_RGBA8888) {
em.name = info.name;
em.path = effect_dirs.at(i);
em.filename = entry_list.at(j);
effects.append(em);
}
// qDebug() << "Found:" << info.name << "by" << info.author;
}
FreeLibrary(effect);
}
// qDebug() << search_dir.filePath(entry_list.at(j));
}
}
}
}
EffectInit::EffectInit() {
panel_effect_controls->effects_loaded.lock();
}
@@ -173,6 +224,7 @@ void EffectInit::run() {
qInfo() << "Initializing effects...";
load_internal_effects();
load_shader_effects();
load_frei0r_effects();
panel_effect_controls->effects_loaded.unlock();
qInfo() << "Finished initializing effects";
}