#include <iostream>
#include <fstream>
#include "ofxCore.h"
#include "ofxImageEffect.h"
#include "ofxPixels.h"
#include "ofxhBinary.h"
#include "ofxhPropertySuite.h"
#include "ofxhClip.h"
#include "ofxhParam.h"
#include "ofxhMemory.h"
#include "ofxhImageEffect.h"
#include "ofxhPluginAPICache.h"
#include "ofxhPluginCache.h"
#include "ofxhHost.h"
#include "ofxhImageEffectAPI.h"
#include "hostDemoHostDescriptor.h"
#include "hostDemoEffectInstance.h"
#include "hostDemoClipInstance.h"
#include "hostDemoParamInstance.h"
namespace MyHost {
MyEffectInstance::MyEffectInstance(OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
OFX::Host::ImageEffect::Descriptor& desc,
const std::string& context)
: OFX::Host::ImageEffect::Instance(plugin,desc,context,false)
{
}
OFX::Host::ImageEffect::ClipInstance* MyEffectInstance::newClipInstance(OFX::Host::ImageEffect::Instance* plugin,
OFX::Host::ImageEffect::ClipDescriptor* descriptor,
int index)
{
return new MyClipInstance(this,descriptor);
}
const std::string &MyEffectInstance::getDefaultOutputFielding() const
{
static const std::string v(kOfxImageFieldNone);
return v;
}
OfxStatus MyEffectInstance::vmessage(const char* type,
const char* id,
const char* format,
va_list args)
{
printf("%s %s ",type,id);
vprintf(format,args);
return kOfxStatOK;
}
OfxStatus MyEffectInstance::setPersistentMessage(const char* type,
const char* id,
const char* format,
va_list args)
{
return vmessage(type, id, format, args);
}
OfxStatus MyEffectInstance::clearPersistentMessage()
{
return kOfxStatOK;
}
void MyEffectInstance::getProjectSize(double& xSize, double& ySize) const
{
xSize = 768;
ySize = 576;
}
void MyEffectInstance::getProjectOffset(double& xOffset, double& yOffset) const
{
xOffset = 0;
yOffset = 0;
}
void MyEffectInstance::getProjectExtent(double& xSize, double& ySize) const
{
xSize = 768;
ySize = 576;
}
double MyEffectInstance::getProjectPixelAspectRatio() const
{
return double(768)/double(720);
}
double MyEffectInstance::getEffectDuration() const
{
return 25.0;
}
double MyEffectInstance::getFrameRate() const
{
return 25.0;
}
double MyEffectInstance::getFrameRecursive() const
{
return 0.0;
}
void MyEffectInstance::getRenderScaleRecursive(double &x, double &y) const
{
x = y = 1.0;
}
OFX::Host::Param::Instance* MyEffectInstance::newParam(const std::string& name, OFX::Host::Param::Descriptor& descriptor)
{
if(descriptor.getType()==kOfxParamTypeInteger)
return new MyIntegerInstance(this,name,descriptor);
else if(descriptor.getType()==kOfxParamTypeDouble)
return new MyDoubleInstance(this,name,descriptor);
else if(descriptor.getType()==kOfxParamTypeBoolean)
return new MyBooleanInstance(this,name,descriptor);
else if(descriptor.getType()==kOfxParamTypeChoice)
return new MyChoiceInstance(this,name,descriptor);
else if(descriptor.getType()==kOfxParamTypeRGBA)
return new MyRGBAInstance(this,name,descriptor);
else if(descriptor.getType()==kOfxParamTypeRGB)
return new MyRGBInstance(this,name,descriptor);
else if(descriptor.getType()==kOfxParamTypeDouble2D)
return new MyDouble2DInstance(this,name,descriptor);
else if(descriptor.getType()==kOfxParamTypeInteger2D)
return new MyInteger2DInstance(this,name,descriptor);
else if(descriptor.getType()==kOfxParamTypePushButton)
return new MyPushbuttonInstance(this,name,descriptor);
else if(descriptor.getType()==kOfxParamTypeGroup)
return new OFX::Host::Param::GroupInstance(descriptor,this);
else if(descriptor.getType()==kOfxParamTypePage)
return new OFX::Host::Param::PageInstance(descriptor,this);
else
return 0;
}
OfxStatus MyEffectInstance::editBegin(const std::string& name)
{
return kOfxStatErrMissingHostFeature;
}
OfxStatus MyEffectInstance::editEnd(){
return kOfxStatErrMissingHostFeature;
}
void MyEffectInstance::progressStart(const std::string &message, const std::string &messageid)
{
}
void MyEffectInstance::progressEnd()
{
}
bool MyEffectInstance::progressUpdate(double t)
{
return true;
}
double MyEffectInstance::timeLineGetTime()
{
return 0;
}
void MyEffectInstance::timeLineGotoTime(double t)
{
}
void MyEffectInstance::timeLineGetBounds(double &t1, double &t2)
{
t1 = 0;
t2 = 25;
}
}