00001 /* 00002 * Inter Asterisk Exchange 2 00003 * 00004 * The entity which receives all manages weirdo iax2 packets that are 00005 * sent outside of a regular call. 00006 * 00007 * Open Phone Abstraction Library (OPAL) 00008 * 00009 * Copyright (c) 2006 Stephen Cook 00010 * 00011 * The contents of this file are subject to the Mozilla Public License 00012 * Version 1.0 (the "License"); you may not use this file except in 00013 * compliance with the License. You may obtain a copy of the License at 00014 * http://www.mozilla.org/MPL/ 00015 * 00016 * Software distributed under the License is distributed on an "AS IS" 00017 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00018 * the License for the specific language governing rights and limitations 00019 * under the License. 00020 * 00021 * The Original Code is Open Phone Abstraction Library. 00022 * 00023 * The Initial Developer of the Original Code is Indranet Technologies Ltd 00024 * 00025 * 00026 * $Log: iax2jitter.h,v $ 00027 * Revision 1.2 2007/04/19 06:17:21 csoutheren 00028 * Fixes for precompiled headers with gcc 00029 * 00030 * Revision 1.1 2007/01/11 03:07:49 dereksmithies 00031 * Remove the jitter.h file, which was erroneously added. Replace it with the 00032 * correct iax2jitter.h file. 00033 * 00034 * Revision 1.2 2006/09/11 03:12:51 dereksmithies 00035 * Add logging and MPL license statements. 00036 * 00037 * 00038 */ 00039 00041 00042 #ifndef IAX2_JITTER_H 00043 #define IAX2_JITTER_H 00044 00045 #ifndef _PTLIB_H 00046 #include <ptlib.h> 00047 #endif 00048 00049 #include <rtp/rtp.h> 00050 #include <rtp/jitter.h> 00051 00052 //class RTP_DataFrame; 00053 00054 PDECLARE_LIST(RTP_DataFrameQueue, RTP_DataFrame *) 00055 #ifdef DOC_PLUS_PLUS //This makes emacs bracket matching code happy. 00056 00062 class RTP_DataFrameQueue : public RTP_DataFrame * 00063 { 00064 #endif 00065 public: 00066 }; 00067 00069 00070 class PendingRtpDataFrames : public RTP_DataFrameQueue 00071 { 00072 PCLASSINFO(PendingRtpDataFrames, RTP_DataFrameQueue); 00073 public: 00075 PendingRtpDataFrames(); 00076 00078 ~PendingRtpDataFrames(); 00079 00082 void CloseDown(); 00083 00086 RTP_DataFrame *GetLastFrame(); 00087 00089 void AddNewFrame(RTP_DataFrame *newFrame); 00090 00091 protected: 00094 RTP_DataFrame *InternalGetLastFrame(); 00095 00096 00098 PSyncPoint activate; 00099 00101 PMutex mutex; 00102 00104 BOOL keepGoing; 00105 }; 00106 00108 00111 class IAX2JitterBuffer : public OpalJitterBuffer 00112 { 00113 PCLASSINFO(IAX2JitterBuffer, OpalJitterBuffer); 00114 00115 public: 00117 IAX2JitterBuffer(); 00118 00121 ~IAX2JitterBuffer(); 00122 00127 virtual BOOL OnReadPacket ( 00128 RTP_DataFrame & frame, 00129 BOOL loop 00130 ) ; 00131 00133 void NewFrameFromNetwork(RTP_DataFrame *newFrame) 00134 { receivedFrames.AddNewFrame(newFrame); } 00135 00142 void CloseDown() { receivedFrames.CloseDown(); } 00143 00145 BOOL IsEmpty(); 00146 00147 protected: 00148 00150 PendingRtpDataFrames receivedFrames; 00151 }; 00152 00153 00154 00155 00156 #endif /*IAX2_JITTER_H*/