Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some Resolve features #18

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions HostSupport/include/ofxhParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,38 @@ namespace OFX {
virtual void notify(const std::string &name, bool single, int num) OFX_EXCEPTION_SPEC;
};

#ifdef OFX_EXTENSIONS_RESOLVE
class StrChoiceInstance : public Instance, public KeyframeParam {
std::string _returnValue; ///< location to hold temporary return value. Should delegate this to implementation!!!
public:
StrChoiceInstance(Descriptor& descriptor, Param::SetInstance* instance = 0);

// callback which should set option as appropriate
virtual void setOption(int num);

// Deriving implementatation needs to overide these
virtual OfxStatus get(std::string &) = 0;
virtual OfxStatus get(OfxTime time, std::string &) = 0;
virtual OfxStatus set(const char*) = 0;
virtual OfxStatus set(OfxTime time, const char*) = 0;

/// implementation of var args function
virtual OfxStatus getV(va_list arg);

/// implementation of var args function
virtual OfxStatus getV(OfxTime time, va_list arg);

/// implementation of var args function
virtual OfxStatus setV(va_list arg);

/// implementation of var args function
virtual OfxStatus setV(OfxTime time, va_list arg);

/// overridden from Instance
virtual void notify(const std::string &name, bool single, int num) OFX_EXCEPTION_SPEC;
};
#endif

class DoubleInstance : public Instance, public KeyframeParam {
public:
DoubleInstance(Descriptor& descriptor, Param::SetInstance* instance = 0) : Instance(descriptor,instance) {}
Expand Down
13 changes: 13 additions & 0 deletions HostSupport/src/ofxhImageEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ namespace OFX {
#ifdef OFX_EXTENSIONS_RESOLVE
{ kOfxImageEffectPropOpenCLRenderSupported, Property::eString, 1, false, "false"},
{ kOfxImageEffectPropCudaRenderSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropCudaStreamSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropMetalRenderSupported, Property::eString, 1, false, "false" },
#endif
#ifdef OFX_EXTENSIONS_NUKE
{ kFnOfxImageEffectPropMultiPlanar, Property::eInt, 1, false, "0" },
Expand Down Expand Up @@ -1301,7 +1303,10 @@ namespace OFX {
# ifdef OFX_EXTENSIONS_RESOLVE
{ kOfxImageEffectPropOpenCLEnabled, Property::eInt, 1, true, "0" },
{ kOfxImageEffectPropCudaEnabled, Property::eInt, 1, true, "0" },
{ kOfxImageEffectPropMetalEnabled, Property::eInt, 1, true, "0" },
{ kOfxImageEffectPropOpenCLCommandQueue, Property::ePointer, 1, false, "0" },
{ kOfxImageEffectPropCudaStream, Property::ePointer, 1, false, "0" },
{ kOfxImageEffectPropMetalCommandQueue, Property::ePointer, 1, false, "0" },
# endif
# ifdef OFX_EXTENSIONS_NUKE
{ kFnOfxImageEffectPropView, Property::eInt, 1, true, "0" },
Expand Down Expand Up @@ -1401,7 +1406,10 @@ namespace OFX {
# ifdef OFX_EXTENSIONS_RESOLVE
{ kOfxImageEffectPropOpenCLEnabled, Property::eInt, 1, true, "0" },
{ kOfxImageEffectPropCudaEnabled, Property::eInt, 1, true, "0" },
{ kOfxImageEffectPropMetalEnabled, Property::eInt, 1, true, "0" },
{ kOfxImageEffectPropOpenCLCommandQueue, Property::ePointer, 1, false, "0" },
{ kOfxImageEffectPropCudaStream, Property::ePointer, 1, false, "0" },
{ kOfxImageEffectPropMetalCommandQueue, Property::ePointer, 1, false, "0" },
# endif
# ifdef OFX_EXTENSIONS_VEGAS
{ kOfxImageEffectPropRenderView, Property::eInt, 1, true, "0" },
Expand Down Expand Up @@ -1518,7 +1526,10 @@ namespace OFX {
# ifdef OFX_EXTENSIONS_RESOLVE
{ kOfxImageEffectPropOpenCLEnabled, Property::eInt, 1, true, "0" },
{ kOfxImageEffectPropCudaEnabled, Property::eInt, 1, true, "0" },
{ kOfxImageEffectPropMetalEnabled, Property::eInt, 1, true, "0" },
{ kOfxImageEffectPropOpenCLCommandQueue, Property::ePointer, 1, false, "0" },
{ kOfxImageEffectPropCudaStream, Property::ePointer, 1, false, "0" },
{ kOfxImageEffectPropMetalCommandQueue, Property::ePointer, 1, false, "0" },
# endif
# ifdef OFX_EXTENSIONS_NUKE
{ kFnOfxImageEffectPropView, Property::eInt, 1, true, "0" },
Expand Down Expand Up @@ -4199,6 +4210,8 @@ namespace OFX {
# ifdef OFX_EXTENSIONS_RESOLVE
{ kOfxImageEffectPropOpenCLRenderSupported, Property::eString, 1, false, "false"},
{ kOfxImageEffectPropCudaRenderSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropCudaStreamSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropMetalRenderSupported, Property::eString, 1, false, "false" },
# endif
# ifdef OFX_EXTENSIONS_NUKE
{ kFnOfxImageEffectPropMultiPlanar, Property::eInt, 1, false, "0" },
Expand Down
3 changes: 2 additions & 1 deletion HostSupport/src/ofxhImageEffectAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,11 @@ namespace OFX {
# ifdef OFX_DEBUG_ACTIONS
OfxPlugin *op = _pluginHandle->getOfxPlugin();
std::cout << "OFX: "<<op->pluginIdentifier<<"("<<(void*)op<<")->"<<kOfxActionUnload<<"()"<<std::endl;
std::string pluginIdentifier(op->pluginIdentifier); // save it before it becomes invalid
# endif
stat = (*_pluginHandle)->mainEntry(kOfxActionUnload, 0, 0, 0);
# ifdef OFX_DEBUG_ACTIONS
std::cout << "OFX: "<<op->pluginIdentifier<<"("<<(void*)op<<")->"<<kOfxActionUnload<<"()->"<<StatStr(stat)<<std::endl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing that!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's it still a draft or is it ready to merge?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still a draft as I am not sure of the way StrChoiceInstance::notify is supposed to work.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About openfx-misc plugins, what is the issue ? They do not load on macOS and Windows and Linux or a specific OS and specific versions of Resolve ?

std::cout << "OFX: "<<pluginIdentifier<<"("<<(void*)op<<")->"<<kOfxActionUnload<<"()->"<<StatStr(stat)<<std::endl;
# endif
} CatchAllSetStatus(stat, gImageEffectHost, (*_pluginHandle), kOfxActionUnload);
(void)stat;
Expand Down
89 changes: 83 additions & 6 deletions HostSupport/src/ofxhParam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ namespace OFX {
# endif
return set(time, value);
}

/// overridden from Instance
void ChoiceInstance::notify(const std::string &name, bool single, int num) OFX_EXCEPTION_SPEC
{
Expand All @@ -1010,9 +1010,86 @@ namespace OFX {
}

#ifdef OFX_EXTENSIONS_RESOLVE
#ifdef __GNUC__
#warning "TODO: StrChoiceInstance"
#endif
//
// StrChoiceInstance
//

/// make a parameter, with the given type and name
StrChoiceInstance::StrChoiceInstance(Descriptor& descriptor, Param::SetInstance* instance)
: Instance(descriptor,instance)
{
_properties.addNotifyHook(kOfxParamPropChoiceOption, this);
}

// callback which should set option as appropriate
void StrChoiceInstance::setOption(int /*num*/)
{
}

/// implementation of var args function
OfxStatus StrChoiceInstance::getV(va_list arg)
{
const char **value = va_arg(arg, const char **);

OfxStatus stat = get(_returnValue); // I so don't like this, temp storage should be delegated to the implementation
*value = _returnValue.c_str();
# ifdef OFX_DEBUG_PARAMETERS
if (stat == kOfxStatOK) {
std::cout << ' ' << *value;
}
# endif
return stat;
}

/// implementation of var args function
OfxStatus StrChoiceInstance::getV(OfxTime time, va_list arg)
{
if ( OFX::IsNaN(time) ) {
return kOfxStatErrValue;
}
const char **value = va_arg(arg, const char **);

OfxStatus stat = get(time, _returnValue); // I so don't like this, temp storage should be delegated to the implementation
*value = _returnValue.c_str();
# ifdef OFX_DEBUG_PARAMETERS
if (stat == kOfxStatOK) {
std::cout << ' ' << *value;
}
# endif
return stat;
}

/// implementation of var args function
OfxStatus StrChoiceInstance::setV(va_list arg)
{
char *value = va_arg(arg, char*);
# ifdef OFX_DEBUG_PARAMETERS
std::cout << value;
# endif
return set(value);
}

/// implementation of var args function
OfxStatus StrChoiceInstance::setV(OfxTime time, va_list arg)
{
if ( OFX::IsNaN(time) ) {
return kOfxStatErrValue;
}
char *value = va_arg(arg, char*);
# ifdef OFX_DEBUG_PARAMETERS
std::cout << value;
# endif
return set(time, value);
}

/// overridden from Instance
void StrChoiceInstance::notify(const std::string &name, bool single, int num) OFX_EXCEPTION_SPEC
{
Instance::notify(name, single, num);
if (name == kOfxParamPropChoiceOption) {
setOption(num);
}
}
#endif

//
Expand Down Expand Up @@ -2364,7 +2441,7 @@ namespace OFX {

va_end(ap);

if (stat == kOfxStatOK) {
if (stat == kOfxStatOK && paramInstance->getParamSetInstance()) {
paramInstance->getParamSetInstance()->paramChangedByPlugin(paramInstance);
}

Expand Down Expand Up @@ -2405,7 +2482,7 @@ namespace OFX {

va_end(ap);

if (stat == kOfxStatOK) {
if (stat == kOfxStatOK && paramInstance->getParamSetInstance()) {
paramInstance->getParamSetInstance()->paramChangedByPlugin(paramInstance);
}

Expand Down
23 changes: 23 additions & 0 deletions include/ofxImageEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,29 @@ using the buffer pointers.
*/
#define kOfxImageEffectPropCudaEnabled "OfxImageEffectPropCudaEnabled"

/** @brief Indicates whether a host or plugin can support Cuda stream

- Type - string X 1
- Property Set - plugin descriptor (read/write), host descriptor (read only)
- Default - "false"
- Valid Values - This must be one of
- "false" - in which case the host or plugin does not support Cuda stream
- "true" - which means a host or plugin can support Cuda stream provided

*/
#define kOfxImageEffectPropCudaStreamSupported "OfxImageEffectPropCudaStreamSupported"

/** @brief The stream of Cuda render

- Type - pointer X 1
- Property Set - plugin descriptor (read only), host descriptor (read/write)

This property contains a pointer to the stream of Cuda render (cudaStream_t).
In order to use it, reinterpret_cast<cudaStream_t>(pointer) is needed.

*/
#define kOfxImageEffectPropCudaStream "OfxImageEffectPropCudaStream"

/** @brief Indicates whether a host or plugin can support Metal render

- Type - string X 1
Expand Down