home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.muug.mb.ca
/
2014.06.ftp.muug.mb.ca.tar
/
ftp.muug.mb.ca
/
pub
/
openh323.tar.gz
/
openh323.tar
/
openh323
/
include
/
gsmcodec.h
< prev
next >
Wrap
C/C++ Source or Header
|
2002-09-15
|
7KB
|
230 lines
/*
* gsmcodec.h
*
* H.323 protocol handler
*
* Open H323 Library
*
* Copyright (c) 1999-2000 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Open H323 Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions of this code were written with the assisance of funding from
* Vovida Networks, Inc. http://www.vovida.com.
*
* Contributor(s): ______________________________________.
*
* $Log: gsmcodec.h,v $
* Revision 1.14 2002/09/16 01:14:15 robertj
* Added #define so can select if #pragma interface/implementation is used on
* platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
*
* Revision 1.13 2002/09/03 06:19:36 robertj
* Normalised the multi-include header prevention ifdef/define symbol.
*
* Revision 1.12 2002/08/05 10:03:47 robertj
* Cosmetic changes to normalise the usage of pragma interface/implementation.
*
* Revision 1.11 2001/10/24 01:20:34 robertj
* Added code to help with static linking of H323Capability names database.
*
* Revision 1.10 2001/02/11 22:48:30 robertj
* Added #pragma interface for GNU C++.
*
* Revision 1.9 2001/01/25 07:27:14 robertj
* Major changes to add more flexible OpalMediaFormat class to normalise
* all information about media types, especially codecs.
*
* Revision 1.8 2000/10/13 03:43:14 robertj
* Added clamping to avoid ever setting incorrect tx frame count.
*
* Revision 1.7 2000/05/10 04:05:26 robertj
* Changed capabilities so has a function to get name of codec, instead of relying on PrintOn.
*
* Revision 1.6 2000/05/02 04:32:24 robertj
* Fixed copyright notice comment.
*
* Revision 1.5 1999/12/31 00:05:36 robertj
* Added Microsoft ACM G.723.1 codec capability.
*
* Revision 1.4 1999/12/23 23:02:34 robertj
* File reorganision for separating RTP from H.323 and creation of LID for VPB support.
*
* Revision 1.3 1999/10/08 09:59:01 robertj
* Rewrite of capability for sending multiple audio frames
*
* Revision 1.2 1999/10/08 04:58:37 robertj
* Added capability for sending multiple audio frames in single RTP packet
*
* Revision 1.1 1999/09/08 04:05:48 robertj
* Added support for video capabilities & codec, still needs the actual codec itself!
*
*/
#ifndef __OPAL_GSMCODEC_H
#define __OPAL_GSMCODEC_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include "h323caps.h"
#ifdef H323_STATIC_LIB
H323_STATIC_LOAD_REGISTER_CAPABILITY(H323_GSM0610Capability);
#endif
///////////////////////////////////////////////////////////////////////////////
/**This class describes the GSM 06.10 codec capability.
*/
class H323_GSM0610Capability : public H323AudioCapability
{
PCLASSINFO(H323_GSM0610Capability, H323AudioCapability)
public:
/**@name Construction */
//@{
/**Create a new GSM 06.10 capability.
*/
H323_GSM0610Capability();
//@}
/**@name Overrides from class PObject */
//@{
/**Create a copy of the object.
*/
virtual PObject * Clone() const;
//@}
/**@name Operations */
//@{
/**Create the codec instance, allocating resources as required.
*/
virtual H323Codec * CreateCodec(
H323Codec::Direction direction /// Direction in which this instance runs
) const;
//@}
/**@name Identification functions */
//@{
/**Get the sub-type of the capability. This is a code dependent on the
main type of the capability.
This returns one of the four possible combinations of mode and speed
using the enum values of the protocol ASN H245_AudioCapability class.
*/
virtual unsigned GetSubType() const;
/**Get the name of the media data format this class represents.
*/
virtual PString GetFormatName() const;
/**Set the maximum size (in frames) of data that will be transmitted in a
single PDU.
This will also be the desired number that will be sent by most codec
implemetations.
The default behaviour sets the txFramesInPacket variable.
*/
virtual void SetTxFramesInPacket(
unsigned frames /// Number of frames per packet
);
//@}
/**@name Protocol manipulation */
//@{
/**This function is called whenever and outgoing TerminalCapabilitySet
or OpenLogicalChannel PDU is being constructed for the control channel.
It allows the capability to set the PDU fields from information in
members specific to the class.
The default behaviour sets the data rate field in the PDU.
*/
virtual BOOL OnSendingPDU(
H245_AudioCapability & pdu, /// PDU to set information on
unsigned packetSize /// Packet size to use in capability
) const;
/**This function is called whenever and incoming TerminalCapabilitySet
or OpenLogicalChannel PDU has been used to construct the control
channel. It allows the capability to set from the PDU fields,
information in members specific to the class.
The default behaviour gets the data rate field from the PDU.
*/
virtual BOOL OnReceivedPDU(
const H245_AudioCapability & pdu, /// PDU to get information from
unsigned & packetSize /// Packet size to use in capability
);
//@}
};
struct gsm_state;
/**This class is a GSM 06.10 codec.
*/
class H323_GSM0610Codec : public H323FramedAudioCodec
{
PCLASSINFO(H323_GSM0610Codec, H323FramedAudioCodec)
public:
/**@name Construction */
//@{
/**Create a new GSM 06.10 codec for ALaw.
*/
H323_GSM0610Codec(
Direction direction /// Direction in which this instance runs
);
~H323_GSM0610Codec();
//@}
/**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.
*/
virtual BOOL EncodeFrame(
BYTE * buffer, /// Buffer into which encoded bytes are placed
unsigned & length /// Actual length of encoded data buffer
);
/**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.
*/
virtual BOOL DecodeFrame(
const BYTE * buffer, /// Buffer from which encoded data is found
unsigned length, /// Length of encoded data buffer
unsigned & written /// Number of bytes used from data buffer
);
protected:
struct gsm_state * gsm;
};
#endif // __OPAL_GSMCODEC_H
/////////////////////////////////////////////////////////////////////////////