#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"
namespace MyHost
{
Host::Host()
{
_properties.setIntProperty(kOfxPropAPIVersion, 1, 0);
_properties.setIntProperty(kOfxPropAPIVersion, 4, 1);
_properties.setStringProperty(kOfxPropName, "OFXDemoHost");
_properties.setStringProperty(kOfxPropLabel, "OFX Demo Host");
_properties.setIntProperty(kOfxPropVersion, 1, 0);
_properties.setIntProperty(kOfxPropVersion, 0, 1);
_properties.setStringProperty(kOfxPropVersionLabel, "1.0");
_properties.setIntProperty(kOfxImageEffectHostPropIsBackground, 0);
_properties.setIntProperty(kOfxImageEffectPropSupportsOverlays, 0);
_properties.setIntProperty(kOfxImageEffectPropSupportsMultiResolution, 0);
_properties.setIntProperty(kOfxImageEffectPropSupportsTiles, true);
_properties.setIntProperty(kOfxImageEffectPropTemporalClipAccess, true);
_properties.setStringProperty(kOfxImageEffectPropSupportedComponents, kOfxImageComponentRGBA, 0);
_properties.setStringProperty(kOfxImageEffectPropSupportedComponents, kOfxImageComponentAlpha, 1);
_properties.setStringProperty(kOfxImageEffectPropSupportedContexts, kOfxImageEffectContextGenerator, 0 );
_properties.setStringProperty(kOfxImageEffectPropSupportedContexts, kOfxImageEffectContextFilter, 1);
_properties.setStringProperty(kOfxImageEffectPropSupportedContexts, kOfxImageEffectContextGeneral, 2 );
_properties.setStringProperty(kOfxImageEffectPropSupportedContexts, kOfxImageEffectContextTransition, 3 );
_properties.setIntProperty(kOfxImageEffectPropSupportsMultipleClipDepths, 0);
_properties.setIntProperty(kOfxImageEffectPropSupportsMultipleClipPARs, 0);
_properties.setIntProperty(kOfxImageEffectPropSetableFrameRate, 0);
_properties.setIntProperty(kOfxImageEffectPropSetableFielding, 0);
_properties.setIntProperty(kOfxParamHostPropSupportsCustomInteract, 0 );
_properties.setIntProperty(kOfxParamHostPropSupportsStringAnimation, 0 );
_properties.setIntProperty(kOfxParamHostPropSupportsChoiceAnimation, 0 );
_properties.setIntProperty(kOfxParamHostPropSupportsBooleanAnimation, 0 );
_properties.setIntProperty(kOfxParamHostPropSupportsCustomAnimation, 0 );
_properties.setIntProperty(kOfxParamHostPropMaxParameters, -1);
_properties.setIntProperty(kOfxParamHostPropMaxPages, 0);
_properties.setIntProperty(kOfxParamHostPropPageRowColumnCount, 0, 0 );
_properties.setIntProperty(kOfxParamHostPropPageRowColumnCount, 0, 1 );
}
OFX::Host::ImageEffect::Instance* Host::newInstance(void* clientData,
OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
OFX::Host::ImageEffect::Descriptor& desc,
const std::string& context)
{
return new MyEffectInstance(plugin, desc, context);
}
OFX::Host::ImageEffect::Descriptor *Host::makeDescriptor(OFX::Host::ImageEffect::ImageEffectPlugin* plugin)
{
OFX::Host::ImageEffect::Descriptor *desc = new OFX::Host::ImageEffect::Descriptor(plugin);
return desc;
}
OFX::Host::ImageEffect::Descriptor *Host::makeDescriptor(const OFX::Host::ImageEffect::Descriptor &rootContext,
OFX::Host::ImageEffect::ImageEffectPlugin *plugin)
{
OFX::Host::ImageEffect::Descriptor *desc = new OFX::Host::ImageEffect::Descriptor(rootContext, plugin);
return desc;
}
OFX::Host::ImageEffect::Descriptor *Host::makeDescriptor(const std::string &bundlePath,
OFX::Host::ImageEffect::ImageEffectPlugin *plugin)
{
OFX::Host::ImageEffect::Descriptor *desc = new OFX::Host::ImageEffect::Descriptor(bundlePath, plugin);
return desc;
}
OfxStatus Host::vmessage(const char* type,
const char* id,
const char* format,
va_list args)
{
bool isQuestion = false;
const char *prefix = "Message : ";
if (strcmp(type, kOfxMessageLog) == 0) {
prefix = "Log : ";
}
else if(strcmp(type, kOfxMessageFatal) == 0 ||
strcmp(type, kOfxMessageError) == 0) {
prefix = "Error : ";
}
else if(strcmp(type, kOfxMessageQuestion) == 0) {
prefix = "Question : ";
isQuestion = true;
}
fputs(prefix, stdout);
vprintf(format, args);
printf("\n");
if(isQuestion) {
return kOfxStatReplyYes;
}
else {
return kOfxStatOK;
}
}
OfxStatus Host::setPersistentMessage(const char* type,
const char* id,
const char* format,
va_list args)
{
return vmessage(type, id, format, args);
}
OfxStatus Host::clearPersistentMessage()
{
return kOfxStatOK;
}
}