The OfxHost Struct

The OfxHost struct is how a host provides plug-ins with access to the various suites that make up the API they implement, as well as a host property set handle which a plug-in can ask questions of. The setHost function in the OfxPlugin struct is passed a pointer to an OfxHost as the first thing to boot-strapping plug-in/host communication.

The OfxHost contains two elements,

  • host - a property set handle that holds a set of properties which describe the host for the plug-in’s API

  • fetchSuite - a function handle used to fetch function suites from the host that implement the plug-in’s API

The host property set handle in the OfxHost is not global across all plug-ins defined in the binary. It is only applicable for the plug-in whose ‘setHost’ function was called. Use this handle to fetch things like host application names, host capabilities and so on. The set of properties on an OFX Image Effect host is found in the section Properties on the Image Effect Host

The fetchSuite function is how a plug-in gets a suite from the host. It asks for a suite by giving the C string corresponding to that suite and the version of that suite. The host will return a pointer to that suite, or NULL if it does not support it. Please note that a suite cannot be fetched until the very first action is called on the plug-in, which is the load action.

struct OfxHost

Generic host structure passed to OfxPlugin::setHost function.

This structure contains what is needed by a plug-in to bootstrap its connection to the host.

Public Members

OfxPropertySetHandle host

Global handle to the host. Extract relevant host properties from this. This pointer will be valid while the binary containing the plug-in is loaded.

const void *(*fetchSuite)(OfxPropertySetHandle host, const char *suiteName, int suiteVersion)

The function which the plug-in uses to fetch suites from the host.

  • host the host the suite is being fetched from this must be the host member of the OfxHost struct containing fetchSuite.

  • suiteName ASCII string labelling the host supplied API

  • suiteVersion version of that suite to fetch

Any API fetched will be valid while the binary containing the plug-in is loaded.

Repeated calls to fetchSuite with the same parameters will return the same pointer.

It is recommended that hosts should return the same host and suite pointers to all plugins in the same shared lib or bundle.

returns

  • NULL if the API is unknown (either the api or the version requested),

  • pointer to the relevant API if it was found