Unit Codec

From Ultibo.org
Revision as of 04:06, 9 January 2017 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


Ultibo Codec interface unit

To be documented

Constants



Codec specific constants CODEC_*
CODEC_NAME_PREFIX = 'Codec'; Name prefix for Codec Devices


Codec device type constants CODEC_TYPE_*
CODEC_TYPE_NONE = 0;  


Codec device state constants CODEC_STATE_*
CODEC_STATE_DISABLED = 0;  
CODEC_STATE_ENABLED = 1;  


Codec device flag constants CODEC_FLAG_*
CODEC_FLAG_NONE = $00000000;  


Codec logging constants CODEC_LOG_*
CODEC_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG; Codec debugging messages
CODEC_LOG_LEVEL_INFO = LOG_LEVEL_INFO; Codec informational messages, such as a device being attached or detached
CODEC_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR; Codec error messages
CODEC_LOG_LEVEL_NONE = LOG_LEVEL_NONE; No Codec messages


Type definitions



Codec properties

PCodecProperties = ^TCodecProperties;
TCodecProperties = record
Flags:LongWord; Device flags (eg CODEC_FLAG_????)

Codec enumeration callback

TCodecEnumerate = function(Codec:PCodecDevice;Data:Pointer):LongWord;

Codec notification callback

TCodecNotification = function(Device:PDevice;Data:Pointer;Notification:LongWord):LongWord;

Codec device properties

TCodecDeviceProperties = function(Codec:PCodecDevice;Properties:PCodecProperties):LongWord;

Codec device

PCodecDevice = ^TCodecDevice;

TCodecDevice = record

Device Properties
Device:TDevice; The Device entry for this Codec device
Codec Properties
CodecId:LongWord; Unique Id of this Codec device in the Codec device table
CodecState:LongWord; Codec dveice state (eg CODEC_STATE_ENABLED)
DeviceProperties:TCodecDeviceProperties; A Device specific DeviceProperties method implementing the standard Codec device interface (Or nil if the default method is suitable)
Driver Properties
Lock:TMutexHandle; Device lock
Properties:TCodecProperties; Device properties
Internal Properties
Prev:PCodecDevice; Previous entry in Codec device table
Next:PCodecDevice; Next entry in Codec device table


Codec device

PCodecDevice = ^TCodecDevice;
TCodecDevice = record
Device Properties
Device:TDevice; The Device entry for this Codec device
Codec Properties
CodecId:LongWord; Unique Id of this Codec device in the Codec device table
CodecState:LongWord; Codec dveice state (eg CODEC_STATE_ENABLED)
DeviceProperties:TCodecDeviceProperties; A Device specific DeviceProperties method implementing the standard Codec device interface (Or nil if the default method is suitable)
Driver Properties
Lock:TMutexHandle; Device lock
Properties:TCodecProperties; Device properties
Internal Properties
Prev:PCodecDevice; Previous entry in Codec device table
Next:PCodecDevice; Next entry in Codec device table


Public variables



Codec logging

CODEC_DEFAULT_LOG_LEVEL:LongWord = CODEC_LOG_LEVEL_DEBUG; Minimum level for Codec messages. Only messages with level greater than or equal to this will be printed.
CODEC_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

procedure CodecInit;
Description: Initialize the Codec unit and Codec device table
Note Called only during system startup


Codec device functions

function CodecDeviceProperties(Codec:PCodecDevice; Properties:PCodecProperties):LongWord;
Description: Get the properties for the specified Codec device
Codec The Codec device to get properties from
Properties Pointer to a TCodecProperties structure to fill in
Return ERROR_SUCCESS if completed or another error code on failure


function CodecDeviceCreate:PCodecDevice;
Description: Create a new Codec device entry
Return Pointer to new Codec device entry or nil if Codec device could not be created


function CodecDeviceCreateEx(Size:LongWord):PCodecDevice;
Description: Create a new Codec device entry
Size Size in bytes to allocate for new Codec device (Including the Codec device entry)
Return Pointer to new Codec device entry or nil if Codec device could not be created


function CodecDeviceDestroy(Codec:PCodecDevice):LongWord;
Description: Destroy an existing Codec device entry
Note None documented


function CodecDeviceRegister(Codec:PCodecDevice):LongWord;
Description: Register a new Codec device in the Codec device table
Note None documented


function CodecDeviceDeregister(Codec:PCodecDevice):LongWord;
Description: Deregister an Codec device from the Codec device table
Note None documented


function CodecDeviceFind(CodecId:LongWord):PCodecDevice;
Description: To be documented
Note None documented


function CodecDeviceFindByName(const Name:String):PCodecDevice; inline;
Description: To be documented
Note None documented


function CodecDeviceFindByDescription(const Description:String):PCodecDevice; inline;
Description: To be documented
Note None documented


function CodecDeviceEnumerate(Callback:TCodecEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function CodecDeviceNotification(Codec:PCodecDevice; Callback:TCodecNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note None documented


Codec helper functions

function CodecGetCount:LongWord; inline;
Description: Get the current Codec device count
Note None documented


function CodecDeviceGetDefault:PCodecDevice; inline;
Description: Get the current default Codec device
Note None documented


function CodecDeviceSetDefault(Codec:PCodecDevice):LongWord; 
Description: Set the current default Codec device
Note None documented


function CodecDeviceCheck(Codec:PCodecDevice):PCodecDevice;
Description: Check if the supplied Codec device is in the Codec device table
Note None documented


procedure CodecLog(Level:LongWord; Codec:PCodecDevice; const AText:String);
Description: To be documented
Note None documented


procedure CodecLogInfo(Codec:PCodecDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure CodecLogError(Codec:PCodecDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure CodecLogDebug(Codec:PCodecDevice; const AText:String); inline;
Description: To be documented
Note None documented


Return to Unit Reference