Add OFX plugin support and related infrastructure
This commit extends the OFX plugin support in Olive by: - Initializing and scanning for OFX plugins - Updating PluginNode to handle OFX plugin parameters and inputs - Adding necessary methods and properties for OFX plugin integration - Enhancing NodeFactory to include OFX plugin nodes - Refactoring and renaming OliveInstance to OlivePluginInstance - Introducing new classes for parameter handling (ParamInstance) - Adding PluginJob for rendering OFX plugins - Adjusting CMakeLists.txt files to include new source files
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
target_sources(libolive-editor PRIVATE
|
||||
OliveHost.h
|
||||
OliveHost.cpp
|
||||
OliveInstance.h
|
||||
OliveInstance.cpp
|
||||
OlivePluginInstance.h
|
||||
OlivePluginInstance.cpp
|
||||
OliveClip.cpp
|
||||
OliveClip.h
|
||||
paraminstance.cpp
|
||||
paraminstance.h
|
||||
)
|
||||
@@ -26,22 +26,15 @@
|
||||
#include <QDir>
|
||||
#include "OliveHost.h"
|
||||
|
||||
#include "OliveInstance.h"
|
||||
#include "OlivePluginInstance.h"
|
||||
#include "common/Current.h"
|
||||
using namespace OFX::Host;
|
||||
using namespace olive::plugin;
|
||||
void loadPlugins(QString path)
|
||||
|
||||
void olive::plugin::loadPlugins(QString path)
|
||||
{
|
||||
QDir dir=(QCoreApplication::applicationDirPath()+path);
|
||||
QFileInfoList files=dir.entryInfoList();
|
||||
for (auto& file:files) {
|
||||
if (file.isDir()) {
|
||||
OFX::Binary binary(file.absoluteFilePath().toStdString());
|
||||
|
||||
}
|
||||
}
|
||||
OFX::Host::ImageEffect::PluginCache imageEffectPluginCache(myHost);
|
||||
}
|
||||
|
||||
OliveHost::~OliveHost()
|
||||
{
|
||||
for(auto& descriptor:descriptors_){
|
||||
@@ -82,7 +75,7 @@ OFX::Host::ImageEffect::Instance* OliveHost::newInstance(void* clientData,
|
||||
OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
|
||||
OFX::Host::ImageEffect::Descriptor& desc,
|
||||
const std::string& context){
|
||||
ImageEffect::Instance* instance=new OliveInstance(plugin,desc,context,Current::getInstance().interactive());
|
||||
ImageEffect::Instance* instance=new OlivePluginInstance(plugin,desc,context,Current::getInstance().interactive());
|
||||
instances_.append(instance);
|
||||
return instance;
|
||||
};
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef OLIVE_HOST_H
|
||||
#define OLIVE_HOST_H
|
||||
#include "ofxhHost.h"
|
||||
#include "ofxhImageEffectAPI.h"
|
||||
#include "ofxCore.h"
|
||||
@@ -66,4 +68,5 @@ private:
|
||||
QList<OFX::Host::ImageEffect::Instance*> instances_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "OliveInstance.h"
|
||||
#include "OlivePluginInstance.h"
|
||||
|
||||
#include "OliveClip.h"
|
||||
#include "ofxCore.h"
|
||||
@@ -28,11 +28,12 @@
|
||||
#include <qobject.h>
|
||||
#include <string.h>
|
||||
#include <QString>
|
||||
#include "paraminstance.h"
|
||||
namespace olive
|
||||
{
|
||||
namespace plugin
|
||||
{
|
||||
OfxStatus OliveInstance::vmessage(const char *type, const char *id,
|
||||
OfxStatus OlivePluginInstance::vmessage(const char *type, const char *id,
|
||||
const char *format, va_list args)
|
||||
{
|
||||
char *buffer = new char[1024];
|
||||
@@ -59,7 +60,7 @@ OfxStatus OliveInstance::vmessage(const char *type, const char *id,
|
||||
return kOfxStatOK;
|
||||
}
|
||||
}
|
||||
OfxStatus OliveInstance::setPersistentMessage(const char *type, const char *id,
|
||||
OfxStatus OlivePluginInstance::setPersistentMessage(const char *type, const char *id,
|
||||
const char *format, va_list args)
|
||||
{
|
||||
char *buffer = new char[1024];
|
||||
@@ -95,66 +96,66 @@ OfxStatus OliveInstance::setPersistentMessage(const char *type, const char *id,
|
||||
}
|
||||
return kOfxStatOK;
|
||||
}
|
||||
OfxStatus OliveInstance::clearPersistentMessage()
|
||||
OfxStatus OlivePluginInstance::clearPersistentMessage()
|
||||
{
|
||||
persistentErrors_.clear();
|
||||
// TODO: tell the shell to remove message.
|
||||
return kOfxStatOK;
|
||||
}
|
||||
void OliveInstance::getProjectSize(double &xSize, double &ySize) const
|
||||
void OlivePluginInstance::getProjectSize(double &xSize, double &ySize) const
|
||||
{
|
||||
xSize =params_.width();
|
||||
ySize =params_.height();
|
||||
}
|
||||
void OliveInstance::getProjectOffset(double &xOffset, double &yOffset) const
|
||||
void OlivePluginInstance::getProjectOffset(double &xOffset, double &yOffset) const
|
||||
{
|
||||
xOffset =params_.x();
|
||||
yOffset =params_.y();
|
||||
}
|
||||
void OliveInstance::getProjectExtent(double &xSize, double &ySize) const
|
||||
void OlivePluginInstance::getProjectExtent(double &xSize, double &ySize) const
|
||||
{
|
||||
xSize =params_.width();
|
||||
ySize =params_.height();
|
||||
// TODO: Ensure this project does not support this.
|
||||
}
|
||||
double OliveInstance::getProjectPixelAspectRatio() const
|
||||
double OlivePluginInstance::getProjectPixelAspectRatio() const
|
||||
{
|
||||
return Current::getInstance()
|
||||
.currentVideoParams()
|
||||
.pixel_aspect_ratio()
|
||||
.toDouble();
|
||||
}
|
||||
double OliveInstance::getFrameRate() const
|
||||
double OlivePluginInstance::getFrameRate() const
|
||||
{
|
||||
return params_.frame_rate().toDouble();
|
||||
}
|
||||
|
||||
double OliveInstance::getEffectDuration() const
|
||||
double OlivePluginInstance::getEffectDuration() const
|
||||
{
|
||||
// Return a default duration value
|
||||
return 100.0;
|
||||
}
|
||||
|
||||
double OliveInstance::getFrameRecursive() const
|
||||
double OlivePluginInstance::getFrameRecursive() const
|
||||
{
|
||||
// Return current frame (this would typically be set by the host during rendering)
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void OliveInstance::getRenderScaleRecursive(double &x, double &y) const
|
||||
void OlivePluginInstance::getRenderScaleRecursive(double &x, double &y) const
|
||||
{
|
||||
// Return default render scale (1.0, 1.0)
|
||||
x = 1.0;
|
||||
y = 1.0;
|
||||
}
|
||||
OFX::Host::Param::Instance *
|
||||
OliveInstance::newParam(const std::string &name,
|
||||
OlivePluginInstance::newParam(const std::string &name,
|
||||
OFX::Host::Param::Descriptor &Descriptor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
OFX::Host::ImageEffect::ClipInstance *OliveInstance::newClipInstance(
|
||||
OFX::Host::ImageEffect::ClipInstance *OlivePluginInstance::newClipInstance(
|
||||
OFX::Host::ImageEffect::Instance *plugin,
|
||||
OFX::Host::ImageEffect::ClipDescriptor *descriptor,
|
||||
int index)
|
||||
@@ -15,7 +15,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OLIVE_INSTANCE_H
|
||||
#define OLIVE_INSTANCE_H
|
||||
#include "ofxCore.h"
|
||||
#include "ofxImageEffect.h"
|
||||
#include <QString>
|
||||
@@ -36,9 +37,9 @@ struct PersistentErrors{
|
||||
ErrorType type;
|
||||
QString message;
|
||||
};
|
||||
class OliveInstance : public OFX::Host::ImageEffect::Instance {
|
||||
class OlivePluginInstance : public OFX::Host::ImageEffect::Instance {
|
||||
public:
|
||||
OliveInstance(
|
||||
OlivePluginInstance(
|
||||
OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
|
||||
OFX::Host::ImageEffect::Descriptor& desc,
|
||||
const std::string& context,
|
||||
@@ -46,7 +47,7 @@ public:
|
||||
: OFX::Host::ImageEffect::Instance(plugin, desc, context, interactive)
|
||||
{
|
||||
}
|
||||
~OliveInstance() override = default;
|
||||
~OlivePluginInstance() override = default;
|
||||
const std::string &getDefaultOutputFielding() const{
|
||||
return kOfxImageFieldNone;
|
||||
};
|
||||
@@ -151,4 +152,5 @@ private:
|
||||
VideoParams params_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Olive Community Edition - Non-Linear Video Editor
|
||||
* Copyright (C) 2025 Olive CE Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "paraminstance.h"
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Olive Community Edition - Non-Linear Video Editor
|
||||
* Copyright (C) 2025 Olive CE Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Copyright OpenFX and contributors to the OpenFX project.
|
||||
#ifndef PARAM_INSTANCE_H
|
||||
#define PARAM_INSTANCE_H
|
||||
|
||||
#include "OlivePluginInstance.h"
|
||||
#include "ofxhParam.h"
|
||||
namespace olive
|
||||
{
|
||||
namespace plugin
|
||||
{
|
||||
class PushbuttonInstance : public OFX::Host::Param::PushbuttonInstance {
|
||||
protected:
|
||||
OlivePluginInstance* _effect;
|
||||
OFX::Host::Param::Descriptor *_descriptor;
|
||||
public:
|
||||
PushbuttonInstance(OlivePluginInstance *effect, const std::string &name,
|
||||
OFX::Host::Param::Descriptor &descriptor)
|
||||
: OFX::Host::Param::PushbuttonInstance( descriptor)
|
||||
{
|
||||
_descriptor = &descriptor;
|
||||
};
|
||||
};
|
||||
|
||||
class IntegerInstance : public OFX::Host::Param::IntegerInstance {
|
||||
protected:
|
||||
OlivePluginInstance* _effect;
|
||||
OFX::Host::Param::Descriptor& _descriptor;
|
||||
public:
|
||||
IntegerInstance(OlivePluginInstance* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||
OfxStatus get(int&);
|
||||
OfxStatus get(OfxTime time, int&);
|
||||
OfxStatus set(int);
|
||||
OfxStatus set(OfxTime time, int);
|
||||
};
|
||||
|
||||
class DoubleInstance : public OFX::Host::Param::DoubleInstance {
|
||||
protected:
|
||||
OlivePluginInstance* _effect;
|
||||
OFX::Host::Param::Descriptor& _descriptor;
|
||||
public:
|
||||
DoubleInstance(OlivePluginInstance* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||
OfxStatus get(double&);
|
||||
OfxStatus get(OfxTime time, double&);
|
||||
OfxStatus set(double);
|
||||
OfxStatus set(OfxTime time, double);
|
||||
OfxStatus derive(OfxTime time, double&);
|
||||
OfxStatus integrate(OfxTime time1, OfxTime time2, double&);
|
||||
};
|
||||
|
||||
class BooleanInstance : public OFX::Host::Param::BooleanInstance {
|
||||
protected:
|
||||
OlivePluginInstance* _effect;
|
||||
OFX::Host::Param::Descriptor& _descriptor;
|
||||
public:
|
||||
BooleanInstance(OlivePluginInstance* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||
OfxStatus get(bool&);
|
||||
OfxStatus get(OfxTime time, bool&);
|
||||
OfxStatus set(bool);
|
||||
OfxStatus set(OfxTime time, bool);
|
||||
};
|
||||
|
||||
class ChoiceInstance : public OFX::Host::Param::ChoiceInstance {
|
||||
protected:
|
||||
OlivePluginInstance* _effect;
|
||||
OFX::Host::Param::Descriptor& _descriptor;
|
||||
public:
|
||||
ChoiceInstance(OlivePluginInstance* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||
OfxStatus get(int&);
|
||||
OfxStatus get(OfxTime time, int&);
|
||||
OfxStatus set(int);
|
||||
OfxStatus set(OfxTime time, int);
|
||||
};
|
||||
|
||||
class RGBAInstance : public OFX::Host::Param::RGBAInstance {
|
||||
protected:
|
||||
OlivePluginInstance* _effect;
|
||||
OFX::Host::Param::Descriptor& _descriptor;
|
||||
public:
|
||||
RGBAInstance(OlivePluginInstance* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||
OfxStatus get(double&,double&,double&,double&);
|
||||
OfxStatus get(OfxTime time, double&,double&,double&,double&);
|
||||
OfxStatus set(double,double,double,double);
|
||||
OfxStatus set(OfxTime time, double,double,double,double);
|
||||
};
|
||||
|
||||
|
||||
class RGBInstance : public OFX::Host::Param::RGBInstance {
|
||||
protected:
|
||||
OlivePluginInstance* _effect;
|
||||
OFX::Host::Param::Descriptor& _descriptor;
|
||||
public:
|
||||
RGBInstance(OlivePluginInstance* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||
OfxStatus get(double&,double&,double&);
|
||||
OfxStatus get(OfxTime time, double&,double&,double&);
|
||||
OfxStatus set(double,double,double);
|
||||
OfxStatus set(OfxTime time, double,double,double);
|
||||
};
|
||||
|
||||
class Double2DInstance : public OFX::Host::Param::Double2DInstance {
|
||||
protected:
|
||||
OlivePluginInstance* _effect;
|
||||
OFX::Host::Param::Descriptor& _descriptor;
|
||||
public:
|
||||
Double2DInstance(OlivePluginInstance* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||
OfxStatus get(double&,double&);
|
||||
OfxStatus get(OfxTime time,double&,double&);
|
||||
OfxStatus set(double,double);
|
||||
OfxStatus set(OfxTime time,double,double);
|
||||
};
|
||||
|
||||
class Integer2DInstance : public OFX::Host::Param::Integer2DInstance {
|
||||
protected:
|
||||
OlivePluginInstance* _effect;
|
||||
OFX::Host::Param::Descriptor& _descriptor;
|
||||
public:
|
||||
Integer2DInstance(OlivePluginInstance* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||
OfxStatus get(int&,int&);
|
||||
OfxStatus get(OfxTime time,int&,int&);
|
||||
OfxStatus set(int,int);
|
||||
OfxStatus set(OfxTime time,int,int);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // HOST_DEMO_PARAM_INSTANCE_H
|
||||
|
||||
|
||||
#endif //PARAMINSTANCE_H
|
||||
Reference in New Issue
Block a user