H323_LIDCodec Class Reference

#include <lid.h>

Inheritance diagram for H323_LIDCodec:

H323AudioCodec H323Codec

List of all members.

Public Member Functions

 H323_LIDCodec (const char *mediaFormat, Direction direction, unsigned numFrames, PINDEX codecTableIndex)
virtual BOOL Read (BYTE *buffer, unsigned &length, RTP_DataFrame &rtpFrame)
virtual BOOL Write (const BYTE *buffer, unsigned length, const RTP_DataFrame &frame, unsigned &written)
virtual BOOL IsRawDataChannelNative () const
virtual BOOL DetectSilence ()
virtual unsigned GetAverageSignalLevel ()
PINDEX GetCodecTableIndex () const

Protected Attributes

PINDEX codecTableIndex
unsigned packetSize
unsigned missedCount
BYTE lastSID [4]
BOOL lastFrameWasSignal


Detailed Description

This class is a LID codec that only converts data for playback on some other audio device.

Constructor & Destructor Documentation

H323_LIDCodec::H323_LIDCodec ( const char *  mediaFormat,
Direction  direction,
unsigned  numFrames,
PINDEX  codecTableIndex 
)

Create a new LID based codec.

Parameters:
mediaFormat  Media format for codec
direction  Direction in which this instance runs
numFrames  Number of frames to transmit in packet
codecTableIndex  Type of codec to use


Member Function Documentation

virtual BOOL H323_LIDCodec::Read ( BYTE *  buffer,
unsigned &  length,
RTP_DataFrame rtpFrame 
) [virtual]

Encode the data from the appropriate device. This will encode a frame of data for transmission. The exact size and description of the data placed in the buffer is codec dependent but should be less than H323Capability::GetTxFramesInPacket() * OpalMediaFormat::GetFrameSize() in length.

The length parameter is filled with the actual length of the encoded data, often this will be the same as the size parameter.

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

Note that 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

Implements H323Codec.

virtual BOOL H323_LIDCodec::Write ( const BYTE *  buffer,
unsigned  length,
const RTP_DataFrame frame,
unsigned &  written 
) [virtual]

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
frame  Entire RTP frame
written  Number of bytes used from data buffer

Implements H323Codec.

virtual BOOL H323_LIDCodec::IsRawDataChannelNative (  )  const [virtual]

Return flag indicating raw channel is native. For audio codecs, FALSE typically means that the format is PCM-16. For video codecs, FALSE typically means that the format is YUV411P.

The default behaviour returns TRUE.

Reimplemented from H323Codec.

virtual BOOL H323_LIDCodec::DetectSilence (  )  [virtual]

Check frame for a talk burst. This does the deadband calculations on the average signal levels returned by the GetAverageSignalLevel() function and based on the levelThreshold, signalDeadbandFrames and silenceDeadbandFrames member variables.

Reimplemented from H323AudioCodec.

virtual unsigned H323_LIDCodec::GetAverageSignalLevel (  )  [virtual]

Calculate the energy in the audio stream. This is called from within DetectSilence() to calculate the average energy since the last call to DetectSilence().

Reimplemented from H323AudioCodec.

PINDEX H323_LIDCodec::GetCodecTableIndex (  )  const [inline]


Member Data Documentation

PINDEX H323_LIDCodec::codecTableIndex [protected]

unsigned H323_LIDCodec::packetSize [protected]

unsigned H323_LIDCodec::missedCount [protected]

BYTE H323_LIDCodec::lastSID[4] [protected]

BOOL H323_LIDCodec::lastFrameWasSignal [protected]


The documentation for this class was generated from the following file:
Generated on Wed Feb 6 09:03:02 2008 for OpenH323 by  doxygen 1.5.4