hw_RegisterFileType -- register a new file type (V5.3)
int ok = hw_RegisterFileType(hwPluginBase *self, int type, STRPTR name,
                STRPTR mime, STRPTR ext, ULONG formatid, ULONG flags);
This function can be used to register a new file type with Hollywood. Hollywood won't do anything with these file types except return information about them to the user if requested by a call to GetPlugins(). The information about the file types supported by the individual plugins can be useful to filter file name extensions when showing file requesters or it can be useful to ask the user to select a file format when saving an image, etc. This makes it possible for scripts to dynamically support all plugins that are currently available.

You have to pass a pointer to your plugin's hwPluginBase in parameter 1. Hollywood passes this pointer to you when it first calls your InitPlugin() function. You also have to specify the root type of the file format you want to register. The following types are currently supported:

Register specified file type as an image file format.

Register specified file type as an animation file format.

Register specified file type as a sound file format.

Register specified file type as a video file format.

Register specified file type as an icon file format. (V9.0)

The name you have to specify in parameter 3 must be a human-readable name of the file type you want to register, e.g. "IFF ILBM". The name you specify here may use spaces. The fourth parameter is optional and allows you to specify the MIME type for the file format you want to register. If you don't want to provide this, pass NULL as the fourth parameter. Parameter number 5 must contain the extension(s) used by this file type. The extension(s) must be specified without the dot. If the file type supports more than one extension, separate the individual extensions using a vertical bar character (|), e.g. "iff|ilbm|lbm". The formatid parameter is only used if HWFILETYPEFLAGS_SAVE is set in the flags parameter. In that case, you have to pass the identifier of this file format here. This must match the identifier that is returned by your implementations of functions like RegisterImageSaver() or RegisterAnimSaver().

Finally, RegisterFileType() accepts the following flags:

If this flag is set, you're registering a saver file type. You must register loaders and savers in two separate calls. It is not possible to register loader and saver within a single call to hw_RegisterFileType().

This flag indicates that your plugin can load or save alpha channel information, depending on whether HWFILETYPEFLAGS_SAVE is set. This is only applicable for HWFILETYPE_IMAGE and HWFILETYPE_ANIM.

This flag indicates that your plugin supports lossy compression of image data. It is only supported by for HWFILETYPE_IMAGE and HWFILETYPE_ANIM and the HWFILETYPEFLAGS_SAVE flag must be set. The quality level is passed to your plugin saver as a value ranging between 0 (bad quality) to 100 (excellent quality).

This flag indicates that your plugin can save animations with different frames per second settings. It is only supported by HWFILETYPE_ANIM together with the HWFILETYPEFLAGS_SAVE flag set.

RegisterFileType() is usually called in your InitPlugin() function but make sure that you have at least Hollywood 5.3 before attempting to call this function!

Designer compatibility
Supported since Designer 5.0

pointer to a hwPluginBase as passed to your InitPlugin() function
file type to register (see above)
human-readable name of this file type
MIME type for this file format or NULL
extension(s) for this file type; multiple extensions must be separated by a vertical bar (|)
when registering output file types, the unique identifier used by this format (see above)
additional flags (see above)
True for success, False on failure
hw_RegisterFileType(self, HWFILETYPE_IMAGE, "JPEG 2000", NULL,
                      "jp2|j2k", 0, HWFILETYPEFLAGS_ALPHA);

hw_RegisterFileType(self, HWFILETYPE_IMAGE, "JPEG 2000 (JP2)", NULL,
                      "jp2", outfmt[0], HWFILETYPEFLAGS_SAVE|

hw_RegisterFileType(self, HWFILETYPE_IMAGE, "JPEG 2000 (J2K)", NULL,
                      "j2k", outfmt[1], HWFILETYPEFLAGS_SAVE|
The code above registers a loader file type for the JPEG 2000 format and two savers for the JPEG 2000 format. The savers distinguish between the JP2 and the J2K container formats while the loader combines them into a single format.

Show TOC