- Main Page
- Modules
- Classes
- Files
- Examples

- File List
- File Members

# formats.h

Go to the documentation of this file.

    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 #ifdef CCXX_NAMESPACES
    00042 namespace ost {
    00043 #endif
    00044
    00065 typedef uint8 PayloadType;
    00066
    00068 const PayloadType ptINVALID = 128;
    00069
    00076 typedef enum {
    00077         // Types for audio formats:
    00078         sptPCMU = 0,
    00079         firstStaticPayloadType = sptPCMU,
    00080         // 1016 static payload type is now deprecated. Type 1 is reserved.
    00081         // spt1016,         ///< CELP audio (FED-STD 1016) (RFC 1890)
    00082         sptG726_32 = 2,
    00083         sptGSM,
    00084         sptG723,
    00085         sptDVI4_8000,
    00086         sptDVI4_16000,
    00087         sptLPC,
    00088         sptPCMA,
    00089         sptG722,
    00090         sptL16_DUAL,
    00091         sptL16_MONO,
    00092         sptQCELP,
    00093         // Type 13 is reserved.
    00094         sptMPA = 14,
    00095         sptG728,
    00096         sptDVI4_11025,
    00097         sptDVI4_22050,
    00098         sptG729,
    00099         // Type 19 is reserved. Types 20 - 23 are unassigned.
    00100         lastStaticAudioPayloadType = sptG729,
    00101
    00102         // Types for video formats:
    00103         // Type 24 is unassigned.
    00104         sptCELB = 25,
    00105         sptJPEG,
    00106         // Type 27 is unassigned.
    00107         sptNV = 28,
    00108         // Types 29 and 30 are unassigned.
    00109         sptH261 = 31,
    00110         sptMPV,
    00111         sptMP2T,
    00112         sptH263,
    00113         // Types 35 - 71 are unassigned.
    00114         // Types 72 - 76 are reserved.
    00115         // Types 96 - 127 are dynamic.
    00116         lastStaticPayloadType = sptH263
    00117 }       StaticPayloadType;
    00118
    00132 class __EXPORT PayloadFormat
    00133 {
    00134 public:
    00140         inline PayloadType getPayloadType() const
    00141         { return payloadType; }
    00142
    00151         inline uint32 getRTPClockRate() const
    00152         { return RTPClockRate; }
    00153
    00154 protected:
    00158         PayloadFormat()
    00159         { }
    00160
    00164         inline virtual ~PayloadFormat()
    00165         { }
    00166
    00172         inline void setPayloadType(PayloadType pt)
    00173         { payloadType = pt; }
    00174
    00180         inline void setRTPClockRate(uint32 rate)
    00181         { RTPClockRate = rate; }
    00182
    00183         // default clock rate
    00184         static const uint32 defaultRTPClockRate;
    00185
    00186 private:
    00187         PayloadType payloadType;
    00188         uint32 RTPClockRate;
    00189 };
    00190
    00203 class __EXPORT StaticPayloadFormat : public PayloadFormat
    00204 {
    00205 public:
    00214         StaticPayloadFormat(StaticPayloadType type);
    00215
    00216 private:
    00222         static uint32 staticAudioTypesRates[lastStaticAudioPayloadType -
    00223                                             firstStaticPayloadType + 1];
    00224 };
    00225
    00237 class __EXPORT DynamicPayloadFormat : public PayloadFormat
    00238 {
    00239 public:
    00247         DynamicPayloadFormat(PayloadType type, uint32 rate);
    00248 };
    00249  // payload
    00251
    00252 #ifdef  CCXX_NAMESPACES
    00253 }
    00254 #endif
    00255
    00256 #endif  // ndef CCXX_RTP_FORMATS_H_
    00257