diff --git a/app/pluginSupport/OliveClip.cpp b/app/pluginSupport/OliveClip.cpp new file mode 100644 index 000000000..7edd1e2af --- /dev/null +++ b/app/pluginSupport/OliveClip.cpp @@ -0,0 +1,122 @@ +/* + * 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 . + * + */ + +// +// Created by mikesolar on 25-10-1. +// + +#include "OliveClip.h" + +#include "common/Current.h" +const std::string &olive::plugin::OliveClipInstance::getUnmappedBitDepth() const +{ + switch (params_.format()) { + case PixelFormat::INVALID: + return kOfxBitDepthNone; + case PixelFormat::U8: + return kOfxBitDepthByte; + case PixelFormat::U16: + return kOfxBitDepthShort; + case PixelFormat::F16: + return kOfxBitDepthHalf; + case PixelFormat::F32: + return kOfxBitDepthFloat; + default: + return kOfxBitDepthNone; + } +} +const std::string & +olive::plugin::OliveClipInstance::getUnmappedComponents() const +{ + switch (params_.channel_count()) { + case 1: + return kOfxImageComponentAlpha; + case 3: + return kOfxImageComponentRGB; + case 4: + return kOfxImageComponentRGBA; + default: + return kOfxImageComponentNone; + } +} +const std::string &olive::plugin::OliveClipInstance::getPremult() const +{ + if (params_.premultiplied_alpha()) { + return kOfxImagePreMultiplied; + } else { + return kOfxImageUnPreMultiplied; + } +} +double olive::plugin::OliveClipInstance::getAspectRatio() const +{ + return params_ + .pixel_aspect_ratio() + .toDouble(); +} +double olive::plugin::OliveClipInstance::getFrameRate() const +{ + return params_.frame_rate().toDouble(); +} +void olive::plugin::OliveClipInstance::getFrameRange(double &startFrame, + double &endFrame) const +{ + startFrame = + params_.frame_rate().toDouble() * + params_.start_time(); + endFrame = + startFrame + + params_.frame_rate().toDouble() * + params_.duration(); +} +const std::string &olive::plugin::OliveClipInstance::getFieldOrder() const +{ + switch (params_.interlacing()) { + case VideoParams::kInterlaceNone: + return kOfxImageFieldNone; + case VideoParams::kInterlacedTopFirst: + return kOfxImageFieldUpper; + case VideoParams::kInterlacedBottomFirst: + return kOfxImageFieldLower; + } + return kOfxImageFieldNone; +} +bool olive::plugin::OliveClipInstance::getConnected() const +{ + return params_.format() == + PixelFormat::INVALID; +} +double olive::plugin::OliveClipInstance::getUnmappedFrameRate() const +{ + return getFrameRate(); +} +void olive::plugin::OliveClipInstance::getUnmappedFrameRange( + double &startFrame, double &endFrame) const +{ + getFrameRange(startFrame, endFrame); +} +bool olive::plugin::OliveClipInstance::getContinuousSamples() const +{ + return false; +} +OFX::Host::ImageEffect::Image * +olive::plugin::OliveClipInstance::getImage(OfxTime time, + const OfxRectD *optionalBounds) +{ + +} \ No newline at end of file diff --git a/app/pluginSupport/OliveClip.h b/app/pluginSupport/OliveClip.h new file mode 100644 index 000000000..94ba596e0 --- /dev/null +++ b/app/pluginSupport/OliveClip.h @@ -0,0 +1,63 @@ +/* + * 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 . + * + */ + +// +// Created by mikesolar on 25-10-1. +// + +#ifndef OLIVECLIP_H +#define OLIVECLIP_H +#include "ofxhClip.h" +#include "render/videoparams.h" +namespace olive +{ +namespace plugin +{ +class OliveClipInstance: public OFX::Host::ImageEffect::ClipInstance { +public: + OliveClipInstance(OFX::Host::ImageEffect::Instance* effectInstance, + OFX::Host::ImageEffect::ClipDescriptor& desc,VideoParams params) + : ClipInstance(effectInstance, desc) + { + params_ = params; + } + const std::string &getUnmappedBitDepth() const override; + const std::string &getUnmappedComponents() const override; + const std::string &getPremult() const override; + double getAspectRatio() const override; + double getFrameRate() const override; + void getFrameRange(double &startFrame, double &endFrame) const override; + const std::string &getFieldOrder() const override; + bool getConnected() const override; + double getUnmappedFrameRate() const override; + void getUnmappedFrameRange(double &startFrame, double &endFrame) const override; + 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; +private: + VideoParams params_; + +}; +} +} + + + +#endif //OLIVECLIP_H diff --git a/app/pluginSupport/OliveInstance.cpp b/app/pluginSupport/OliveInstance.cpp index 8a8fba951..0c0030fe8 100644 --- a/app/pluginSupport/OliveInstance.cpp +++ b/app/pluginSupport/OliveInstance.cpp @@ -16,6 +16,8 @@ * along with this program. If not, see . */ #include "OliveInstance.h" + +#include "OliveClip.h" #include "ofxCore.h" #include "ofxMessage.h" #include "common/Current.h" @@ -101,18 +103,18 @@ OfxStatus OliveInstance::clearPersistentMessage() } void OliveInstance::getProjectSize(double &xSize, double &ySize) const { - xSize = Current::getInstance().currentVideoParams().width(); - ySize = Current::getInstance().currentVideoParams().height(); + xSize =params_.width(); + ySize =params_.height(); } void OliveInstance::getProjectOffset(double &xOffset, double &yOffset) const { - xOffset = Current::getInstance().currentVideoParams().x(); - yOffset = Current::getInstance().currentVideoParams().y(); + xOffset =params_.x(); + yOffset =params_.y(); } void OliveInstance::getProjectExtent(double &xSize, double &ySize) const { - xSize = Current::getInstance().currentVideoParams().width(); - ySize = Current::getInstance().currentVideoParams().height(); + xSize =params_.width(); + ySize =params_.height(); // TODO: Ensure this project does not support this. } double OliveInstance::getProjectPixelAspectRatio() const @@ -124,7 +126,36 @@ double OliveInstance::getProjectPixelAspectRatio() const } double OliveInstance::getFrameRate() const { - return Current::getInstance().currentVideoParams().frame_rate().toDouble(); + return params_.frame_rate().toDouble(); +} + +double OliveInstance::getEffectDuration() const +{ + // Return a default duration value + return 100.0; +} + +double OliveInstance::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 +{ + // Return default render scale (1.0, 1.0) + x = 1.0; + y = 1.0; +} + +OFX::Host::ImageEffect::ClipInstance *OliveInstance::newClipInstance( + OFX::Host::ImageEffect::Instance *plugin, + OFX::Host::ImageEffect::ClipDescriptor *descriptor, + int index) +{ + // Create a new clip instance + OFX::Host::ImageEffect::ClipInstance* clipInstance = new OliveClipInstance(plugin, *descriptor, params_); + return clipInstance; } } diff --git a/ext/KDDockWidgets b/ext/KDDockWidgets index 8d2d0a576..f24a04252 160000 --- a/ext/KDDockWidgets +++ b/ext/KDDockWidgets @@ -1 +1 @@ -Subproject commit 8d2d0a5764f8393cc148a2296d511276a8ffe559 +Subproject commit f24a04252ba319ef323769e766b3ba5252c15c4c diff --git a/ext/core b/ext/core index 08eeee5fa..25e4152bb 160000 --- a/ext/core +++ b/ext/core @@ -1 +1 @@ -Subproject commit 08eeee5fa90bed55442f2be9e324482f0be0a73c +Subproject commit 25e4152bb70a0f4e30b9249e4f4b31e7936dc84a