Implement default methods for plugin parameter editing and progress, and integrate plugin rendering into the build system.

This commit is contained in:
Mike Solar
2025-12-24 21:07:17 +08:00
parent 88ba0e4841
commit 7c0f37b0a7
10 changed files with 332 additions and 290 deletions
+8
View File
@@ -22,6 +22,7 @@
#include "node/block/clip/clip.h"
#include "render/job/footagejob.h"
#include "render/rendermanager.h"
#include "render/job/pluginjob.h"
namespace olive
{
@@ -381,6 +382,10 @@ TexturePtr NodeTraverser::ProcessVideoCacheJob(const CacheJob *val)
return nullptr;
}
TexturePtr NodeTraverser::ProcessPluginJob(plugin::PluginJob *job)
{
// TODO
}
QVector2D NodeTraverser::GenerateResolution() const
{
return QVector2D(video_params_.square_pixel_width(),
@@ -490,6 +495,9 @@ void NodeTraverser::ResolveJobs(NodeValue &val)
val.set_value(tex);
}
else if (plugin::PluginJob* plugin_job=dynamic_cast<plugin::PluginJob*>(base_job)) {
ProcessPluginJob(plugin_job);
}
// Cache resolved value
resolved_texture_cache_.insert(job_tex.get(),
+2
View File
@@ -30,6 +30,7 @@
#include "render/job/colortransformjob.h"
#include "render/job/footagejob.h"
#include "value.h"
#include "render/job/pluginjob.h"
namespace olive
{
@@ -143,6 +144,7 @@ protected:
return SampleBuffer();
}
virtual TexturePtr ProcessPluginJob(plugin::PluginJob *job);
SampleBuffer CreateSampleBuffer(const AudioParams &params,
const rational &length)
{
+13 -5
View File
@@ -126,12 +126,18 @@ public:
/// Triggered when the plug-in calls OfxParameterSuiteV1::paramEditBegin
///
/// Client host code needs to implement this
virtual OfxStatus editBegin(const std::string& name);
virtual OfxStatus editBegin(const std::string& name)
{
return kOfxStatOK;
};
/// Triggered when the plug-in calls OfxParameterSuiteV1::paramEditEnd
///
/// Client host code needs to implement this
virtual OfxStatus editEnd();
virtual OfxStatus editEnd()
{
return kOfxStatOK;
};
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@@ -141,14 +147,16 @@ public:
// overridden for Progress::ProgressI
/// Start doing progress.
virtual void progressStart(const std::string &message, const std::string &messageid);
virtual void progressStart(const std::string &message, const std::string &messageid)
{
};
/// finish yer progress
virtual void progressEnd();
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);
virtual bool progressUpdate(double t){return true;};
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -17,7 +17,7 @@
add_subdirectory(job)
add_subdirectory(ocioconf)
add_subdirectory(opengl)
add_subdirectory(plugin)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
render/audioplaybackcache.cpp
+7 -2
View File
@@ -397,12 +397,14 @@ struct TextureToBind {
Texture::Interpolation interpolation;
};
void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination,
void OpenGLRenderer::Blit(QVariant s, AcceleratedJob& a_job, Texture *destination,
VideoParams destination_params,
bool clear_destination)
{
GL_PREAMBLE;
try {
ShaderJob &s_job=dynamic_cast<ShaderJob &>(a_job);
ShaderJob job(s_job);
// If this node is iterative, we'll pick up which input here
QMap<QString, GLuint> texture_index_map;
QVector<TextureToBind> textures_to_bind;
@@ -697,6 +699,9 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination,
vao_.release();
vao_.destroy();
}
catch (std::bad_cast e){}
}
GLint OpenGLRenderer::GetInternalFormat(PixelFormat format, int channel_layout)
{
+1 -1
View File
@@ -69,7 +69,7 @@ public:
const QPointF &pt) override;
protected:
virtual void Blit(QVariant shader, olive::ShaderJob job,
virtual void Blit(QVariant shader, olive::AcceleratedJob& job,
olive::Texture *destination,
olive::VideoParams destination_params,
bool clear_destination) override;
+6 -1
View File
@@ -1 +1,6 @@
target_sources(libolive-editor PRIVATE pluginrenderer.cpp pluginrenderer.h)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
render/plugin/pluginrenderer.cpp
render/plugin/pluginrenderer.h
PARENT_SCOPE
)
+6 -4
View File
@@ -20,13 +20,15 @@
//
// Created by mikesolar on 25-10-19.
//
#define GL_PREAMBLE //QMutexLocker __l(&global_opengl_mutex);
#include "pluginrenderer.h"
#include "pluginSupport/OlivePluginInstance.h"
void olive::plugin::PluginRenderer::Blit(QVariant shader, ShaderJob job,
Texture *destination,
VideoParams destination_params,
void olive::plugin::PluginRenderer::Blit(QVariant shader,
olive::AcceleratedJob &job,
olive::Texture *destination,
olive::VideoParams destination_params,
bool clear_destination)
{
+17 -6
View File
@@ -23,20 +23,31 @@
#ifndef PLUGINRENDERER_H
#define PLUGINRENDERER_H
#include <QOpenGLExtraFunctions>
#include <QOpenGLBuffer>
#include <QOpenGLFunctions>
#include <QOpenGLShader>
#include <QOpenGLVertexArrayObject>
#include <QThread>
#include <QOffscreenSurface>
#include "render/renderer.h"
#include "render/job/pluginjob.h"
#include "render/opengl/openglrenderer.h"
namespace olive
{
namespace plugin{
class PluginRenderer : public olive::Renderer{
class PluginRenderer : public olive::OpenGLRenderer{
Q_OBJECT
public:
PluginRenderer(QObject *parent=nullptr):Renderer(parent){};
PluginRenderer(QObject *parent=nullptr):OpenGLRenderer(parent){};
virtual ~PluginRenderer() override{};
protected:
void Blit(QVariant shader,
ShaderJob job,
Texture *destination,
VideoParams destination_params,
virtual void Blit(QVariant shader, olive::AcceleratedJob& job,
olive::Texture *destination,
olive::VideoParams destination_params,
bool clear_destination) override;
};
}
}
+5 -4
View File
@@ -29,6 +29,7 @@
#include "render/job/colortransformjob.h"
#include "render/videoparams.h"
#include "texture.h"
#include "job/pluginjob.h"
namespace olive
{
@@ -47,15 +48,16 @@ public:
void DestroyTexture(Texture *texture);
void BlitToTexture(QVariant shader, olive::ShaderJob job,
virtual void BlitToTexture(QVariant shader, olive::AcceleratedJob& job,
olive::Texture *destination,
bool clear_destination = true)
{
Blit(shader, job, destination, destination->params(),
clear_destination);
}
void Blit(QVariant shader, olive::ShaderJob job, olive::VideoParams params,
void Blit(QVariant shader, olive::AcceleratedJob& job, olive::VideoParams params,
bool clear_destination = true)
{
Blit(shader, job, nullptr, params, clear_destination);
@@ -106,11 +108,10 @@ public:
const QPointF &pt) = 0;
protected:
virtual void Blit(QVariant shader, olive::ShaderJob job,
virtual void Blit(QVariant shader, olive::AcceleratedJob& job,
olive::Texture *destination,
olive::VideoParams destination_params,
bool clear_destination) = 0;
virtual QVariant CreateNativeTexture(int width, int height, int depth,
PixelFormat format, int channel_count,
const void *data = nullptr,