mediafmt.h

Go to the documentation of this file.
00001 /*
00002  * mediafmt.h
00003  *
00004  * Media Format descriptions
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  * Formally known as the Open H323 project.
00008  *
00009  * Copyright (c) 2001 Equivalence Pty. Ltd.
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 H323 Library.
00022  *
00023  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00024  *
00025  * Contributor(s): ______________________________________.
00026  *
00027  * $Log: mediafmt.h,v $
00028  * Revision 2.37  2005/12/27 20:46:09  dsandras
00029  * Added clockRate to the media format. Added "AlwaysMerge" method for merging
00030  * media format options.
00031  *
00032  * Revision 2.36  2005/12/24 17:51:02  dsandras
00033  * Added clockRate parameter to allow wideband audio codecs.
00034  *
00035  * Revision 2.35  2005/11/30 13:35:26  csoutheren
00036  * Changed tags for Doxygen
00037  *
00038  * Revision 2.34  2005/09/13 20:48:22  dominance
00039  * minor cleanups needed to support mingw compilation. Thanks goes to Julien Puydt.
00040  *
00041  * Revision 2.33  2005/09/06 12:44:49  rjongbloed
00042  * Many fixes to finalise the video processing: merging remote media
00043  *
00044  * Revision 2.32  2005/08/31 13:19:25  rjongbloed
00045  * Added mechanism for controlling media (especially codecs) including
00046  *   changing the OpalMediaFormat option list (eg bit rate) and a completely
00047  *   new OpalMediaCommand abstraction for things like video fast update.
00048  *
00049  * Revision 2.31  2005/08/28 07:59:17  rjongbloed
00050  * Converted OpalTranscoder to use factory, requiring sme changes in making sure
00051  *   OpalMediaFormat instances are initialised before use.
00052  *
00053  * Revision 2.30  2005/08/24 02:07:56  dereksmithies
00054  * Put guard around a MSVC pragma, so GCC does not generate zillions of warnings.
00055  *
00056  * Revision 2.29  2005/08/22 01:26:25  shorne
00057  * Removed warning on numeric_limits on MSVC6
00058  *
00059  * Revision 2.28  2005/08/20 07:32:49  rjongbloed
00060  * Added video specific OpalMediaFormat
00061  *
00062  * Revision 2.27  2005/07/11 01:42:21  csoutheren
00063  * Fixed problems with some constants names not being available
00064  *
00065  * Revision 2.26  2005/06/20 16:47:52  shorne
00066  * Fix STL compatibility issue on MSVC6
00067  *
00068  * Revision 2.25  2005/06/02 13:20:45  rjongbloed
00069  * Added minimum and maximum check to media format options.
00070  * Added ability to set the options on the primordial media format list.
00071  *
00072  * Revision 2.24  2005/03/12 00:33:26  csoutheren
00073  * Fixed problems with STL compatibility on MSVC 6
00074  * Fixed problems with video streams
00075  * Thanks to Adrian Sietsma
00076  *
00077  * Revision 2.23  2005/02/21 12:19:47  rjongbloed
00078  * Added new "options list" to the OpalMediaFormat class.
00079  *
00080  * Revision 2.22  2004/07/11 12:32:51  rjongbloed
00081  * Added functions to add/subtract lists of media formats from a media format list
00082  *
00083  * Revision 2.21  2004/05/03 00:59:18  csoutheren
00084  * Fixed problem with OpalMediaFormat::GetMediaFormatsList
00085  * Added new version of OpalMediaFormat::GetMediaFormatsList that minimses copying
00086  *
00087  * Revision 2.20  2004/03/22 11:32:41  rjongbloed
00088  * Added new codec type for 16 bit Linear PCM as must distinguish between the internal
00089  *   format used by such things as the sound card and the RTP payload format which
00090  *   is always big endian.
00091  *
00092  * Revision 2.19  2004/03/11 06:54:27  csoutheren
00093  * Added ability to disable SIP or H.323 stacks
00094  *
00095  * Revision 2.18  2004/02/07 02:18:18  rjongbloed
00096  * Improved searching for media format to use payload type AND the encoding name.
00097  *
00098  * Revision 2.17  2003/03/17 10:12:02  robertj
00099  * Fixed mutex problem with media format database.
00100  *
00101  * Revision 2.16  2003/01/07 04:39:53  robertj
00102  * Updated to OpenH323 v1.11.2
00103  *
00104  * Revision 2.15  2002/11/10 11:33:17  robertj
00105  * Updated to OpenH323 v1.10.3
00106  *
00107  * Revision 2.14  2002/09/16 02:52:35  robertj
00108  * Added #define so can select if #pragma interface/implementation is used on
00109  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00110  *
00111  * Revision 2.13  2002/09/04 06:01:47  robertj
00112  * Updated to OpenH323 v1.9.6
00113  *
00114  * Revision 2.12  2002/07/01 04:56:31  robertj
00115  * Updated to OpenH323 v1.9.1
00116  *
00117  * Revision 2.11  2002/03/22 06:57:49  robertj
00118  * Updated to OpenH323 version 1.8.2
00119  *
00120  * Revision 2.10  2002/02/19 07:36:28  robertj
00121  * Added OpalRFC2833 as a OpalMediaFormat variable.
00122  *
00123  * Revision 2.9  2002/02/11 09:32:12  robertj
00124  * Updated to openH323 v1.8.0
00125  *
00126  * Revision 2.8  2002/01/22 05:06:30  robertj
00127  * Added RTP encoding name string to media format database.
00128  * Changed time units to clock rate in Hz.
00129  *
00130  * Revision 2.7  2002/01/14 06:35:57  robertj
00131  * Updated to OpenH323 v1.7.9
00132  *
00133  * Revision 2.6  2001/10/05 00:22:13  robertj
00134  * Updated to PWLib 1.2.0 and OpenH323 1.7.0
00135  *
00136  * Revision 2.5  2001/10/04 00:42:12  robertj
00137  * Added function to remove wildcard from list.
00138  * Added constructor to make a list with one format in it.
00139  *
00140  * Revision 2.4  2001/08/23 05:51:17  robertj
00141  * Completed implementation of codec reordering.
00142  *
00143  * Revision 2.3  2001/08/22 03:51:31  robertj
00144  * Added functions to look up media format by payload type.
00145  *
00146  * Revision 2.2  2001/08/17 08:23:02  robertj
00147  * Put in missing dots in G.729 media formats.
00148  *
00149  * Revision 2.1  2001/08/01 05:51:39  robertj
00150  * Made OpalMediaFormatList class global to help with documentation.
00151  *
00152  * Revision 2.0  2001/07/27 15:48:24  robertj
00153  * Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
00154  *
00155  * Revision 1.13  2002/12/02 03:06:26  robertj
00156  * Fixed over zealous removal of code when NO_AUDIO_CODECS set.
00157  *
00158  * Revision 1.12  2002/09/16 01:14:15  robertj
00159  * Added #define so can select if #pragma interface/implementation is used on
00160  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00161  *
00162  * Revision 1.11  2002/09/03 06:19:37  robertj
00163  * Normalised the multi-include header prevention ifdef/define symbol.
00164  *
00165  * Revision 1.10  2002/08/05 10:03:47  robertj
00166  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00167  *
00168  * Revision 1.9  2002/06/25 08:30:08  robertj
00169  * Changes to differentiate between stright G.723.1 and G.723.1 Annex A using
00170  *   the OLC dataType silenceSuppression field so does not send SID frames
00171  *   to receiver codecs that do not understand them.
00172  *
00173  * Revision 1.8  2002/03/21 02:39:15  robertj
00174  * Added backward compatibility define
00175  *
00176  * Revision 1.7  2002/02/11 04:15:56  robertj
00177  * Put G.723.1 at 6.3kbps back to old string value of "G.723.1" to improve
00178  *   backward compatibility. New #define is a synonym for it.
00179  *
00180  * Revision 1.6  2002/01/22 07:08:26  robertj
00181  * Added IllegalPayloadType enum as need marker for none set
00182  *   and MaxPayloadType is a legal value.
00183  *
00184  * Revision 1.5  2001/12/11 04:27:50  craigs
00185  * Added support for 5.3kbps G723.1
00186  *
00187  * Revision 1.4  2001/09/21 02:49:44  robertj
00188  * Implemented static object for all "known" media formats.
00189  * Added default session ID to media format description.
00190  *
00191  * Revision 1.3  2001/05/11 04:43:41  robertj
00192  * Added variable names for standard PCM-16 media format name.
00193  *
00194  * Revision 1.2  2001/02/09 05:16:24  robertj
00195  * Added #pragma interface for GNU C++.
00196  *
00197  * Revision 1.1  2001/01/25 07:27:14  robertj
00198  * Major changes to add more flexible OpalMediaFormat class to normalise
00199  *   all information about media types, especially codecs.
00200  *
00201  */
00202 
00203 #ifndef __OPAL_MEDIAFMT_H
00204 #define __OPAL_MEDIAFMT_H
00205 
00206 #ifdef P_USE_PRAGMA
00207 #pragma interface
00208 #endif
00209 
00210 #ifdef _MSC_VER
00211 #if _MSC_VER < 1300   
00212 #pragma warning(disable:4663)
00213 #endif
00214 #endif
00215 
00216 #include <opal/buildopts.h>
00217 
00218 #include <rtp/rtp.h>
00219 
00220 #include <limits>
00221 
00222 #ifdef min
00223 #undef min
00224 #endif
00225 #ifdef max
00226 #undef max
00227 #endif
00228 
00229 class OpalMediaFormat;
00230 
00231 
00233 
00234 PLIST(OpalMediaFormatBaseList, OpalMediaFormat);
00235 
00238 class OpalMediaFormatList : public OpalMediaFormatBaseList
00239 {
00240     PCLASSINFO(OpalMediaFormatList, OpalMediaFormatBaseList);
00241   public:
00246     OpalMediaFormatList();
00247 
00250     OpalMediaFormatList(
00251       const OpalMediaFormat & format    
00252     );
00253 
00256     OpalMediaFormatList(const OpalMediaFormatList & l) : OpalMediaFormatBaseList(l) { }
00258 
00264     OpalMediaFormatList & operator+=(
00265       const OpalMediaFormat & format    
00266     );
00267 
00271     OpalMediaFormatList & operator+=(
00272       const OpalMediaFormatList & formats    
00273     );
00274 
00278     OpalMediaFormatList & operator-=(
00279       const OpalMediaFormat & format    
00280     );
00281 
00285     OpalMediaFormatList & operator-=(
00286       const OpalMediaFormatList & formats    
00287     );
00288 
00293     PINDEX FindFormat(
00294       RTP_DataFrame::PayloadTypes rtpPayloadType, 
00295       const unsigned clockRate,                   
00296       const char * rtpEncodingName = NULL         
00297     ) const;
00298 
00306     PINDEX FindFormat(
00307       const PString & wildcard    
00308     ) const;
00309 
00312     BOOL HasFormat(
00313       RTP_DataFrame::PayloadTypes rtpPayloadType 
00314     ) const { return FindFormat(rtpPayloadType) != P_MAX_INDEX; }
00315 
00321     BOOL HasFormat(
00322       const PString & wildcard    
00323     ) const { return FindFormat(wildcard) != P_MAX_INDEX; }
00324 
00327     void Remove(
00328       const PStringArray & mask
00329     );
00330 
00335     void Reorder(
00336       const PStringArray & order
00337     );
00339 
00340   private:
00341     virtual PINDEX Append(PObject *) { return P_MAX_INDEX; }
00342     virtual PINDEX Insert(const PObject &, PObject *) { return P_MAX_INDEX; }
00343     virtual PINDEX InsertAt(PINDEX, PObject *) { return P_MAX_INDEX; }
00344     virtual BOOL SetAt(PINDEX, PObject *) { return FALSE; }
00345 };
00346 
00347 
00349 
00352 class OpalMediaOption : public PObject
00353 {
00354     PCLASSINFO(OpalMediaOption, PObject);
00355   public:
00356     enum MergeType {
00357       NoMerge,
00358       MinMerge,
00359       MaxMerge,
00360       EqualMerge,
00361       NotEqualMerge,
00362       AlwaysMerge,
00363 
00364       // Synonyms
00365       AndMerge = MaxMerge,
00366       OrMerge  = MinMerge,
00367       XorMerge = NotEqualMerge,
00368       NotXorMerge = EqualMerge
00369     };
00370 
00371   protected:
00372     OpalMediaOption(
00373       const char * name,
00374       bool readOnly,
00375       MergeType merge
00376     );
00377 
00378   public:
00379     virtual Comparison Compare(const PObject & obj) const;
00380 
00381     bool Merge(
00382       const OpalMediaOption & option
00383     );
00384     virtual Comparison CompareValue(
00385       const OpalMediaOption & option
00386     ) const = 0;
00387     virtual void Assign(
00388       const OpalMediaOption & option
00389     ) = 0;
00390 
00391     PString AsString() const;
00392     bool FromString(const PString & value);
00393 
00394     const PString & GetName() const { return m_name; }
00395 
00396     bool IsReadOnly() const { return m_readOnly; }
00397     void SetReadOnly(bool readOnly) { m_readOnly = readOnly; }
00398 
00399     MergeType GetMerge() const { return m_merge; }
00400     void SetMerge(MergeType merge) { m_merge = merge; }
00401 
00402   protected:
00403     PString   m_name;
00404     bool      m_readOnly;
00405     MergeType m_merge;
00406 };
00407 
00408 #ifndef __USE_STL__
00409 __inline istream & operator>>(istream & strm, bool& b)
00410 {
00411    int i;strm >> i;b = i; return strm;
00412 }
00413 #endif
00414 
00415 template <typename T>
00416 class OpalMediaOptionValue : public OpalMediaOption
00417 {
00418     PCLASSINFO(OpalMediaOptionValue, OpalMediaOption);
00419   public:
00420     OpalMediaOptionValue(
00421       const char * name,
00422       bool readOnly,
00423       MergeType merge = MinMerge,
00424       T value = 0,
00425       T minimum = std::numeric_limits<T>::min(),
00426       T maximum = std::numeric_limits<T>::max()
00427     ) : OpalMediaOption(name, readOnly, merge),
00428         m_value(value),
00429         m_minimum(minimum),
00430         m_maximum(maximum)
00431     { }
00432 
00433     virtual PObject * Clone() const
00434     {
00435       return new OpalMediaOptionValue(*this);
00436     }
00437 
00438     virtual void PrintOn(ostream & strm) const
00439     {
00440       strm << m_value;
00441     }
00442 
00443     virtual void ReadFrom(istream & strm)
00444     {
00445       T temp;
00446       strm >> temp;
00447       if (temp >= m_minimum && temp <= m_maximum)
00448         m_value = temp;
00449       else {
00450 #ifdef __USE_STL__
00451            strm.setstate(ios::badbit);
00452 #else
00453            strm.setf(ios::badbit , ios::badbit);
00454 #endif
00455        }
00456     }
00457 
00458     virtual Comparison CompareValue(const OpalMediaOption & option) const {
00459       const OpalMediaOptionValue * otherOption = PDownCast(const OpalMediaOptionValue, &option);
00460       if (otherOption == NULL)
00461         return GreaterThan;
00462       if (m_value < otherOption->m_value)
00463         return LessThan;
00464       if (m_value > otherOption->m_value)
00465         return GreaterThan;
00466       return EqualTo;
00467     }
00468 
00469     virtual void Assign(
00470       const OpalMediaOption & option
00471     ) {
00472       const OpalMediaOptionValue * otherOption = PDownCast(const OpalMediaOptionValue, &option);
00473       if (otherOption != NULL)
00474         m_value = otherOption->m_value;
00475     }
00476 
00477     T GetValue() const { return m_value; }
00478     void SetValue(T value) { m_value = value; }
00479 
00480   protected:
00481     T m_value;
00482     T m_minimum;
00483     T m_maximum;
00484 };
00485 
00486 
00487 typedef OpalMediaOptionValue<bool>   OpalMediaOptionBoolean;
00488 typedef OpalMediaOptionValue<int>    OpalMediaOptionInteger;
00489 typedef OpalMediaOptionValue<double> OpalMediaOptionReal;
00490 
00491 
00492 class OpalMediaOptionEnum : public OpalMediaOption
00493 {
00494     PCLASSINFO(OpalMediaOptionEnum, OpalMediaOption);
00495   public:
00496     OpalMediaOptionEnum(
00497       const char * name,
00498       bool readOnly,
00499       const char * const * enumerations,
00500       PINDEX count,
00501       MergeType merge = EqualMerge,
00502       PINDEX value = 0
00503     );
00504 
00505     virtual PObject * Clone() const;
00506     virtual void PrintOn(ostream & strm) const;
00507     virtual void ReadFrom(istream & strm);
00508 
00509     virtual Comparison CompareValue(const OpalMediaOption & option) const;
00510     virtual void Assign(const OpalMediaOption & option);
00511 
00512     PINDEX GetValue() const { return m_value; }
00513     void SetValue(PINDEX value);
00514 
00515   protected:
00516     PStringArray m_enumerations;
00517     PINDEX       m_value;
00518 };
00519 
00520 
00521 class OpalMediaOptionString : public OpalMediaOption
00522 {
00523     PCLASSINFO(OpalMediaOptionString, OpalMediaOption);
00524   public:
00525     OpalMediaOptionString(
00526       const char * name,
00527       bool readOnly
00528     );
00529     OpalMediaOptionString(
00530       const char * name,
00531       bool readOnly,
00532       const PString & value
00533     );
00534 
00535     virtual PObject * Clone() const;
00536     virtual void PrintOn(ostream & strm) const;
00537     virtual void ReadFrom(istream & strm);
00538 
00539     virtual Comparison CompareValue(const OpalMediaOption & option) const;
00540     virtual void Assign(const OpalMediaOption & option);
00541 
00542     const PString & GetValue() const { return m_value; }
00543     void SetValue(const PString & value);
00544 
00545   protected:
00546     PString m_value;
00547 };
00548 
00549 
00551 
00559 class OpalMediaFormat : public PCaselessString
00560 {
00561   PCLASSINFO(OpalMediaFormat, PCaselessString);
00562 
00563   public:
00566     OpalMediaFormat();
00567 
00581     OpalMediaFormat(
00582       const char * fullName,  
00583       unsigned defaultSessionID,  
00584       RTP_DataFrame::PayloadTypes rtpPayloadType, 
00585       const char * encodingName, 
00586       BOOL     needsJitter,   
00587       unsigned bandwidth,     
00588       PINDEX   frameSize, 
00589       unsigned frameTime, 
00590       unsigned clockRate  
00591     );
00592 
00602     OpalMediaFormat(
00603       RTP_DataFrame::PayloadTypes rtpPayloadType, 
00604       unsigned clockRate,                         
00605       const char * rtpEncodingName = NULL         
00606     );
00607 
00621     OpalMediaFormat(
00622       const char * wildcard  
00623     );
00624 
00638     OpalMediaFormat(
00639       const PString & wildcard  
00640     );
00641 
00645     OpalMediaFormat & operator=(
00646       RTP_DataFrame::PayloadTypes rtpPayloadType 
00647     );
00648 
00652     OpalMediaFormat & operator=(
00653       const char * wildcard  
00654     );
00655 
00659     OpalMediaFormat & operator=(
00660       const PString & wildcard  
00661     );
00662 
00673     virtual bool Merge(
00674       const OpalMediaFormat & mediaFormat
00675     );
00676 
00682     RTP_DataFrame::PayloadTypes GetPayloadType() const { return rtpPayloadType; }
00683 
00686     const char * GetEncodingName() const { return rtpEncodingName; }
00687 
00688     enum {
00689       DefaultAudioSessionID = 1,
00690       DefaultVideoSessionID = 2,
00691       DefaultDataSessionID  = 3
00692     };
00693 
00696     unsigned GetDefaultSessionID() const { return defaultSessionID; }
00697 
00701     bool NeedsJitterBuffer() const { return GetOptionBoolean(NeedsJitterOption); }
00702     static const char * const NeedsJitterOption;
00703 
00706     unsigned GetBandwidth() const { return GetOptionInteger(MaxBitRateOption); }
00707     static const char * const MaxBitRateOption;
00708 
00713     PINDEX GetFrameSize() const { return GetOptionInteger(MaxFrameSizeOption); }
00714     static const char * const MaxFrameSizeOption;
00715 
00719     unsigned GetFrameTime() const { return GetOptionInteger(FrameTimeOption); }
00720     static const char * const FrameTimeOption;
00721 
00724     unsigned GetTimeUnits() const { return GetClockRate()/1000; }
00725 
00726     enum StandardClockRate {
00727       AudioClockRate = 8000,  
00728       VideoClockRate = 90000  
00729     };
00730 
00733     unsigned GetClockRate() const { return GetOptionInteger(ClockRateOption); }
00734     static const char * const ClockRateOption;
00735 
00738     PINDEX GetOptionCount() const { return options.GetSize(); }
00739 
00743     const OpalMediaOption & GetOption(
00744       PINDEX index   
00745     ) { return options[index]; }
00746 
00751     bool GetOptionValue(
00752       const PString & name,   
00753       PString & value         
00754     ) const;
00755 
00762     bool SetOptionValue(
00763       const PString & name,   
00764       const PString & value   
00765     );
00766 
00770     bool GetOptionBoolean(
00771       const PString & name,   
00772       bool dflt = FALSE       
00773     ) const;
00774 
00781     bool SetOptionBoolean(
00782       const PString & name,   
00783       bool value              
00784     );
00785 
00789     int GetOptionInteger(
00790       const PString & name,   
00791       int dflt = 0            
00792     ) const;
00793 
00801     bool SetOptionInteger(
00802       const PString & name,   
00803       int value               
00804     );
00805 
00809     double GetOptionReal(
00810       const PString & name,   
00811       double dflt = 0         
00812     ) const;
00813 
00820     bool SetOptionReal(
00821       const PString & name,   
00822       double value            
00823     );
00824 
00829     PINDEX GetOptionEnum(
00830       const PString & name,   
00831       PINDEX dflt = 0         
00832     ) const;
00833 
00840     bool SetOptionEnum(
00841       const PString & name,   
00842       PINDEX value            
00843     );
00844 
00848     PString GetOptionString(
00849       const PString & name,                   
00850       const PString & dflt = PString::Empty() 
00851     ) const;
00852 
00859     bool SetOptionString(
00860       const PString & name,   
00861       const PString & value   
00862     );
00863 
00866     static OpalMediaFormatList GetAllRegisteredMediaFormats();
00867     static void GetAllRegisteredMediaFormats(
00868       OpalMediaFormatList & copy    
00869     );
00870 
00874     static bool SetRegisteredMediaFormat(
00875       const OpalMediaFormat & mediaFormat  
00876     );
00877 
00878   protected:
00879     bool AddOption(
00880       OpalMediaOption * option
00881     );
00882 
00883     OpalMediaOption * FindOption(
00884       const PString & name
00885     ) const;
00886 
00887     RTP_DataFrame::PayloadTypes  rtpPayloadType;
00888     const char *                 rtpEncodingName;
00889     unsigned                     defaultSessionID;
00890     PSortedList<OpalMediaOption> options;
00891 
00892   friend class OpalMediaFormatList;
00893 };
00894 
00895 
00896 // A pair of macros to simplify cration of OpalMediFormat instances.
00897 
00898 #define OPAL_MEDIA_FORMAT(name, fullName, defaultSessionID, rtpPayloadType, encodingName, needsJitter, bandwidth, frameSize, frameTime, timeUnits) \
00899 const class name##_Class : public OpalMediaFormat \
00900 { \
00901   public: \
00902     name##_Class(); \
00903 } name; \
00904 name##_Class::name##_Class() \
00905       : OpalMediaFormat(fullName, defaultSessionID, rtpPayloadType, encodingName, needsJitter, bandwidth, frameSize, frameTime, timeUnits) \
00906 
00907 
00908 class OpalAudioFormat : public OpalMediaFormat
00909 {
00910     PCLASSINFO(OpalAudioFormat, OpalMediaFormat);
00911   public:
00912     OpalAudioFormat(
00913       const char * fullName,    
00914       RTP_DataFrame::PayloadTypes rtpPayloadType, 
00915       const char * encodingName,
00916       PINDEX   frameSize,       
00917       unsigned frameTime,       
00918       unsigned rxFrames,        
00919       unsigned txFrames,        
00920       unsigned maxFrames = 256, 
00921       unsigned clockRate = 8000 
00922     );
00923 
00924     static const char * const RxFramesPerPacketOption;
00925     static const char * const TxFramesPerPacketOption;
00926 };
00927 
00928 
00929 class OpalVideoFormat : public OpalMediaFormat
00930 {
00931     PCLASSINFO(OpalVideoFormat, OpalMediaFormat);
00932   public:
00933     OpalVideoFormat(
00934       const char * fullName,    
00935       RTP_DataFrame::PayloadTypes rtpPayloadType, 
00936       const char * encodingName,
00937       unsigned frameWidth,      
00938       unsigned frameHeight,     
00939       unsigned frameRate,       
00940       unsigned bitRate          
00941     );
00942 
00943     virtual bool Merge(const OpalMediaFormat & mediaFormat);
00944 
00945     static const char * const FrameWidthOption;
00946     static const char * const FrameHeightOption;
00947     static const char * const EncodingQualityOption;
00948     static const char * const TargetBitRateOption;
00949     static const char * const DynamicVideoQualityOption;
00950     static const char * const AdaptivePacketDelayOption;
00951 };
00952 
00953 
00954 // List of known media formats
00955 
00956 #define OPAL_PCM16          "PCM-16"
00957 #define OPAL_L16_MONO_8KHZ  "Linear-16-Mono-8kHz"
00958 #define OPAL_L16_MONO_16KHZ "Linear-16-Mono-16kHz"
00959 #define OPAL_G711_ULAW_64K  "G.711-uLaw-64k"
00960 #define OPAL_G711_ALAW_64K  "G.711-ALaw-64k"
00961 #define OPAL_G728           "G.728"
00962 #define OPAL_G729           "G.729"
00963 #define OPAL_G729A          "G.729A"
00964 #define OPAL_G729B          "G.729B"
00965 #define OPAL_G729AB         "G.729A/B"
00966 #define OPAL_G7231          "G.723.1"
00967 #define OPAL_G7231_6k3      OPAL_G7231
00968 #define OPAL_G7231_5k3      "G.723.1(5.3k)"
00969 #define OPAL_G7231A_6k3     "G.723.1A(6.3k)"
00970 #define OPAL_G7231A_5k3     "G.723.1A(5.3k)"
00971 #define OPAL_GSM0610        "GSM-06.10"
00972 #define OPAL_RFC2833        "UserInput/RFC2833"
00973 
00974 extern const OpalAudioFormat & GetOpalPCM16();
00975 extern const OpalAudioFormat & GetOpalL16_MONO_8KHZ();
00976 extern const OpalAudioFormat & GetOpalL16_MONO_16KHZ();
00977 extern const OpalAudioFormat & GetOpalG711_ULAW_64K();
00978 extern const OpalAudioFormat & GetOpalG711_ALAW_64K();
00979 extern const OpalAudioFormat & GetOpalG728();
00980 extern const OpalAudioFormat & GetOpalG729();
00981 extern const OpalAudioFormat & GetOpalG729A();
00982 extern const OpalAudioFormat & GetOpalG729B();
00983 extern const OpalAudioFormat & GetOpalG729AB();
00984 extern const OpalAudioFormat & GetOpalG7231_6k3();
00985 extern const OpalAudioFormat & GetOpalG7231_5k3();
00986 extern const OpalAudioFormat & GetOpalG7231A_6k3();
00987 extern const OpalAudioFormat & GetOpalG7231A_5k3();
00988 extern const OpalAudioFormat & GetOpalGSM0610();
00989 extern const OpalMediaFormat & GetOpalRFC2833();
00990 
00991 #define OpalPCM16          GetOpalPCM16()
00992 #define OpalL16_MONO_8KHZ  GetOpalL16_MONO_8KHZ()
00993 #define OpalL16_MONO_16KHZ GetOpalL16_MONO_16KHZ()
00994 #define OpalG711_ULAW_64K  GetOpalG711_ULAW_64K()
00995 #define OpalG711_ALAW_64K  GetOpalG711_ALAW_64K()
00996 #define OpalG728           GetOpalG728()
00997 #define OpalG729           GetOpalG729()
00998 #define OpalG729A          GetOpalG729A()
00999 #define OpalG729B          GetOpalG729B()
01000 #define OpalG729AB         GetOpalG729AB()
01001 #define OpalG7231_6k3      GetOpalG7231_6k3()
01002 #define OpalG7231_5k3      GetOpalG7231_5k3()
01003 #define OpalG7231A_6k3     GetOpalG7231A_6k3()
01004 #define OpalG7231A_5k3     GetOpalG7231A_5k3()
01005 #define OpalGSM0610        GetOpalGSM0610()
01006 #define OpalRFC2833        GetOpalRFC2833()
01007 
01008 #define OpalL16Mono8kHz    OpalL16_MONO_8KHZ
01009 #define OpalL16Mono16kHz   OpalL16_MONO_16KHZ
01010 #define OpalG711uLaw       OpalG711_ULAW_64K
01011 #define OpalG711ALaw       OpalG711_ALAW_64K
01012 
01013 #ifdef _MSC_VER
01014 #if _MSC_VER < 1300
01015 #pragma warning(default:4663)
01016 #endif
01017 #endif
01018 
01019 #endif  // __OPAL_MEDIAFMT_H
01020 
01021 
01022 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Sep 25 16:20:09 2006 for OPAL by  doxygen 1.4.7