1 /* g722codec.h 2 * 3 * Easy G722 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$ 28 * $Author$ 29 * $Date$ 30 */ 31 #include "easycodecs.h" 32 33 #include "EasyG722/EasyG722.h" 34 35 ///////////////////////////////////////////////////////////////////////////// 36 37 //#define Ecodec EasyG722 38 static const char EasyG722_Desc[] = { "Easy G722" }; // text decription 39 static const char EasyG722_L16Desc[]= { "L16" }; // source format 40 static const char EasyG722_MediaFmt[] = { "G.722-64k[e]" }; // destination format 41 static unsigned int EasyG722_SamplePerSec = 16000; // samples per second 42 static unsigned int EasyG722_BitsPerSec = 64000; // raw bits per second 43 static unsigned int EasyG722_NsPerFrame = 10000; // nanoseconds per frame 44 static unsigned int EasyG722_SamplesPerFrame = L_G722_FRAME; // samples per frame 45 static unsigned int EasyG722_BytesPerFrame = L_G722_FRAME_COMPRESSED; // Bytes per frame Compressed 46 static unsigned int EasyG722_RecFramesPerPacket = 1; //rec number of frames per packet 47 static unsigned int EasyG722_MaxFramesPerPacket = 1; // max number of frames per packet 48 #define EasyG722_IANACode 9 // IANA RTP payload code 49 static const char EasyG722_IANAName[] = { "G722" }; // RTP payload name 50 static unsigned char EasyG722_CapType = PluginCodec_H323AudioCodec_g722_64k; // h323CapabilityType 51 52 53 54 class G722_EasyCodec : public EasyCodec 55 { 56 public: init_encoder()57 unsigned long init_encoder() 58 { return EasyG722_init_encoder();} encoder(unsigned long hEncoder,short * speech,unsigned char * bitstream)59 bool encoder(unsigned long hEncoder, short *speech, unsigned char *bitstream) 60 { return EasyG722_encoder(hEncoder, speech, bitstream);} release_encoder(unsigned long hEncoder)61 bool release_encoder(unsigned long hEncoder) 62 { return EasyG722_release_encoder(hEncoder);} init_decoder()63 unsigned long init_decoder() 64 { return EasyG722_init_decoder();} decoder(unsigned long hDecoder,unsigned char * bitstream,short * synth_short)65 bool decoder(unsigned long hDecoder, unsigned char *bitstream, short *synth_short) 66 { return EasyG722_decoder(hDecoder, bitstream, synth_short);} release_decoder(unsigned long hDecoder)67 bool release_decoder(unsigned long hDecoder) 68 { return EasyG722_release_decoder(hDecoder);} 69 }; 70 71 #pragma data_seg(".G722_SHARED") // Define the Segment 72 #pragma comment(lib,"EasyG722/EasyG722.lib") // load Library into shared Memory 73 static G722_EasyCodec * m_G722codec = NULL; // specify the data and initialise at Instantiation 74 #pragma data_seg() 75 #pragma comment(linker, "/section:.G722_SHARED,rws") // link it 76