Chapter 3. The Generic OFX Plug-in Architecture

Overview

As explained in the introduction, OFX is actually several things,

  • an underlying generic plug-in architecture,
  • specific plug-in APIs defined using that architecture.

This chapter concentrates on defining the underlying architecture, including how plug-ins should be identified, defined, versioned, installed and the initial bootstrapping of communication occurs.

The two OFX include files relevant for this section are

  • ofxCore.h which defines basic data structures used in loading and identifying plug-ins,
  • ofxProperty.h which defines the suite used for fetching and setting properties on objects.

OFX APIs are all implemented via prototyped "C" header files. There are no OFX specific libraries to link against as the APIs consists solely of sets of header files and their supporting documentation. The API is also designed to minimise symbolic dependencies between the host and the plug-in.

Certain concepts are at the core of the OFX plug-in architecture, these are APIs , actions , suites , properties and handles . No matter what kind of API is being built on top of the core architecture, it will use these objects.

Actions

An action is how a host communicates with a plug-in, e.g.: "render frame 10". Actions are labelled by strings passed to a plug-in's 'mainEntry' function.

Suites

A suite is how a plug-in communicates to a host. Suites are 'C' structs filled with pointers to functions, the plug-in calls these functions to perform certain tasks (e.g.: fetch an image).

Handles

Handles are blind data pointers that are passed back to a plug-in from a host. They represent various types of data (e.g.: a set of properties, an instance of an image effect and so on) and are how objects on the host side are referenced by a plug-in. The data pointers themselves are typed by declaring them as pointers to defined but undeclared C structs.

Properties

Properties are simple data types used to communicate information between a host and a plug-in. They avoid having to pass around C structs and so makes versioning and backwards compatibility easier. They are name/value pairs labelled with a C-string. Properties are accessed using the property suite found in ofxProperty.h .

APIs

An 'API', in the OFX sense, is a named set of suites, actions and supporting objects used to implement a type of plug-in. Currently there is only one API built on the core architecture, this is the OFX Image Effect API, which is labelled by the string "OfxImageEffectPluginAPI"