H323StreamedAudioCodec Class Reference

#include <codecs.h>

Inheritance diagram for H323StreamedAudioCodec:

H323FramedAudioCodec H323AudioCodec H323Codec H323_ALawCodec H323_muLawCodec

List of all members.

Public Member Functions

 H323StreamedAudioCodec (const char *mediaFormat, Direction direction, unsigned samplesPerFrame, unsigned bits)
virtual BOOL EncodeFrame (BYTE *buffer, unsigned &length)
virtual BOOL DecodeFrame (const BYTE *buffer, unsigned length, unsigned &written, unsigned &samples)
virtual int Encode (short sample) const =0
virtual short Decode (int sample) const =0

Protected Attributes

unsigned bitsPerSample


Detailed Description

This class defines a codec class that will use the standard platform PCM output device, and the encoding/decoding is streamed. That is each input 16 bit PCM sample is encoded to 8 bits or less of encoded data and no blocking of PCM data is required, eg G.711, G.721 etc.

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


Constructor & Destructor Documentation

H323StreamedAudioCodec::H323StreamedAudioCodec ( const char *  mediaFormat,
Direction  direction,
unsigned  samplesPerFrame,
unsigned  bits 
)

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
samplesPerFrame  Number of samples in a frame
bits  Bits per sample


Member Function Documentation

virtual BOOL H323StreamedAudioCodec::EncodeFrame ( BYTE *  buffer,
unsigned &  length 
) [virtual]

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 encodedBlockSize bytes.

Parameters:
buffer  Buffer into which encoded bytes are placed
length  Actual length of encoded data buffer

Implements H323FramedAudioCodec.

virtual BOOL H323StreamedAudioCodec::DecodeFrame ( const BYTE *  buffer,
unsigned  length,
unsigned &  written,
unsigned &  samples 
) [virtual]

Decode a sample block from the buffer specified. The samples must be placed into the writeBuffer member variable. It is expected that no more than frameSamples is decoded. The return value is the number of samples decoded. Zero indicates an error.

Parameters:
buffer  Buffer from which encoded data is found
length  Length of encoded data buffer
written  Number of bytes used from data buffer
samples  Number of sample output from frame

Reimplemented from H323FramedAudioCodec.

virtual int H323StreamedAudioCodec::Encode ( short  sample  )  const [pure virtual]

Encode a single sample value.

Implemented in H323_ALawCodec, and H323_muLawCodec.

virtual short H323StreamedAudioCodec::Decode ( int  sample  )  const [pure virtual]

Decode a single sample value.

Implemented in H323_ALawCodec, and H323_muLawCodec.


Member Data Documentation

unsigned H323StreamedAudioCodec::bitsPerSample [protected]


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