class H323FramedAudioCodec

This class defines a codec class that will use the standard platform PCM output device, and the encoding/decoding has fixed blocks.

Inheritance:


Public Methods

[more] H323FramedAudioCodec ( const char* mediaFormat, Direction direction )
Create a new audio codec.
[more]virtual BOOL Read ( BYTE* buffer, unsigned & length, RTP_DataFrame & rtpFrame )
Encode the data from the appropriate device.
[more]virtual BOOL Write ( const BYTE* buffer, unsigned length, const RTP_DataFrame & rtpFrame, unsigned & written )
Decode the data and output it to appropriate device.
[more]virtual unsigned GetAverageSignalLevel ()
Get the average signal level in the audio stream.
[more]virtual BOOL EncodeFrame ( BYTE* buffer, unsigned & length )
Encode a sample block into the buffer specified.
[more]virtual BOOL DecodeFrame ( const BYTE* buffer, unsigned length, unsigned & written )
Decode a sample block from the buffer specified.
[more]virtual void DecodeSilenceFrame ( void* buffer, unsigned length )
Called when a frame is missed due to late arrival or other reasons By default, this function fills the buffer with silence


Inherited from H323AudioCodec:

Public Methods

ovirtual BOOL Open( H323Connection & connection )
ovirtual void Close()
ovirtual unsigned GetFrameRate() const
ovoid SetSilenceDetectionMode( SilenceDetectionMode mode, unsigned threshold = 0, unsigned signalDeadband = 80, unsigned silenceDeadband = 3200, unsigned adaptivePeriod = 4800 )
oSilenceDetectionMode GetSilenceDetectionMode( BOOL* isInTalkBurst = NULL, unsigned* currentThreshold = NULL ) const
ovirtual BOOL DetectSilence()


Inherited from H323Codec:

Public Methods

ovirtual void OnFlowControl( long bitRateRestriction )
ovirtual void OnMiscellaneousCommand( const H245_MiscellaneousCommand_type & type )
ovirtual void OnMiscellaneousIndication( const H245_MiscellaneousIndication_type & type )
ovirtual BOOL AttachChannel( PChannel* channel, BOOL autoDelete = TRUE )
ovirtual PChannel* SwapChannel( PChannel* newChannel, BOOL autoDelete = TRUE )
ovirtual BOOL CloseRawDataChannel()
oPChannel* GetRawDataChannel()
ovirtual BOOL IsRawDataChannelNative() const
oBOOL ReadRaw( void* data, PINDEX size, PINDEX & length )
oBOOL WriteRaw( void* data, PINDEX length )
oBOOL AttachLogicalChannel(H323Channel* channel)
ovoid AddFilter( const PNotifier & notifier )


Documentation

This class defines a codec class that will use the standard platform PCM output device, and the encoding/decoding has fixed blocks. That is each input block of n samples is encoded to exactly the same sized compressed data, eg G.711, GSM etc.

An application may create a descendent off this class and override functions as required for descibing a specific codec.

o H323FramedAudioCodec( const char* mediaFormat, Direction direction )
Create a new audio codec. This opens the standard PCM audio output device, for input and output and allows descendent codec classes to do audio I/O after decoding/encoding.
Parameters:
mediaFormat - Media format for codec
direction - Direction in which this instance runs

ovirtual BOOL Read( BYTE* buffer, unsigned & length, RTP_DataFrame & rtpFrame )
Encode the data from the appropriate device. This will encode data for transmission. The exact size and description of the data placed in the buffer is codec dependent but should be less than OpalMediaFormat::GetFrameSize() in length.

The length parameter is filled with the actual length of the encoded data, often this will be the same as OpalMediaFormat::GetFrameSize().

This function is called every GetFrameRate() timestamp units, so MUST take less than (or equal to) that amount of time to complete. It should always return the amount of data that corresponds to the GetFrameRate() timestamp units as well.

A returned length of zero indicates that time has passed but there is no data encoded. This is typically used for silence detection in an audio codec.

Parameters:
buffer - Buffer of encoded data
length - Actual length of encoded data buffer
rtpFrame - RTP data frame

ovirtual BOOL Write( const BYTE* buffer, unsigned length, const RTP_DataFrame & rtpFrame, unsigned & written )
Decode the data and output it to appropriate device. This will decode a single frame of received data. The exact size and description of the data required in the buffer is codec dependent but should be less than H323Capability::GetRxFramesInPacket() * OpalMediaFormat::GetFrameSize() in length.

It is expected this function anunciates the data. That is, for example with audio data, the sound is output on a speaker.

This function is called every GetFrameRate() timestamp units, so MUST take less than that amount of time to complete!

Parameters:
buffer - Buffer of encoded data
length - Length of encoded data buffer
rtpFrame - RTP data frame
written - Number of bytes used from data buffer

ovirtual unsigned GetAverageSignalLevel()
Get the average signal level in the audio stream. This is called from within DetectSilence() to calculate the average signal level since the last call to DetectSilence().

ovirtual BOOL EncodeFrame( BYTE* buffer, unsigned & length ) = 0
Encode a sample block into the buffer specified. The samples have been read and are waiting in the readBuffer member variable. it is expected this function will encode exactly bytesPerFrame bytes.
Parameters:
buffer - Buffer into which encoded bytes are placed
length - Actual length of encoded data buffer

ovirtual BOOL DecodeFrame( const BYTE* buffer, unsigned length, unsigned & written ) = 0
Decode a sample block from the buffer specified. The samples must be placed into the writeBuffer member variable. It is expected that exactly samplesPerFrame samples is decoded.
Parameters:
buffer - Buffer from which encoded data is found
length - Length of encoded data buffer
written - Number of bytes used from data buffer

ovirtual void DecodeSilenceFrame( void* buffer, unsigned length )
Called when a frame is missed due to late arrival or other reasons By default, this function fills the buffer with silence
Parameters:
buffer - Buffer from which encoded data is found
length - Length of encoded data buffer


Direct child classes:
H323_LPC10Codec
H323_GSM0610Codec
H323_G729ACodec
H323_G7231Codec
H323StreamedAudioCodec

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.