Description | Hierarchy | Fields | Methods | Properties |
type unaAbstractEncoder = class(unaObject)
Base abstract class for stream encoder/decoder.
f_errorCode: UNA_ENCODER_ERR; |
|
f_configOK: bool; |
|
f_opened: bool; |
|
f_inBuf: pointer; |
|
f_inBufSize: unsigned; |
|
f_outBuf: pointer; |
|
f_outBufSize: unsigned; |
|
f_outBufUsed: DWORD; |
|
f_inputChunkSize: int; |
|
f_minOutputBufSize: DWORD; |
|
f_encodedDataSize: unsigned; |
constructor create(priority: integer = THREAD_PRIORITY_NORMAL); |
|
function close(): UNA_ENCODER_ERR; |
|
function encodeChunk(data: pointer; size: unsigned; lastOne: bool = false): unsigned; |
|
function encodeChunkInPlace(data: pointer; var size: unsigned; outBuf: pointer; outBufSize: unsigned): unsigned; |
|
function open(): UNA_ENCODER_ERR; |
|
function read(buf: pointer; size: unsigned = 0): unsigned; |
|
function setConfig(config: pointer): UNA_ENCODER_ERR; |
|
function doClose(): UNA_ENCODER_ERR; virtual; abstract; |
|
function doDAEvent(data: pointer; size: unsigned): bool; virtual; |
|
function doEncode(data: pointer; nBytes: unsigned; out bytesUsed: unsigned): UNA_ENCODER_ERR; virtual; abstract; |
|
function doOpen(): UNA_ENCODER_ERR; virtual; abstract; |
|
function doSetConfig(config: pointer): UNA_ENCODER_ERR; virtual; abstract; |
|
function enter(timeout: tTimeout): bool; |
|
function leave(): bool; |
|
procedure AfterConstruction(); override; |
|
procedure BeforeDestruction(); override; |
|
procedure lazyWrite(buf: pointer; size: unsigned); |
property availableInputDataSize: unsigned index 1 read get_availableDataSize; |
|
property availableLazyDataSize: unsigned index 2 read get_availableDataSize; |
|
property availableOutputDataSize: unsigned index 0 read get_availableDataSize; |
|
property encodedDataSize: unsigned read f_encodedDataSize; |
|
property errorCode: UNA_ENCODER_ERR read f_errorCode; |
|
property inputChunkSize: int read f_inputChunkSize; |
|
property onDataAvailable: tUnaEncoderDataAvailableEvent read f_onDA write f_onDA; |
|
property priority: integer read get_priority write set_priority; |
f_errorCode: UNA_ENCODER_ERR; |
|
f_configOK: bool; |
|
f_opened: bool; |
|
f_inBuf: pointer; |
|
f_inBufSize: unsigned; |
|
f_outBuf: pointer; |
|
f_outBufSize: unsigned; |
|
f_outBufUsed: DWORD; |
|
f_inputChunkSize: int; |
|
f_minOutputBufSize: DWORD; |
|
must be set by doSetup(); |
f_encodedDataSize: unsigned; |
|
constructor create(priority: integer = THREAD_PRIORITY_NORMAL); |
|
Creates an encoder with specified priority. @priority has meaning with lazyWrite() method only. |
function close(): UNA_ENCODER_ERR; |
|
Deactivates the encoder. |
function encodeChunk(data: pointer; size: unsigned; lastOne: bool = false): unsigned; |
|
Returns number of bytes produced by encoder. Encoded data is first sent to onDataAvailable() event (if handler is assigned). If this event has no handler assigned, or handler returns writeToStream = true, data is also written into ouput stream. Check errorCode property if 0 was returned. Do not mix lazyWrite() and encodeChunk() calls. |
function encodeChunkInPlace(data: pointer; var size: unsigned; outBuf: pointer; outBufSize: unsigned): unsigned; |
|
Encodes a chunk of data. Encoded data is copied into outBuf. Returns actual number of bytes produced by this function or zero if some error has occured. Writes encoded data into outBuf. Number of bytes written into outBuf will not exceed outBufSize (which could be less than required). This function does not call onDataAvailable() and does not write any data into output stream. Size parameter also used to return number of bytes used in input buffer. Check errorCode property if 0 was returned. Do not mix lazyWrite() and encodeChunkInPlace() calls. |
function open(): UNA_ENCODER_ERR; |
|
Activates the encoder. |
function read(buf: pointer; size: unsigned = 0): unsigned; |
|
Reads data from the encoder output buffer. Returnsnumber of bytes read from output buffer. |
function setConfig(config: pointer): UNA_ENCODER_ERR; |
|
Configures encoder with specific stream parameters. |
function doClose(): UNA_ENCODER_ERR; virtual; abstract; |
|
Override this method to provide implementation of closing the encoder. Returnsstatus code of encoder after was closed. |
function doDAEvent(data: pointer; size: unsigned): bool; virtual; |
|
function doEncode(data: pointer; nBytes: unsigned; out bytesUsed: unsigned): UNA_ENCODER_ERR; virtual; abstract; |
|
Override this method to provide implementation of encoding the portion of data. Returnsstatus code of encoding. |
function doOpen(): UNA_ENCODER_ERR; virtual; abstract; |
|
Override this method to provide implementation of opening the encoder. Returnsstatus code of encoder after it was opened. |
function doSetConfig(config: pointer): UNA_ENCODER_ERR; virtual; abstract; |
|
Override this method to provide implementation of encoder configuration. Returnsstatus code of encoder after config information provided with config parameter was applied. |
function enter(timeout: tTimeout): bool; |
|
function leave(): bool; |
|
procedure AfterConstruction(); override; |
|
procedure BeforeDestruction(); override; |
|
procedure lazyWrite(buf: pointer; size: unsigned); |
|
Returns immediately after copying the data from buffer. Uses internal thread to feed the encoder. Do not mix lazyWrite() and encodeChunk() calls. |
property availableInputDataSize: unsigned index 1 read get_availableDataSize; |
|
Returns number of bytes awaiting to be processed in the input stream. |
property availableLazyDataSize: unsigned index 2 read get_availableDataSize; |
|
Returns number of bytes awaiting to be processed in the input stream of lazy thread. |
property availableOutputDataSize: unsigned index 0 read get_availableDataSize; |
|
Returns number of bytes available to read from output stream. |
property encodedDataSize: unsigned read f_encodedDataSize; |
|
Number of bytes encoded so far. |
property errorCode: UNA_ENCODER_ERR read f_errorCode; |
|
Encoder status code. |
property inputChunkSize: int read f_inputChunkSize; |
|
Size of input chunk in bytes. |
property onDataAvailable: tUnaEncoderDataAvailableEvent read f_onDA write f_onDA; |
|
Can be fired from internal thread, so do not use VCL calls in the handler. If you assign a handler for this event, and will not change the copyToStream parameter, data will not be copied into output stream. |
property priority: integer read get_priority write set_priority; |
|
Priority of encoder thread. Has meaning only when you are using lazyWrite(). |
(c) 2012 Lake of Soft