feat: Implement OFX plugin support infrastructure

This commit adds comprehensive support for OFX plugins in Olive, including:

- Add plugin node infrastructure with getPlugin() method
- Implement OliveHost for managing OFX plugin instances
- Create OliveInstance to handle plugin parameter and timeline interactions
- Add OliveClip implementation for plugin clip handling
- Implement region of definition (RoD) and region of interest (RoI) functionality
- Add interactive mode support in Current class
- Integrate plugin rendering into RenderProcessor
- Fix include dependencies and remove unused OlivePlugin.cpp reference
This commit is contained in:
2025-10-25 17:59:50 +08:00
parent 81b2640411
commit 26e6924cdf
9 changed files with 210 additions and 4 deletions
+23
View File
@@ -118,5 +118,28 @@ OFX::Host::ImageEffect::Image *
olive::plugin::OliveClipInstance::getImage(OfxTime time,
const OfxRectD *optionalBounds)
{
return &image_;
}
OfxRectD
olive::plugin::OliveClipInstance::getRegionOfDefinition(OfxTime time) const
{
if (regionOfDefinitions_.contains(time)) {
return regionOfDefinitions_[time];
}
OfxRectD regionOfDefinition;
regionOfDefinition.x1=regionOfDefinition.y1=0;
regionOfDefinition.x2=params_.width();
regionOfDefinition.y2=params_.height();
return regionOfDefinition;
}
void olive::plugin::OliveClipInstance::setRegionOfDefinition(
OfxRectD regionOfDefinition, OfxTime time)
{
regionOfDefinitions_[time] = regionOfDefinition;
}
void olive::plugin::OliveClipInstance::setDefaultRegionOfDefinition(
OfxRectD regionOfDefinition)
{
defaultRegionOfDefinitions_ = regionOfDefinition;
}
+19 -1
View File
@@ -25,6 +25,8 @@
#define OLIVECLIP_H
#include "ofxhClip.h"
#include "render/videoparams.h"
#include <QMap>
namespace olive
{
namespace plugin
@@ -37,6 +39,11 @@ public:
{
params_ = params;
}
OFX::Host::ImageEffect::Image& getOutputImage()
{
return image_;
}
const std::string &getUnmappedBitDepth() const override;
const std::string &getUnmappedComponents() const override;
const std::string &getPremult() const override;
@@ -50,10 +57,21 @@ public:
bool getContinuousSamples() const override;
OFX::Host::ImageEffect::Image* getImage(OfxTime time, const OfxRectD *optionalBounds) override;
OfxRectD getRegionOfDefinition(OfxTime time) const override;
const std::string &findSupportedComp(const std::string &s) const override;
void setRegionOfDefinition(OfxRectD regionOfDefinition, OfxTime time);
void olive::plugin::OliveClipInstance::setDefaultRegionOfDefinition(
OfxRectD regionOfDefinition);
# ifdef OFX_SUPPORTS_OPENGLRENDER
OFX::Host::ImageEffect::Texture* loadTexture(OfxTime time, const char *format, const OfxRectD *optionalBounds) { return NULL; };
# endif
private:
VideoParams params_;
QMap<OfxTime, OfxRectD> regionOfDefinitions_;
OfxRectD defaultRegionOfDefinitions_;
OFX::Host::ImageEffect::Image image_;
};
}
}
+4 -1
View File
@@ -25,6 +25,9 @@
#include <QApplication>
#include <QDir>
#include "OliveHost.h"
#include "OliveInstance.h"
#include "common/Current.h"
using namespace OFX::Host;
using namespace olive::plugin;
void loadPlugins(QString path)
@@ -79,7 +82,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 ImageEffect::Instance(clientData,plugin,desc,context);
ImageEffect::Instance* instance=new OliveInstance(plugin,desc,context,Current::getInstance().interactive());
instances_.append(instance);
return instance;
};
+6
View File
@@ -147,6 +147,12 @@ void OliveInstance::getRenderScaleRecursive(double &x, double &y) const
x = 1.0;
y = 1.0;
}
OFX::Host::Param::Instance *
OliveInstance::newParam(const std::string &name,
OFX::Host::Param::Descriptor &Descriptor)
{
}
OFX::Host::ImageEffect::ClipInstance *OliveInstance::newClipInstance(
OFX::Host::ImageEffect::Instance *plugin,
+59 -1
View File
@@ -20,6 +20,8 @@
#include "ofxImageEffect.h"
#include <QString>
#include "ofxhImageEffect.h"
#include "render/videoparams.h"
#include <map>
#include <qcontainerfwd.h>
#include <qlist.h>
@@ -49,6 +51,10 @@ public:
return kOfxImageFieldNone;
};
void setVideoParam(VideoParams params)
{
this->params_=params;
}
OFX::Host::ImageEffect::ClipInstance *newClipInstance(
OFX::Host::ImageEffect::Instance *plugin,
OFX::Host::ImageEffect::ClipDescriptor *descriptor,
@@ -88,9 +94,61 @@ public:
/// renderScale
void getRenderScaleRecursive(double &x, double &y) const override;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// overridden for Param::SetInstance
/// make a parameter instance
///
/// Client host code needs to implement this
virtual OFX::Host::Param::Instance* newParam(const std::string& name, OFX::Host::Param::Descriptor& Descriptor);
/// Triggered when the plug-in calls OfxParameterSuiteV1::paramEditBegin
///
/// Client host code needs to implement this
virtual OfxStatus editBegin(const std::string& name);
/// Triggered when the plug-in calls OfxParameterSuiteV1::paramEditEnd
///
/// Client host code needs to implement this
virtual OfxStatus editEnd();
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// overridden for Progress::ProgressI
/// Start doing progress.
virtual void progressStart(const std::string &message, const std::string &messageid);
/// finish yer progress
virtual void progressEnd();
/// set the progress to some level of completion, returns
/// false if you should abandon processing, true to continue
virtual bool progressUpdate(double t);
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// overridden for TimeLine::TimeLineI
/// get the current time on the timeline. This is not necessarily the same
/// time as being passed to an action (eg render)
virtual double timeLineGetTime();
/// set the timeline to a specific time
virtual void timeLineGotoTime(double t);
/// get the first and last times available on the effect's timeline
virtual void timeLineGetBounds(double &t1, double &t2);
private:
QList<PersistentErrors> persistentErrors_;
VideoParams params_;
};
}
}