int ok = hw_RegisterFileType(hwPluginBase *self, int type, STRPTR name,
STRPTR mime, STRPTR ext, ULONG formatid, ULONG flags);
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:
HWFILETYPE_IMAGE:
HWFILETYPE_ANIM:
HWFILETYPE_SOUND:
HWFILETYPE_VIDEO:
HWFILETYPE_ICON:
HWFILETYPE_FONT:
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:
HWFILETYPEFLAGS_SAVE:hw_RegisterFileType().
HWFILETYPEFLAGS_ALPHA:HWFILETYPEFLAGS_SAVE is set. This is only applicable for HWFILETYPE_IMAGE and
HWFILETYPE_ANIM.
HWFILETYPEFLAGS_QUALITY:HWFILETYPE_IMAGE, HWFILETYPE_ANIM, and HWFILETYPE_SOUND 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).
HWFILETYPEFLAGS_FPS:HWFILETYPE_ANIM together with the HWFILETYPEFLAGS_SAVE flag
set.
HWFILETYPEFLAGS_BITRATE:HWFILETYPE_SOUND and the HWFILETYPEFLAGS_SAVE flag must be
set. (V11.0)
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!
hwPluginBase as passed to your InitPlugin() functionNULLTrue 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|
HWFILETYPEFLAGS_ALPHA|HWFILETYPEFLAGS_QUALITY);
hw_RegisterFileType(self, HWFILETYPE_IMAGE, "JPEG 2000 (J2K)", NULL,
"j2k", outfmt[1], HWFILETYPEFLAGS_SAVE|
HWFILETYPEFLAGS_ALPHA|HWFILETYPEFLAGS_QUALITY);
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.