2.4 Basic plugin design

Every Hollywood plugin needs to export the functions InitPlugin() and ClosePlugin(). As their names imply, these two functions initialize and close a plugin. By calling InitPlugin() Hollywood asks your plugin to identify itself, i.e. it needs to report certain information back to Hollywood, e.g. its feature set, author, version, minimum required Hollywood version and so on. Depending on this information, Hollywood will then import other function pointers from the plugin, depending on the feature set the plugin has reported to Hollywood.

To describe its feature set, the plugin sets the hwPluginBase.CapsMask field to a combination of capability bits taken from the HWPLUG_CAPS_XXX definitions in hollywood/plugin.h. Hollywood then knows what this plugin can do and will import the needed function pointers. For example, if hwPluginBase.CapsMask is set to HWPLUG_CAPS_SOUND|HWPLUG_CAPS_SAVESAMPLE, Hollywood will know that this plugin can load sound files and save sample files. Hollywood will therefore import the following additional function pointers from the plugin:

 
OpenStream()
CloseStream()
SeekStream()
StreamSamples()
GetFormatName()
RegisterSampleSaver()
SaveSample()

If one of the function pointers listed above cannot be resolved, Hollywood won't load this plugin.

See InitPlugin() for details.

See ClosePlugin() for details.

Note that starting with Hollywood 10.0, all functions exported by plugins should use the prefix hwp_ to avoid name clashes with other APIs. Thus, for a plugin targetting Hollywood 10.0 or better, the plugin example from above should better export the following functions instead of the one listed above:

 
hwp_OpenStream()
hwp_CloseStream()
hwp_SeekStream()
hwp_StreamSamples()
hwp_GetFormatName()
hwp_RegisterSampleSaver()
hwp_SaveSample()

Using the hwp_ prefix makes sure that there are no clashes with other (system) APIs. Keep in mind, though, that if you use the hwp_ prefix in your function exports, your plugin won't run on any Hollywood version that is older than 10.0. That's why in this documentation the hwp_ prefix won't be explicitly mentioned in the documentation of the individual plugin functions because many plugin authors might want to target older Hollywood versions as well. If your plugin needs Hollywood 10.0 or better, though, you should always use the hwp_ prefix in your function exports and you should also define the HW_USEPREFIX macro so that the correct prototypes are used in hollywood/plugin.h.


Show TOC