From 7ec4f9883c997bafb95cd2f560f24ec20ae0f6a4 Mon Sep 17 00:00:00 2001 From: jeremy Date: Wed, 19 Nov 2003 22:46:35 +0000 Subject: apply G.729 patches (with changes) from bug #421 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1767 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/h323/Makefile | 6 --- channels/h323/ast_h323.cpp | 74 ++++++++++++++++++++++++++++++++++-- channels/h323/ast_h323.h | 94 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+), 10 deletions(-) (limited to 'channels/h323') diff --git a/channels/h323/Makefile b/channels/h323/Makefile index d65021853..4caee2d59 100755 --- a/channels/h323/Makefile +++ b/channels/h323/Makefile @@ -16,12 +16,6 @@ ifndef ASTETCDIR ASTETCDIR=/etc/asterisk endif -# Uncomment if u want to attempt to include the G.729 stuff -# This is a quick fix to work around the missing H323Capability -# in Open H.323. As of Open H.323 1.12.0 the H323Capability for -# G.729 was removed due to legal reasons, use Open H.323 v1.11.7 -# -#CFLAGS += -DWANT_G729 # # This needs to be updated to deal with more than just little endian machines # diff --git a/channels/h323/ast_h323.cpp b/channels/h323/ast_h323.cpp index 87d767c6c..d1a81da01 100755 --- a/channels/h323/ast_h323.cpp +++ b/channels/h323/ast_h323.cpp @@ -100,8 +100,12 @@ void ClearCallThread::Main() #define H323_NAME OPAL_G7231_6k3"{sw}" +#define H323_G729 OPAL_G729 "{sw}" +#define H323_G729A OPAL_G729A"{sw}" H323_REGISTER_CAPABILITY(H323_G7231Capability, H323_NAME); +H323_REGISTER_CAPABILITY(AST_G729Capability, H323_G729); +H323_REGISTER_CAPABILITY(AST_G729ACapability, H323_G729A); H323_G7231Capability::H323_G7231Capability(BOOL annexA_) : H323AudioCapability(7, 4) @@ -173,6 +177,68 @@ H323Codec * H323_G7231Capability::CreateCodec(H323Codec::Direction direction) co return NULL; } + +///////////////////////////////////////////////////////////////////////////// + +AST_G729Capability::AST_G729Capability() + : H323AudioCapability(24, 6) +{ +} + + +PObject * AST_G729Capability::Clone() const +{ + return new AST_G729Capability(*this); +} + + +unsigned AST_G729Capability::GetSubType() const +{ + return H245_AudioCapability::e_g729; +} + + +PString AST_G729Capability::GetFormatName() const +{ + return H323_G729; +} + + +H323Codec * AST_G729Capability::CreateCodec(H323Codec::Direction direction) const +{ + return NULL; +} +///////////////////////////////////////////////////////////////////////////// + +AST_G729ACapability::AST_G729ACapability() + : H323AudioCapability(24, 6) +{ +} + + +PObject * AST_G729ACapability::Clone() const +{ + return new AST_G729ACapability(*this); +} + + +unsigned AST_G729ACapability::GetSubType() const +{ + return H245_AudioCapability::e_g729AnnexA; +} + + +PString AST_G729ACapability::GetFormatName() const +{ + return H323_G729A; +} + + +H323Codec * AST_G729ACapability::CreateCodec(H323Codec::Direction direction) const +{ + return NULL; +} + /** MyH323EndPoint * The fullAddress parameter is used directly in the MakeCall method so * the General form for the fullAddress argument is : @@ -806,12 +872,12 @@ int h323_set_capability(int cap, int dtmfMode) endPoint->SetCapability(0, 0, new SpeexNarrow6AudioCapability()); } -#if WANT_G729 if (cap & AST_FORMAT_G729A) { - H323_G729ACapability *g729aCap; - endPoint->SetCapability(0, 0, g729aCap = new H323_G729ACapability); + AST_G729ACapability *g729aCap; + AST_G729Capability *g729Cap; + endPoint->SetCapability(0, 0, g729aCap = new AST_G729ACapability); + endPoint->SetCapability(0, 0, g729Cap = new AST_G729Capability); } -#endif if (cap & AST_FORMAT_G723_1) { H323_G7231Capability *g7231Cap; diff --git a/channels/h323/ast_h323.h b/channels/h323/ast_h323.h index 081934e65..5c0c2b4a9 100755 --- a/channels/h323/ast_h323.h +++ b/channels/h323/ast_h323.h @@ -98,6 +98,100 @@ class H323_G7231Capability : public H323AudioCapability BOOL annexA; }; +/**This class describes the (fake) G729 codec capability. + */ +class AST_G729Capability : public H323AudioCapability +{ + PCLASSINFO(AST_G729Capability, H323AudioCapability); + + public: + /**@name Construction */ + //@{ + /**Create a new G.729 capability. + */ + AST_G729Capability(); + //@} + + /**@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; + //@} +}; + + +/**This class describes the VoiceAge G729A codec capability. + */ +class AST_G729ACapability : public H323AudioCapability +{ + PCLASSINFO(AST_G729ACapability, H323AudioCapability); + + public: + /**@name Construction */ + //@{ + /**Create a new G.729A capability. + */ + AST_G729ACapability(); + //@} + + /**@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; + //@} +}; + + class MyH323EndPoint : public H323EndPoint { PCLASSINFO(MyH323EndPoint, H323EndPoint); -- cgit v1.2.3