The Addon Interfaces Library provides a framework for developing standard interfaces. Interfaces are used to build extendibility into an application without having to rewrite and redeploy the whole application. For example, because the new Multimedia Library implements standard addon interfaces, you can use it to write a video playback application that can handle new video formats as they become available, simply by adding a new filter or set of filters for that format.
The Addon Interfaces Library uses two structures to manage interfaces: AOInterface_t, which represents an interface, and AOICtrl_t, which represents an addon interface (AOI) control for one or more interfaces. Typically, addon code (including the interface(s) and control) is contained in a DLL, and is dynamically loaded by an application at runtime.
Each time an application requires an interface, it should hold the addon control containing the interface to prevent the addon from being unloaded while still in use. At this point, the addon control is loaded into memory, and its hold count is incremented. An addon control may be unloaded when there are no more holds on it.
This section lists the basic elements (structures and functions) of the Addon Interfaces Library (libaoi.so) that allow you to write and access your own interfaces.
Basic Addon Interfaces Library components:
|AOICtrl_t||A structure that defines an interface control.|
|AOInterface_t||A structure that defines an interface.|
|AoAdd()||Add the interfaces contained in a DLL to the global list of interfaces.|
|AoAddStatic()||Add a static list of interfaces to the global list of interfaces.|
|AoAddDirectory()||Add the interfaces contained in all DLLs in a directory to the global list of interfaces.|
|AoRemove()||Remove a control from the global list of interfaces.|
|AoHold()||Hold a control; ensure it's loaded if necessary.|
|AoRelease()||Release a control; unload it if necessary.|
|AoGetInterface()||Get a specific interface for a control.|
|AoIterate()||Iterate through the global list of controls and return the one that meets some criteria.|
|AoIterateHoldGet()||Iterate through the global list of controls to find a control that meets some criteria, hold, and then return the control.|
|AoAddUnloadSignal()||Add a signal handler to an application to unload an addon on.|
Additional interface-specific functions:
|AoFindExt()||Find a control with a AOExtInspector interface, and which is best suited for a specific file extension.|
|AoFindFormats()||Find a control with the best rating for a specific media format.|
|AoFindMime()||Find a control with the best rating for a mimetype.|
|AoFindName()||Find a control by its "Name" interface.|
|AoFindStreams()||Find a control with the best rating for a specific stream.|
|AoOpenFileSpec()||Find the first control that can open a filespec in a given mode.|