Home Units Hierarchy Routines All identifiers

Class unaMsAcmCodec

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unaMsAcmCodec = class(unaMsAcmStreamDevice)

Description

This class is wrapper over Windows Multimedia streams API. Create it specifying the driver you wish to use with the stream. You can get list of available drivers from unaMsAcm class instance.

Codec usually takes source (input) stream, converts it into another wave format, and produces destination (output) stream. Before opening the codec you should specify source and destination formats using the setFormat() method. isSrc parameter is true for source format and false for destination. tag and index are specific for selected driver.

For example, Microsoft PCM Converter driver has tag = 1 and index specifies sampling parameters. So, if you specify tag=1, index=1 as source and tag=1, index=9 as destination, codec will convert 8,000 kHz; 8 Bit; stereo PCM stream into 22,050 kHz; 8 Bit; stereo PCM stream. You can easily enumerate all formats supported by specific driver using the unaMsAcmDriver.enumFormats() method.

After setting source and destination formats call the open() method to activate the codec. If you wish to check specified formats conversion is supported by codec, rather than opening it, specify true for query parameter. open() returns MMSYSERR_NOERR if codec was activated successfully. After that you need to feed the source stream using write() method, and periodically check destination stream, calling read() method. When you are finished with codec, destroy it or call the close() method.

Hierarchy

Overview

Methods

Public constructor create(driver: unaMsAcmDriver; realtime: bool = false; overNum: unsigned = 0; highPriority: bool = false; driverMode: unaAcmCodecDriverMode = unacdm_acm);
Public function setFormatSuggest(isSrcPCM: bool; const format: WAVEFORMATEX): bool; overload;
Public function setPcmFormatSuggest(isSrcPCM: bool; pcmFormat: pWAVEFORMATEX; formatTag: unsigned): bool; overload;
Public function setPcmFormatSuggest(isSrcPCM: bool; samplesPerSec: unsigned = c_defSamplingSamplesPerSec; bitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels; formatTag: unsigned = 0): bool; overload;
Protected function doClose(timeout: tTimeout = 1): MMRESULT; override;
Protected function doOpen(flags: uint): MMRESULT; override;
Protected function doWrite(buf: pointer; size: unsigned): unsigned; override;
Protected function execute(globalIndex: unsigned): int; override;
Protected function getMasterIsSrc2(): bool; override;
Protected function open2(query: bool = false; timeout: tTimeout = 10003; flags: uint = 0; startDevice: bool = true): MMRESULT; override;
Protected function prepareHeader(header: pointer): MMRESULT; override;
Protected function processNextChunk(): bool;
Protected function unprepareHeader(header: pointer): MMRESULT; override;
Public procedure BeforeDestruction(); override;
Public procedure setFormatIndex(isSrc: bool; tag, index: unsigned);
Public procedure setFormatSuggest(isSrc: bool; desiredDriver: unaMsAcmDriver; tag, index: unsigned; flags: uint = ACM_FORMATSUGGESTF_NCHANNELS + ACM_FORMATSUGGESTF_NSAMPLESPERSEC + ACM_FORMATSUGGESTF_WBITSPERSAMPLE); overload;
Protected procedure removeHeader(var header: pointer); override;

Properties

Public property driver: unaMsAcmDriver read f_driver write setDriver;
Public property driverLibrary: wString read f_driverLibrary write setDriverLibrary;
Public property driverMode: unaAcmCodecDriverMode read f_driverMode write f_driverMode;
Public property dstChunkSize;
Public property handle;
Public property oH323codecDesc[index:int]: ppluginCodec_definition read getoH323pluginDesc;

Description

Methods

Public constructor create(driver: unaMsAcmDriver; realtime: bool = false; overNum: unsigned = 0; highPriority: bool = false; driverMode: unaAcmCodecDriverMode = unacdm_acm);

Creates ACM codec class instance.

Public function setFormatSuggest(isSrcPCM: bool; const format: WAVEFORMATEX): bool; overload;

Use this method when you do know non-PCM parameters of source or dest stream.

Public function setPcmFormatSuggest(isSrcPCM: bool; pcmFormat: pWAVEFORMATEX; formatTag: unsigned): bool; overload;

Use this method when you do know PCM parameters of source or dest stream.

Public function setPcmFormatSuggest(isSrcPCM: bool; samplesPerSec: unsigned = c_defSamplingSamplesPerSec; bitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels; formatTag: unsigned = 0): bool; overload;

Use this method when you do know PCM parameters of source or dest stream.

Protected function doClose(timeout: tTimeout = 1): MMRESULT; override;
 
Protected function doOpen(flags: uint): MMRESULT; override;
 
Protected function doWrite(buf: pointer; size: unsigned): unsigned; override;

//

Protected function execute(globalIndex: unsigned): int; override;
 
Protected function getMasterIsSrc2(): bool; override;

Returns true.

Protected function open2(query: bool = false; timeout: tTimeout = 10003; flags: uint = 0; startDevice: bool = true): MMRESULT; override;
 
Protected function prepareHeader(header: pointer): MMRESULT; override;
 
Protected function processNextChunk(): bool;
 
Protected function unprepareHeader(header: pointer): MMRESULT; override;
 
Public procedure BeforeDestruction(); override;
 
Public procedure setFormatIndex(isSrc: bool; tag, index: unsigned);

Sets the source or destination format for codec.

Public procedure setFormatSuggest(isSrc: bool; desiredDriver: unaMsAcmDriver; tag, index: unsigned; flags: uint = ACM_FORMATSUGGESTF_NCHANNELS + ACM_FORMATSUGGESTF_NSAMPLESPERSEC + ACM_FORMATSUGGESTF_WBITSPERSAMPLE); overload;

Use this method when you do not know the exact format supported by the codec, but do know the driver, tag and index of the desired format.

Protected procedure removeHeader(var header: pointer); override;
 

Properties

Public property driver: unaMsAcmDriver read f_driver write setDriver;

Returns the driver used to perform the codec job.

Public property driverLibrary: wString read f_driverLibrary write setDriverLibrary;

Specifies library file (DLL) for a driver. Not used with ACM codecs, where you should specify driver directly instead.

Public property driverMode: unaAcmCodecDriverMode read f_driverMode write f_driverMode;

Specifies driver mode: ACM, installable or internal.

Public property dstChunkSize;

Since codec is input/output device, we need to have second chunk of data.

Public property handle;

WinAPI ACM handle

Public property oH323codecDesc[index:int]: ppluginCodec_definition read getoH323pluginDesc;

H323 Codec description

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09