Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

H323AudioCodec Class Reference

#include <codecs.h>

Inheritance diagram for H323AudioCodec:

H323Codec G7231_File_Codec H323_LIDCodec H323FramedAudioCodec H323StreamedAudioCodec OpalDynaAudioCodec H323_ALawCodec H323_muLawCodec OpalDynaNonStandardAudioCodec List of all members.

Public Types

enum  SilenceDetectionMode { NoSilenceDetection, FixedSilenceDetection, AdaptiveSilenceDetection }

Public Member Functions

 H323AudioCodec (const char *mediaFormat, Direction direction)
 ~H323AudioCodec ()
virtual BOOL Open (H323Connection &connection)
virtual void Close ()
virtual unsigned GetFrameRate () const
void SetSilenceDetectionMode (SilenceDetectionMode mode, unsigned threshold=0, unsigned signalDeadband=80, unsigned silenceDeadband=3200, unsigned adaptivePeriod=4800)
SilenceDetectionMode GetSilenceDetectionMode (BOOL *isInTalkBurst=NULL, unsigned *currentThreshold=NULL) const
virtual BOOL DetectSilence ()
virtual unsigned GetAverageSignalLevel ()

Protected Attributes

unsigned samplesPerFrame
SilenceDetectionMode silenceDetectMode
unsigned signalDeadbandFrames
unsigned silenceDeadbandFrames
unsigned adaptiveThresholdFrames
BOOL inTalkBurst
unsigned framesReceived
unsigned levelThreshold
unsigned signalMinimum
unsigned silenceMaximum
unsigned signalFramesReceived
unsigned silenceFramesReceived

Detailed Description

This class defines a codec class that will use the standard platform PCM output device.

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


Member Enumeration Documentation

enum H323AudioCodec::SilenceDetectionMode
 

Enumeration values:
NoSilenceDetection 
FixedSilenceDetection 
AdaptiveSilenceDetection 


Constructor & Destructor Documentation

H323AudioCodec::H323AudioCodec 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:
direction  Media format for codec Direction in which this instance runs

H323AudioCodec::~H323AudioCodec  ) 
 


Member Function Documentation

virtual void H323AudioCodec::Close  )  [virtual]
 

Close down the codec. This will close the codec breaking any block on the Read() or Write() functions.

The default behaviour will close the rawDataChannel if it is not NULL and thene delete it if delteChannel is TRUE.

Implements H323Codec.

virtual BOOL H323AudioCodec::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 in H323_LIDCodec.

virtual unsigned H323AudioCodec::GetAverageSignalLevel  )  [virtual]
 

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().

The default behaviour returns UINT_MAX which disables the silence detection algorithm.

Reimplemented in H323FramedAudioCodec, H323_LIDCodec, and G7231_File_Codec.

virtual unsigned H323AudioCodec::GetFrameRate  )  const [virtual]
 

Get the frame rate in RTP timestamp units.

Reimplemented from H323Codec.

SilenceDetectionMode H323AudioCodec::GetSilenceDetectionMode BOOL *  isInTalkBurst = NULL,
unsigned *  currentThreshold = NULL
const
 

Get silence detection mode

The inTalkBurst value is TRUE if packet transmission is enabled and FALSE if it is being suppressed due to silence.

The currentThreshold value is the value from 0 to 32767 which is used as the threshold value for 16 bit PCM data.

virtual BOOL H323AudioCodec::Open H323Connection connection  )  [virtual]
 

Open the codec. This will open the codec for encoding or decoding. This is primarily used to delay allocation of resources until the last minute.

The default behaviour calls the H323EndPoint::OpenAudioChannel() function and assigns the result of that function to the raw data channel in the H323Codec class.

Parameters:
connection  Connection between the endpoints

Reimplemented from H323Codec.

void H323AudioCodec::SetSilenceDetectionMode SilenceDetectionMode  mode,
unsigned  threshold = 0,
unsigned  signalDeadband = 80,
unsigned  silenceDeadband = 3200,
unsigned  adaptivePeriod = 4800
 

Enable/Disable silence detection. The deadband periods are in audio samples of 8kHz.

Parameters:
threshold  New silence detection mode
signalDeadband  Threshold value if FixedSilenceDetection
silenceDeadband  10 milliseconds of signal needed
adaptivePeriod  400 milliseconds of silence needed 600 millisecond window for adaptive threshold


Member Data Documentation

unsigned H323AudioCodec::adaptiveThresholdFrames [protected]
 

unsigned H323AudioCodec::framesReceived [protected]
 

BOOL H323AudioCodec::inTalkBurst [protected]
 

unsigned H323AudioCodec::levelThreshold [protected]
 

unsigned H323AudioCodec::samplesPerFrame [protected]
 

Reimplemented in OpalDynaAudioCodec.

unsigned H323AudioCodec::signalDeadbandFrames [protected]
 

unsigned H323AudioCodec::signalFramesReceived [protected]
 

unsigned H323AudioCodec::signalMinimum [protected]
 

unsigned H323AudioCodec::silenceDeadbandFrames [protected]
 

SilenceDetectionMode H323AudioCodec::silenceDetectMode [protected]
 

unsigned H323AudioCodec::silenceFramesReceived [protected]
 

unsigned H323AudioCodec::silenceMaximum [protected]
 


The documentation for this class was generated from the following file:
Generated on Tue Mar 15 11:17:57 2005 for OpenH323 by  doxygen 1.4.0