I.) Overview of CODEC Host Modules
II.) Exports of CODEC Host Modules
Overview:
A CODEC plug-in is created as a CODEC Host Module. This is simply the DLL
that exposes any number of CODEC(s) to PECompact2. Users of PECompact2 may
select any number of Codec Host Module DLL(s) they wish to use to encode their modules. Each CODEC Host Module
(CODEC plug-in) may internally contain any number of encoding and decoding
functions referenced by index. These are not selectable by the user, only
the CODEC Host Module itself is selectable by the user. When the CODEC Host
Module is chosen, all the CODEC(s) included in it are invoked in order. In
summary, the user may select any number of CODEC Host Modules, each of which
may contain any number of actual CODECs.
Example:
The following CODEC Host Module would invoke a CRC32 algorithm, the FFCE
compression algorithm, then another CRC32 algorithm. The user would simply
select 'pec2codec_ffce_with_crc32.dll', not seeing that there are actually three CODECs
within the Host Module.
CODEC Host Module: |
-codec 0: crc32* |
pec2codec_ffce_with_crc32.dll |
-codec 1: FFCE |
|
-codec 2: crc32 |
*The above configuration isn't optimal since two CRC32
checks will be fairly slow. It is for demonstrative purposes only. The CODECs contained within a CODEC Host Module are identified by a zero based
index number. Each CODEC exposes a number of entry points (APIs) listed in
the CODEC
Functions topic. To retrieve these entry-points, a call is made to the
host module API
CodecGetProcAddress, passing the the index of the desired codec and the
name of the API to retrieve the address of.
Ordering (CODEC indices) is very important.
Codecs are invoked during encoding in ascending order, starting with index
0. During decoding, the inverse order is used. Sample code: Your
PECompact installation includes source codes for a CODEC template (C++/asm)
and a CODEC that converts code endianness of code (C++ only).
A CODEC Host Module exposes these APIs:
FARPROC WINAPI
CodecGetProcAddress(DWORD dwIndex, LPCSTR pszApiName);
DWORD WINAPI
GetNumberOfCodecs();
|