ccRTP
|
00001 // Copyright (C) 2002-2015 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 Lesser General Public License 00014 // along with GNU ccRTP. If not, see <http://www.gnu.org/licenses/>. 00015 // 00016 // As a special exception, you may use this file as part of a free software 00017 // library without restriction. Specifically, if other files instantiate 00018 // templates or use macros or inline functions from this file, or you compile 00019 // this file and link it with other files to produce an executable, this 00020 // file does not by itself cause the resulting executable to be covered by 00021 // the GNU General Public License. This exception does not however 00022 // invalidate any other reasons why the executable file might be covered by 00023 // the GNU General Public License. 00024 // 00025 // This exception applies only to the code released under the name GNU 00026 // ccRTP. If you copy code from other releases into a copy of GNU 00027 // ccRTP, as the General Public License permits, the exception does 00028 // not apply to the code that you add in this way. To avoid misleading 00029 // anyone as to the status of such modified files, you must delete 00030 // this exception notice from them. 00031 // 00032 // If you write modifications of your own for GNU ccRTP, it is your choice 00033 // whether to permit this exception to apply to your modifications. 00034 // If you do not wish that, delete this exception notice. 00035 // 00036 00037 #ifndef CCXX_RTP_FORMATS_H_ 00038 #define CCXX_RTP_FORMATS_H_ 00039 00040 NAMESPACE_COMMONCPP 00041 00062 typedef uint8 PayloadType; 00063 00065 const PayloadType ptINVALID = 128; 00066 00073 typedef enum { 00074 // Types for audio formats: 00075 sptPCMU = 0, 00076 firstStaticPayloadType = sptPCMU, 00077 // 1016 static payload type is now deprecated. Type 1 is reserved. 00078 // spt1016, ///< CELP audio (FED-STD 1016) (RFC 1890) 00079 sptG726_32 = 2, 00080 sptGSM, 00081 sptG723, 00082 sptDVI4_8000, 00083 sptDVI4_16000, 00084 sptLPC, 00085 sptPCMA, 00086 sptG722, 00087 sptL16_DUAL, 00088 sptL16_MONO, 00089 sptQCELP, 00090 // Type 13 is reserved. 00091 sptMPA = 14, 00092 sptG728, 00093 sptDVI4_11025, 00094 sptDVI4_22050, 00095 sptG729, 00096 // Type 19 is reserved. Types 20 - 23 are unassigned. 00097 lastStaticAudioPayloadType = sptG729, 00098 00099 // Types for video formats: 00100 // Type 24 is unassigned. 00101 sptCELB = 25, 00102 sptJPEG, 00103 // Type 27 is unassigned. 00104 sptNV = 28, 00105 // Types 29 and 30 are unassigned. 00106 sptH261 = 31, 00107 sptMPV, 00108 sptMP2T, 00109 sptH263, 00110 // Types 35 - 71 are unassigned. 00111 // Types 72 - 76 are reserved. 00112 // Types 96 - 127 are dynamic. 00113 lastStaticPayloadType = sptH263 00114 } StaticPayloadType; 00115 00129 class __EXPORT PayloadFormat 00130 { 00131 public: 00137 inline PayloadType getPayloadType() const 00138 { return payloadType; } 00139 00148 inline uint32 getRTPClockRate() const 00149 { return RTPClockRate; } 00150 00151 protected: 00155 PayloadFormat() 00156 { } 00157 00161 inline virtual ~PayloadFormat() 00162 { } 00163 00169 inline void setPayloadType(PayloadType pt) 00170 { payloadType = pt; } 00171 00177 inline void setRTPClockRate(uint32 rate) 00178 { RTPClockRate = rate; } 00179 00180 // default clock rate 00181 static const uint32 defaultRTPClockRate; 00182 00183 private: 00184 PayloadType payloadType; 00185 uint32 RTPClockRate; 00186 }; 00187 00200 class __EXPORT StaticPayloadFormat : public PayloadFormat 00201 { 00202 public: 00211 StaticPayloadFormat(StaticPayloadType type); 00212 00213 private: 00219 static uint32 staticAudioTypesRates[lastStaticAudioPayloadType - 00220 firstStaticPayloadType + 1]; 00221 }; 00222 00234 class __EXPORT DynamicPayloadFormat : public PayloadFormat 00235 { 00236 public: 00244 DynamicPayloadFormat(PayloadType type, uint32 rate); 00245 }; 00246 // payload 00248 00249 END_NAMESPACE 00250 00251 #endif // ndef CCXX_RTP_FORMATS_H_ 00252