00001 // Copyright (C) 2002 Federico Montesino Pouzols <fedemp@altern.org>. 00002 // 00003 // This program is free software; you can redistribute it and/or modify 00004 // it under the terms of the GNU General Public License as published by 00005 // the Free Software Foundation; either version 2 of the License, or 00006 // (at your option) any later version. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00016 // 00017 // As a special exception, you may use this file as part of a free software 00018 // library without restriction. Specifically, if other files instantiate 00019 // templates or use macros or inline functions from this file, or you compile 00020 // this file and link it with other files to produce an executable, this 00021 // file does not by itself cause the resulting executable to be covered by 00022 // the GNU General Public License. This exception does not however 00023 // invalidate any other reasons why the executable file might be covered by 00024 // the GNU General Public License. 00025 // 00026 // This exception applies only to the code released under the name GNU 00027 // ccRTP. If you copy code from other releases into a copy of GNU 00028 // ccRTP, as the General Public License permits, the exception does 00029 // not apply to the code that you add in this way. To avoid misleading 00030 // anyone as to the status of such modified files, you must delete 00031 // this exception notice from them. 00032 // 00033 // If you write modifications of your own for GNU ccRTP, it is your choice 00034 // whether to permit this exception to apply to your modifications. 00035 // If you do not wish that, delete this exception notice. 00036 // 00037 00038 #ifndef CCXX_RTP_FORMATS_H_ 00039 #define CCXX_RTP_FORMATS_H_ 00040 00041 NAMESPACE_COMMONCPP 00042 00063 typedef uint8 PayloadType; 00064 00066 const PayloadType ptINVALID = 128; 00067 00074 typedef enum { 00075 // Types for audio formats: 00076 sptPCMU = 0, 00077 firstStaticPayloadType = sptPCMU, 00078 // 1016 static payload type is now deprecated. Type 1 is reserved. 00079 // spt1016, ///< CELP audio (FED-STD 1016) (RFC 1890) 00080 sptG726_32 = 2, 00081 sptGSM, 00082 sptG723, 00083 sptDVI4_8000, 00084 sptDVI4_16000, 00085 sptLPC, 00086 sptPCMA, 00087 sptG722, 00088 sptL16_DUAL, 00089 sptL16_MONO, 00090 sptQCELP, 00091 // Type 13 is reserved. 00092 sptMPA = 14, 00093 sptG728, 00094 sptDVI4_11025, 00095 sptDVI4_22050, 00096 sptG729, 00097 // Type 19 is reserved. Types 20 - 23 are unassigned. 00098 lastStaticAudioPayloadType = sptG729, 00099 00100 // Types for video formats: 00101 // Type 24 is unassigned. 00102 sptCELB = 25, 00103 sptJPEG, 00104 // Type 27 is unassigned. 00105 sptNV = 28, 00106 // Types 29 and 30 are unassigned. 00107 sptH261 = 31, 00108 sptMPV, 00109 sptMP2T, 00110 sptH263, 00111 // Types 35 - 71 are unassigned. 00112 // Types 72 - 76 are reserved. 00113 // Types 96 - 127 are dynamic. 00114 lastStaticPayloadType = sptH263 00115 } StaticPayloadType; 00116 00130 class __EXPORT PayloadFormat 00131 { 00132 public: 00138 inline PayloadType getPayloadType() const 00139 { return payloadType; } 00140 00149 inline uint32 getRTPClockRate() const 00150 { return RTPClockRate; } 00151 00152 protected: 00156 PayloadFormat() 00157 { } 00158 00162 inline virtual ~PayloadFormat() 00163 { } 00164 00170 inline void setPayloadType(PayloadType pt) 00171 { payloadType = pt; } 00172 00178 inline void setRTPClockRate(uint32 rate) 00179 { RTPClockRate = rate; } 00180 00181 // default clock rate 00182 static const uint32 defaultRTPClockRate; 00183 00184 private: 00185 PayloadType payloadType; 00186 uint32 RTPClockRate; 00187 }; 00188 00201 class __EXPORT StaticPayloadFormat : public PayloadFormat 00202 { 00203 public: 00212 StaticPayloadFormat(StaticPayloadType type); 00213 00214 private: 00220 static uint32 staticAudioTypesRates[lastStaticAudioPayloadType - 00221 firstStaticPayloadType + 1]; 00222 }; 00223 00235 class __EXPORT DynamicPayloadFormat : public PayloadFormat 00236 { 00237 public: 00245 DynamicPayloadFormat(PayloadType type, uint32 rate); 00246 }; 00247 // payload 00249 00250 END_NAMESPACE 00251 00252 #endif // ndef CCXX_RTP_FORMATS_H_ 00253