1 /* g729Acodec.h
2  *
3  * Easy G729A codec for OpenH323/OPAL
4  *
5  * Copyright (c) 2004 ISVO (Asia) Pte Ltd. All Rights Reserved.
6  *
7  * The contents of this file are subject to the Mozilla Public License
8  * Version 1.0 (the "License"); you may not use this file except in
9  * compliance with the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS"
13  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14  * the License for the specific language governing rights and limitations
15  * under the License.
16  *
17  * Portions of this Code as Copyright Imtelephone.com. All rights reserved.
18  *
19  * The Original Code is derived from and used in conjunction with the
20  * OpenH323/OPAL Project (www.openh323.org/)
21  *
22  * The Initial Developer of the Original Code is ISVO (Asia) Pte Ltd.
23  *
24  *
25  * Contributor(s): ______________________________________.
26  *
27  * $Revision: 22678 $
28  * $Author: rjongbloed $
29  * $Date: 2009-05-20 19:35:59 -0500 (Wed, 20 May 2009) $
30  */
31 #include "easycodecs.h"
32 
33 #include "EasyG729A/EasyG729A.h"
34 
35 /////////////////////////////////////////////////////////////////////////////
36 
37 //#define Ecodec EasyG729A
38 static const char		EasyG729A_Desc[] = { "Easy G729A" };	// text decription
39 static const char		EasyG729A_L16Desc[]= { "L16" };			// source format
40 static const char		EasyG729A_MediaFmt[] = { "G.729A-8k[e]" };	// destination format
41 static unsigned int		EasyG729A_SamplePerSec = 8000;          // samples per second
42 static unsigned int		EasyG729A_BitsPerSec = 8000;			// raw bits per second
43 static unsigned int		EasyG729A_NsPerFrame = 10000;			// nanoseconds per frame
44 static unsigned int		EasyG729A_SamplesPerFrame = L_G729A_FRAME; // samples per frame
45 static unsigned int		EasyG729A_BytesPerFrame = L_G729A_FRAME_COMPRESSED; // Bytes per frame
46 static unsigned int		EasyG729A_RecFramesPerPacket = 1;        //rec number of frames per packet
47 static unsigned int		EasyG729A_MaxFramesPerPacket = 1;       // max number of frames per packet
48 #define	EasyG729A_IANACode  18									// IANA RTP payload code
49 static const char		EasyG729A_IANAName[] = { "G729A" };		// RTP payload name
50 static unsigned char	EasyG729A_CapType = PluginCodec_H323AudioCodec_g729AnnexA;	// h323CapabilityType
51 
52 
53 class G729A_EasyCodec : public EasyCodec
54 {
55   public:
init_encoder()56 	unsigned long init_encoder()
57 		{ return EasyG729A_init_encoder();}
encoder(unsigned long hEncoder,short * speech,unsigned char * bitstream)58 	bool encoder(unsigned long hEncoder, short *speech, unsigned char *bitstream)
59 		{ return EasyG729A_encoder(hEncoder, speech, bitstream);}
release_encoder(unsigned long hEncoder)60 	bool release_encoder(unsigned long hEncoder)
61 		{ return EasyG729A_release_encoder(hEncoder);}
init_decoder()62 	unsigned long init_decoder()
63 		{ return EasyG729A_init_decoder();}
decoder(unsigned long hDecoder,unsigned char * bitstream,short * synth_short)64 	bool decoder(unsigned long hDecoder, unsigned char *bitstream, short *synth_short)
65 		{ return EasyG729A_decoder(hDecoder, bitstream, synth_short);}
release_decoder(unsigned long hDecoder)66 	bool release_decoder(unsigned long hDecoder)
67 		{ return EasyG729A_release_decoder(hDecoder);}
68 };
69 
70 #pragma data_seg(".G729A_SHARED")				// define the segment
71 #pragma comment(lib,"EasyG729A/EasyG729A.lib")
72 static G729A_EasyCodec * m_G729Acodec = NULL; 	// specify the data and initialise at Instantiation
73 #pragma data_seg()
74 #pragma comment(linker, "/section:.G729A_SHARED,rws") // Link the segment