Finish TODO 8,9

This commit is contained in:
2026-01-04 23:53:12 +08:00
parent 271f56f3dd
commit 4cbdfd1a88
8 changed files with 325 additions and 24 deletions
+46 -1
View File
@@ -18,6 +18,7 @@
#include "OlivePluginInstance.h"
#include "OliveClip.h"
#include "ofxGPURender.h"
#include "ofxCore.h"
#include "ofxMessage.h"
#include "common/Current.h"
@@ -42,6 +43,19 @@ namespace olive
namespace plugin
{
namespace {
const std::string &FieldOrderForParams(const VideoParams &params)
{
switch (params.interlacing()) {
case VideoParams::kInterlaceNone:
return kOfxImageFieldNone;
case VideoParams::kInterlacedTopFirst:
return kOfxImageFieldUpper;
case VideoParams::kInterlacedBottomFirst:
return kOfxImageFieldLower;
}
return kOfxImageFieldNone;
}
class DeferredRedoCommand : public UndoCommand {
public:
explicit DeferredRedoCommand(UndoCommand *inner)
@@ -107,6 +121,11 @@ ViewerOutput *GetActiveViewerOutput()
}
} // namespace
const std::string &OlivePluginInstance::getDefaultOutputFielding() const
{
return FieldOrderForParams(params_);
}
OfxStatus OlivePluginInstance::vmessage(const char *type, const char *id,
const char *format, va_list args)
{
@@ -196,7 +215,6 @@ void OlivePluginInstance::getProjectExtent(double &xSize, double &ySize) const
{
xSize =params_.width();
ySize =params_.height();
// TODO: Ensure this project does not support this.
}
double OlivePluginInstance::getProjectPixelAspectRatio() const
{
@@ -392,6 +410,22 @@ bool OlivePluginInstance::progressUpdate(double t)
return !progress_cancelled_;
}
OfxStatus OlivePluginInstance::contextAttachedAction()
{
if (!open_gl_enabled_) {
return kOfxStatReplyDefault;
}
return kOfxStatOK;
}
OfxStatus OlivePluginInstance::contextDetachedAction()
{
if (!open_gl_enabled_) {
return kOfxStatReplyDefault;
}
return kOfxStatOK;
}
double OlivePluginInstance::timeLineGetTime()
{
if (ViewerOutput *viewer = GetActiveViewerOutput()) {
@@ -420,6 +454,17 @@ void OlivePluginInstance::timeLineGetBounds(double &t1, double &t2)
t2 = 0.0;
}
void OlivePluginInstance::setCustomInArgs(const std::string &action,
OFX::Host::Property::Set &inArgs)
{
if (action == kOfxImageEffectActionRender ||
action == kOfxImageEffectActionBeginSequenceRender ||
action == kOfxImageEffectActionEndSequenceRender) {
inArgs.setIntProperty(kOfxImageEffectPropOpenGLEnabled,
open_gl_enabled_ ? 1 : 0);
}
}
OFX::Host::ImageEffect::ClipInstance *OlivePluginInstance::newClipInstance(
OFX::Host::ImageEffect::Instance *plugin,
OFX::Host::ImageEffect::ClipDescriptor *descriptor,