#include <codecs.h>
An application may create a descendent off this class and override functions as required for descibing a specific codec.
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.
mediaFormat | Media format for codec |
direction | Direction in which this instance runs |
H323AudioCodec::~H323AudioCodec | ( | ) |
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.
connection | Connection between the endpoints |
Reimplemented from H323Codec.
virtual void H323AudioCodec::Close | ( | ) | [virtual] |
virtual unsigned H323AudioCodec::GetFrameRate | ( | ) | const [virtual] |
Get the frame rate in RTP timestamp units.
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.
mode | New silence detection mode |
threshold | Threshold value if FixedSilenceDetection |
signalDeadband | 10 milliseconds of signal needed |
silenceDeadband | 400 milliseconds of silence needed |
adaptivePeriod | 600 millisecond window for adaptive threshold |
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.
isInTalkBurst | Current silence detct state. |
currentThreshold | Current signal/silence threshold |
virtual void H323AudioCodec::SetTxQualityLevel | ( | int | ) | [inline, virtual] |
for codecs which support it, this sets the quality level of the transmitted audio. In order to have consistency between different codecs, the qlevel parameter is defined to range from 1 (good) to 31 (poor), even if the individual codec defines fewer levels than this.
virtual int H323AudioCodec::GetTxQualityLevel | ( | int | ) | [inline, virtual] |
for codecs which support it, this gets the quality level of the transmitted audio.
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.
unsigned H323AudioCodec::samplesPerFrame [protected] |
Reimplemented in OpalDynaAudioCodec.
unsigned H323AudioCodec::signalDeadbandFrames [protected] |
unsigned H323AudioCodec::silenceDeadbandFrames [protected] |
unsigned H323AudioCodec::adaptiveThresholdFrames [protected] |
BOOL H323AudioCodec::inTalkBurst [protected] |
unsigned H323AudioCodec::framesReceived [protected] |
unsigned H323AudioCodec::levelThreshold [protected] |
unsigned H323AudioCodec::signalMinimum [protected] |
unsigned H323AudioCodec::silenceMaximum [protected] |
unsigned H323AudioCodec::signalFramesReceived [protected] |
unsigned H323AudioCodec::silenceFramesReceived [protected] |