echocancel.h

Go to the documentation of this file.
00001 /*
00002  * echocancel.h
00003  *
00004  * Open Phone Abstraction Library (OPAL)
00005  * Formally known as the Open H323 project.
00006  *
00007  * Copyright (c) 2004 Post Increment
00008  *
00009  * The contents of this file are subject to the Mozilla Public License
00010  * Version 1.0 (the "License"); you may not use this file except in
00011  * compliance with the License. You may obtain a copy of the License at
00012  * http://www.mozilla.org/MPL/
00013  *
00014  * Software distributed under the License is distributed on an "AS IS"
00015  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00016  * the License for the specific language governing rights and limitations
00017  * under the License.
00018  *
00019  * The Original Code is Open Phone Abstraction Library.
00020  *
00021  * The author of this code is Damien Sandras
00022  *
00023  * Contributor(s): Miguel Rodriguez Perez
00024  *
00025  * $Revision: 21283 $
00026  * $Author: rjongbloed $
00027  * $Date: 2008-10-11 07:10:58 +0000 (Sat, 11 Oct 2008) $
00028  */
00029 
00030 #ifndef OPAL_CODEC_ECHOCANCEL_H
00031 #define OPAL_CODEC_ECHOCANCEL_H
00032 
00033 #ifdef P_USE_PRAGMA
00034 #pragma interface
00035 #endif
00036 
00037 #include <opal/buildopts.h>
00038 
00039 #include <rtp/rtp.h>
00040 #include <ptclib/qchannel.h>
00041 
00042 #ifndef SPEEX_ECHO_H
00043 struct SpeexEchoState;
00044 #endif
00045 
00046 #ifndef SPEEX_PREPROCESS_H
00047 struct SpeexPreprocessState;
00048 #endif 
00049 
00051 class OpalEchoCanceler : public PObject
00052 {
00053   PCLASSINFO(OpalEchoCanceler, PObject);
00054 public:
00055   enum Mode {
00056     NoCancelation,
00057     Cancelation
00058   };
00059 
00060   struct Params {
00061     Params(
00062            Mode mode = NoCancelation
00063            ) : m_mode (mode)
00064     { }
00065 
00066     Mode m_mode;
00067   };
00068 
00073   OpalEchoCanceler();
00074   ~OpalEchoCanceler();
00076 
00077 
00080     const PNotifier & GetReceiveHandler() const { return receiveHandler; }
00081     const PNotifier & GetSendHandler() const {return sendHandler; }
00082 
00083     
00086     void SetParameters(
00087       const Params & newParam 
00088     );
00089 
00090 
00093     void SetClockRate(
00094       const int clockRate     
00095     );
00096 
00097 protected:
00098   PDECLARE_NOTIFIER(RTP_DataFrame, OpalEchoCanceler, ReceivedPacket);
00099   PDECLARE_NOTIFIER(RTP_DataFrame, OpalEchoCanceler, SentPacket);
00100 
00101   PNotifier receiveHandler;
00102   PNotifier sendHandler;
00103 
00104   Params param;
00105 
00106 private:
00107 
00108   double mean;
00109   int clockRate;
00110   PQueueChannel *echo_chan;
00111   PMutex stateMutex;
00112   SpeexEchoState *echoState;
00113   SpeexPreprocessState *preprocessState;
00114 
00115   // the following types are all void * to avoid including Speex header files
00116   void * ref_buf;
00117   void * echo_buf;
00118   void * e_buf;
00119   void * noise;
00120 };
00121 
00122 #endif // OPAL_CODEC_ECHOCANCEL_H
00123 

Generated on Mon Feb 23 02:01:06 2009 for OPAL by  doxygen 1.5.1