PECompact CODEC Plug-ins

Encode Exposed Function


DWORD WINAPI Encode(LPVOID lpvSource, DWORD dwSourceSize, LPVOID lpvDest, DWORD *pdwDestSize, DWORD dwLevel, PFNCodecCallback pCodecCallback);

Parameters:

lpvSource
The address of the beginning of the data you wish to decode.

dwSourceSize
The size of the source buffer, lpvSource.

lpvDest
The address at which to place the decoded data.

pdwDestSize
A pointer to the size, in bytes, of the buffer pointed to by lpvDest. If the return value is PEC2_CODEC_ERROR_INSUFFICIENT_BUFFER (-2), this variable receives the required size of the destination buffer, in bytes. If another error occurred, the dereferenced pdsDestSize variable is not altered.

dwLevel
The level, between 1 and the return value of GetMaximumEncodingLevel, of encoding to perform. Typically, this is used for compression algorithms to adjust parameters towards better compression at higher 'levels'.

pCodecCallback
The address of the callback procedure in the callee. This parameter may be NULL. See CodecCallback for more information.

Return Value:

If successful, the return value is the size, in bytes of the encoded data. If unsuccessful, the return value is PEC2_CODEC_ERROR_INSUFFICIENT BUFFER (-2) or PEC2_CODEC_ERROR_UNSPECIFIED (-1). If PEC2_CODEC_ERROR_INSUFFICIENT_BUFFER, the dereferenced pdwDestSize receives the required size of the destination buffer, in bytes.

Remarks:

The returned data may be larger than the input data.