Home Units Hierarchy Routines All identifiers

Class unavclInOutPipe

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unavclInOutPipe = class(tComponent)

Description

Base abstract class for all components.

Hierarchy

Overview

Methods

Public function addConsumer(consumer: unavclInOutPipe; forceNewFormat: bool = true): bool;
Public function addProvider(provider: unavclInOutPipe): bool;
Public function enter(ro: bool; timeout: tTimeout = 100): bool;
Public function getConsumerIndex(value: unavclInOutPipe): int;
Public function getPosition(): int64;
Public function getProviderIndex(value: unavclInOutPipe): int;
Public function open(provider: unavclInOutPipe = nil): bool;
Public function read(): aString; overload;
Public function read(data: pointer; len: uint): uint; overload;
Public function write(const data: aString; provider: unavclInOutPipe = nil): uint; overload;
Public function write(data: pointer; len: uint; provider: unavclInOutPipe = nil): uint; overload;
Protected function applyFormat(data: pointer; len: uint; provider: unavclInOutPipe = nil; restoreActiveState: bool = false): bool; virtual;
Protected function checkIfAutoActivate(value: bool; timeout: tTimeout = 10054): bool;
Protected function checkIfFormatProvider(restoreActiveState: bool): bool;
Protected function doAddConsumer(consumer: unavclInOutPipe; forceNewFormat: bool = true): bool; virtual;
Protected function doAddProvider(provider: unavclInOutPipe): bool; virtual;
Protected function doGetPosition(): int64; virtual;
Protected function doOpen(): bool; virtual;
Protected function doRead(data: pointer; len: uint): uint; virtual; abstract;
Protected function doSetActive(value: bool; timeout: tTimeout = 3000; provider: unavclInOutPipe = nil): bool;
Protected function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; virtual; abstract;
Protected function getAvailableDataLen(index: integer): uint; virtual; abstract;
Protected function getFormatExchangeData(out data: pointer): uint; virtual;
Protected function incInOutBytes(index: int; isIn: bool; delta: int): int64;
Protected function isActive(): bool; virtual; abstract;
Protected function onNewData(data: pointer; len: uint; provider: pointer = nil): bool; virtual;
Public procedure AfterConstruction(); override;
Public procedure BeforeDestruction(); override;
Public procedure clearFormatCRC();
Public procedure close(timeout: tTimeout = 0; provider: unavclInOutPipe = nil);
Public procedure leaveRO();
Public procedure leaveWO();
Public procedure removeConsumer(consumer: unavclInOutPipe);
Public procedure removeProvider(provider: unavclInOutPipe);
Protected procedure doBeforeAfterFC(doBefore: bool; provider: unavclInOutPipe; data: pointer; len: uint; out allowFC: bool);
Protected procedure doClose(); virtual;
Protected procedure doRemoveConsumer(consumer: unavclInOutPipe); virtual;
Protected procedure doRemoveProvider(provider: unavclInOutPipe); virtual;
Protected procedure doSetEnableDP(value: boolean); virtual;
Protected procedure Loaded(); override;
Protected procedure Notification(component: tComponent; operation: tOperation); override;
Protected procedure notifyConsumers();
Protected procedure notifyProviders(value: unavclInOutPipe);

Properties

Published property active: boolean read getActive write setActive default false;
Published property autoActivate: boolean read f_autoActivate write f_autoActivate default true;
Public property availableDataLenIn: uint index 0 read getAvailableDataLen;
Public property availableDataLenOut: uint index 1 read getAvailableDataLen;
Protected property closing: bool read f_closing write f_closing;
Published property consumer: unavclInOutPipe read getConsumerOneAndOnly write setConsumerOneAndOnly;
Public property consumerCount: int read getConsumerCount;
Public property consumers[index:int]: unavclInOutPipe read getConsumer;
Published property dumpInput: wideString read f_dumpInput write f_dumpInput;
Published property dumpOutput: wideString read f_dumpOutput write f_dumpOutput;
Public property enableDataProcessing: boolean read f_enableDP write setEnableDP default True;
Protected property enableDataProxy: boolean read f_enableDataProxy write f_enableDataProxy default false;
Public property ignoreProviderOptions: unsigned read f_ipo write f_ipo;
Public property inBytes[index:int]: int64 read getInBytes;
Protected property isFormatProvider: boolean read f_isFormatProvider write f_isFormatProvider default false;
Protected property onDataAvailable: unavclPipeDataEvent read f_dataAvail write f_dataAvail;
Protected property onDataDSP: unavclPipeDataEvent read f_dataDSP write f_dataDSP;
Protected property onFormatChangeAfter: unavclPipeAfterFormatChangeEvent read f_afterFormatChange write f_afterFormatChange;
Protected property onFormatChangeBefore: unavclPipeBeforeFormatChangeEvent read f_beforeFormatChange write f_beforeFormatChange;
Protected property opt: unsigned read f_opt;
Public property outBytes[index:int]: int64 read getOutBytes;
Public property position: int64 read getPosition;
Public property providerCount: int read getProviderCount;
Public property providerOneAndOnly: unavclInOutPipe read getProviderOneAndOnly;
Public property providers[index:int]: unavclInOutPipe read getProvider;
Protected property _consumers: unaObjectList read f_consumers;
Protected property _providers: unaObjectList read f_providers;

Description

Methods

Public function addConsumer(consumer: unavclInOutPipe; forceNewFormat: bool = true): bool;

Adds new consumer for the pipe.

Parameters
consumer
Consumer to add.
Returns

True if successfull.

Public function addProvider(provider: unavclInOutPipe): bool;

Adds new provider for the pipe.

Parameters
provider
Provider to be added.
Returns

True if successfull.

Public function enter(ro: bool; timeout: tTimeout = 100): bool;

Enters the internal critical section.

Parameters
ro
True for read-only lock.
Returns

True if critical section was entered.

Public function getConsumerIndex(value: unavclInOutPipe): int;

Returns index of consumer.

Returns

index of specified consumer.

Public function getPosition(): int64;

Returns position in stream.

Returns

Current position in stream (if applicable).

Public function getProviderIndex(value: unavclInOutPipe): int;

Returns index of provider.

Returns

index of specified provider.

Public function open(provider: unavclInOutPipe = nil): bool;

Opens the pipe.

Returns

True if successfull.

Public function read(): aString; overload;

Reads data as a AnsiString.

Returns

Data read.

Public function read(data: pointer; len: uint): uint; overload;

If you did not specify the consumer for the pipe, you must call this method periodically to access the stream output data. Best place to do that is in onDataAvailable() event handler.

Returns

Number of bytes actually read.

Public function write(const data: aString; provider: unavclInOutPipe = nil): uint; overload;

Writes data into the pipe.

Parameters
data
Data to write into the pipe.
provider
Provider of the data (if any).
Returns

Number of bytes actually written.

Public function write(data: pointer; len: uint; provider: unavclInOutPipe = nil): uint; overload;

Writes data into the pipe.

Parameters
data
Data to write into the pipe.
len
Size of memory block pointed by data parameter.
provider
Provider of the data (if any).
Returns

Number of bytes actually written.

Protected function applyFormat(data: pointer; len: uint; provider: unavclInOutPipe = nil; restoreActiveState: bool = false): bool; virtual;

Applies new format of the data stream.

Returns

True if successfull.

Protected function checkIfAutoActivate(value: bool; timeout: tTimeout = 10054): bool;

Checks if autoActivate property is True and activates/deactivates consumers if yes.

Protected function checkIfFormatProvider(restoreActiveState: bool): bool;

Checks if component is format provider and applies format to consumer if it is (and format was not applied before).

Protected function doAddConsumer(consumer: unavclInOutPipe; forceNewFormat: bool = true): bool; virtual;

Adds new consumer for the pipe.

Returns

True if successfull.

Protected function doAddProvider(provider: unavclInOutPipe): bool; virtual;

Assigns new provider for the pipe. Not all components are designed to work with more that one provider.

Returns

True if successfull.

Protected function doGetPosition(): int64; virtual;

Implements positions retrieval routine.

Returns

Current position in stream (if applicable).

Protected function doOpen(): bool; virtual;

Opens the pipe.

Protected function doRead(data: pointer; len: uint): uint; virtual; abstract;

Reads data from the pipe.

Protected function doSetActive(value: bool; timeout: tTimeout = 3000; provider: unavclInOutPipe = nil): bool;

Sets active state of the pipe.

Protected function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; virtual; abstract;

Writes data into the pipe.

Protected function getAvailableDataLen(index: integer): uint; virtual; abstract;

Returns data size available in the pipe (bytes).

Protected function getFormatExchangeData(out data: pointer): uint; virtual;

Fills the format of the data stream.

Returns

Stream data format.

Protected function incInOutBytes(index: int; isIn: bool; delta: int): int64;

Increments (or decrements) in/outBytes property by delta.

Parameters
index
counter index, from 0 to 7. 0 is reserved for consumers/providers, 1 for network
isIn
true for input
delta
delta size
Returns

New value of in/outBytes

Protected function isActive(): bool; virtual; abstract;

Returns component's active state.

Returns

True if component was activated succesfully.

Protected function onNewData(data: pointer; len: uint; provider: pointer = nil): bool; virtual;

Processes new data available from the pipe.

Returns

True if successfull.

Public procedure AfterConstruction(); override;

Creates list of consumers and providers, internal critical section and data proxy thread.

Public procedure BeforeDestruction(); override;

Destroys the pipe.

Public procedure clearFormatCRC();

Forces component to assign its format to consumers (if isFormatProvider is True). Call this method before activation.

Public procedure close(timeout: tTimeout = 0; provider: unavclInOutPipe = nil);

Closes the pipe.

Public procedure leaveRO();

Leaves the internal critical section.

Public procedure leaveWO();
 
Public procedure removeConsumer(consumer: unavclInOutPipe);

Removes consumer from the pipe.

Public procedure removeProvider(provider: unavclInOutPipe);

Removes one of pipe's providers.

Parameters
provider
Provider to be removed.
Protected procedure doBeforeAfterFC(doBefore: bool; provider: unavclInOutPipe; data: pointer; len: uint; out allowFC: bool);

Calls f_beforeFormatChange or f_afterFormatChange if assigned.

Protected procedure doClose(); virtual;

Closes the pipe.

Protected procedure doRemoveConsumer(consumer: unavclInOutPipe); virtual;

Removes consumer from the pipe.

Protected procedure doRemoveProvider(provider: unavclInOutPipe); virtual;

Removes one of pipe's providers.

Protected procedure doSetEnableDP(value: boolean); virtual;

Sets enableDataProcessing value.

Protected procedure Loaded(); override;

Usually creates an internal device of the pipe, and activates the component if needed.

Protected procedure Notification(component: tComponent; operation: tOperation); override;

IDE/VCL notification for components removal/insertion.

Protected procedure notifyConsumers();

Notify all consumers there is no more such provider (self).

Protected procedure notifyProviders(value: unavclInOutPipe);

Notify all providers there is new consumer (self), or consumer is removed (value = nil).

Properties

Published property active: boolean read getActive write setActive default false;

Returns or sets the active state of the pipe. Set to True to activate (open) the component. All other properties should be set to proper values before activation. Set to False to deactivate (close) the component.

Published property autoActivate: boolean read f_autoActivate write f_autoActivate default true;

When True tells the component it must activate consumer (if any) before activating itself. Same applies for deactivation.

When False the component does not change the consumer state.

Public property availableDataLenIn: uint index 0 read getAvailableDataLen;

Returns data written into but not yet processed by the pipe.

Public property availableDataLenOut: uint index 1 read getAvailableDataLen;

Returns data size available to read from the pipe.

Protected property closing: bool read f_closing write f_closing;

True if component is being closed.

Published property consumer: unavclInOutPipe read getConsumerOneAndOnly write setConsumerOneAndOnly;

Specifies the consumer of component. When set, specified consumer will receive all the stream data from the component. This allows linking the components to create a data flow chain.

Public property consumerCount: int read getConsumerCount;

Number of consumers.

Public property consumers[index:int]: unavclInOutPipe read getConsumer;

Returns consumer.

@param index Index of consumer (from 0 to consumerCount - 1).

@return Consumer of a pipe.

Published property dumpInput: wideString read f_dumpInput write f_dumpInput;

Specifies the file name to store the stream into. dumpInput is be used to store the input stream, which is coming as input for component. Stream will be saved in "as is" format.

For example, will store input stream as a sequence of PCM samples.

Published property dumpOutput: wideString read f_dumpOutput write f_dumpOutput;

Specifies the file name to store the stream into. dumpOutput is be used to store the output stream, which is coming as output from the component. Stream will be saved in "as is" format.

For example, will store output stream as sequence of PCM samples.

Public property enableDataProcessing: boolean read f_enableDP write setEnableDP default True;

Specifies whether the component would perform any data processing.

Protected property enableDataProxy: boolean read f_enableDataProxy write f_enableDataProxy default false;

Data will be placed to proxy thread before processing. This allows component to return from the write() method as soon as possible.

Public property ignoreProviderOptions: unsigned read f_ipo write f_ipo;

Specifies which proviers options will be ignored.

Public property inBytes[index:int]: int64 read getInBytes;

Number of bytes received by the pipe.

@param index 0 - received from providers; 1 - received from network

Protected property isFormatProvider: boolean read f_isFormatProvider write f_isFormatProvider default false;

When True the component will assign stream format to the consumer (if any). This simplifies the process of distributing stream format among linked components.

For example component can assign PCM format for linked unavclWaveOutDevice component, so WAVe file will be played back correctly.

Protected property onDataAvailable: unavclPipeDataEvent read f_dataAvail write f_dataAvail;

This event is fired every time component has produced or received new chunk of data. Use this event to access the raw stream data. Any modifications you made with data will not affect data consumers. To modify data before it will passed to consumers, use onDataDSP() event.

NOTE: VCL is NOT multi-threading safe, and you should avoid using VCL routines and classes in this event

Protected property onDataDSP: unavclPipeDataEvent read f_dataDSP write f_dataDSP;

This event is fired every time component has produced or received new chunk of data. Use this event to access the raw stream data. Any modifications you made on data will be passed to comsumers. To modify data without affecting consumers, use onDataAvailable() event.

NOTE: VCL is NOT multi-threading safe, and you should avoid using VCL routines and classes in this event

Protected property onFormatChangeAfter: unavclPipeAfterFormatChangeEvent read f_afterFormatChange write f_afterFormatChange;

This event is fired after new format was applied to a pipe.

NOTE: VCL is NOT multi-threading safe, and you should avoid using VCL routines and classes in this event

Protected property onFormatChangeBefore: unavclPipeBeforeFormatChangeEvent read f_beforeFormatChange write f_beforeFormatChange;

This event is fired before new format is about to be applied to a pipe. Using allowFormatChange parameter it is possible to disable format's applying.

NOTE: VCL is NOT multi-threading safe, and you should avoid using VCL routines and classes in this event

Protected property opt: unsigned read f_opt;

Internal.

Public property outBytes[index:int]: int64 read getOutBytes;

Number of bytes produced by the pipe.

@param index 0 - sent to consumers; 1 - sent to network

Public property position: int64 read getPosition;

Current position in stream (if applicable).

Public property providerCount: int read getProviderCount;

Number of providers.

Public property providerOneAndOnly: unavclInOutPipe read getProviderOneAndOnly;

Returns first provider of a component (if any).

Public property providers[index:int]: unavclInOutPipe read getProvider;

Returns provider.

@param index Index of consumer (from 0 to getProviderCount() - 1).

@return Provider of a pipe.

Protected property _consumers: unaObjectList read f_consumers;

List of consumers.

Protected property _providers: unaObjectList read f_providers;

List of providers.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09