mscodecs.h

Go to the documentation of this file.
00001 /*
00002  * mscodecs.h
00003  *
00004  * Microsoft nonstandard codecs handler
00005  *
00006  * Open H323 Library
00007  *
00008  * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Open H323 Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * Contributor(s): ______________________________________.
00025  *
00026  * $Log: mscodecs.h,v $
00027  * Revision 2.10  2005/12/15 21:15:44  dsandras
00028  * Fixed compilation with gcc 4.1.
00029  *
00030  * Revision 2.9  2005/08/28 07:59:17  rjongbloed
00031  * Converted OpalTranscoder to use factory, requiring sme changes in making sure
00032  *   OpalMediaFormat instances are initialised before use.
00033  *
00034  * Revision 2.8  2005/02/21 12:19:45  rjongbloed
00035  * Added new "options list" to the OpalMediaFormat class.
00036  *
00037  * Revision 2.7  2004/03/11 06:54:26  csoutheren
00038  * Added ability to disable SIP or H.323 stacks
00039  *
00040  * Revision 2.6  2002/11/10 23:22:06  robertj
00041  * Cosmetic change
00042  *
00043  * Revision 2.5  2002/11/10 11:33:16  robertj
00044  * Updated to OpenH323 v1.10.3
00045  *
00046  * Revision 2.4  2002/09/16 02:52:33  robertj
00047  * Added #define so can select if #pragma interface/implementation is used on
00048  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00049  *
00050  * Revision 2.3  2002/09/04 06:01:46  robertj
00051  * Updated to OpenH323 v1.9.6
00052  *
00053  * Revision 2.2  2001/11/02 10:45:19  robertj
00054  * Updated to OpenH323 v1.7.3
00055  *
00056  * Revision 2.1  2001/08/01 05:03:09  robertj
00057  * Changes to allow control of linking software transcoders, use macros
00058  *   to force linking.
00059  * Allowed codecs to be used without H.,323 being linked by using the
00060  *   new NO_H323 define.
00061  * Major changes to H.323 capabilities, uses OpalMediaFormat for base name.
00062  *
00063  * Revision 2.0  2001/07/27 15:48:24  robertj
00064  * Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
00065  *
00066  * Revision 1.11  2002/09/30 09:32:50  craigs
00067  * Removed ability to set no. of frames per packet for MS-GSM - there can be only one!
00068  *
00069  * Revision 1.10  2002/09/16 01:14:15  robertj
00070  * Added #define so can select if #pragma interface/implementation is used on
00071  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00072  *
00073  * Revision 1.9  2002/09/03 05:41:56  robertj
00074  * Normalised the multi-include header prevention ifdef/define symbol.
00075  * Added globally accessible functions for media format names.
00076  *
00077  * Revision 1.8  2002/08/05 10:03:47  robertj
00078  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00079  *
00080  * Revision 1.7  2001/10/24 01:20:34  robertj
00081  * Added code to help with static linking of H323Capability names database.
00082  *
00083  * Revision 1.6  2001/03/08 01:42:20  robertj
00084  * Cosmetic changes to recently added MS IMA ADPCM codec.
00085  *
00086  * Revision 1.5  2001/03/08 00:57:46  craigs
00087  * Added MS-IMA codec thanks to Liu Hao. Not yet working - do not use
00088  *
00089  * Revision 1.4  2001/02/09 05:16:24  robertj
00090  * Added #pragma interface for GNU C++.
00091  *
00092  * Revision 1.3  2001/01/25 07:27:14  robertj
00093  * Major changes to add more flexible OpalMediaFormat class to normalise
00094  *   all information about media types, especially codecs.
00095  *
00096  * Revision 1.2  2001/01/09 23:05:22  robertj
00097  * Fixed inability to have 2 non standard codecs in capability table.
00098  *
00099  * Revision 1.1  2000/08/23 14:23:11  craigs
00100  * Added prototype support for Microsoft GSM codec
00101  *
00102  *
00103  */
00104 
00105 #ifndef __OPAL_MSCODECS_H
00106 #define __OPAL_MSCODECS_H
00107 
00108 #ifdef P_USE_PRAGMA
00109 #pragma interface
00110 #endif
00111 
00112 #include <opal/buildopts.h>
00113 #include <codec/gsmcodec.h>
00114 
00115 #ifndef NO_H323
00116 #include <h323/h323caps.h>
00117 #endif
00118 
00119 
00120 #define OPAL_MSGSM "MS-GSM"
00121 #define OPAL_MSIMA "MS-IMA-ADPCM"
00122 
00123 extern const OpalAudioFormat & GetOpalMSGSM();
00124 extern const OpalAudioFormat & GetOpalMSIMA();
00125 
00126 #define OpalMSGSM GetOpalMSGSM()
00127 #define OpalMSIMA GetOpalMSIMA()
00128 
00129 
00131 
00132 #ifndef NO_H323
00133 
00134 class MicrosoftNonStandardAudioCapability : public H323NonStandardAudioCapability
00135 {
00136   PCLASSINFO(MicrosoftNonStandardAudioCapability, H323NonStandardAudioCapability);
00137 
00138   public:
00139     MicrosoftNonStandardAudioCapability(
00140       const BYTE * header,
00141       PINDEX headerSize,
00142       PINDEX offset,
00143       PINDEX len
00144     );
00145 };
00146 
00147 
00149 
00150 class MicrosoftGSMAudioCapability : public MicrosoftNonStandardAudioCapability
00151 {
00152   PCLASSINFO(MicrosoftGSMAudioCapability, MicrosoftNonStandardAudioCapability);
00153 
00154   public:
00155     MicrosoftGSMAudioCapability();
00156     PObject * Clone() const;
00157     PString GetFormatName() const;
00158     void SetTxFramesInPacket(unsigned /*frames*/);
00159 };
00160 
00161 
00163 
00164 class MicrosoftIMAAudioCapability : public MicrosoftNonStandardAudioCapability
00165 {
00166   PCLASSINFO(MicrosoftIMAAudioCapability, MicrosoftNonStandardAudioCapability);
00167 
00168   public:
00169     MicrosoftIMAAudioCapability();
00170     PObject * Clone() const;
00171     PString GetFormatName() const;
00172 };
00173 
00174 
00175 #ifdef H323_STATIC_LIB
00176 H323_STATIC_LOAD_REGISTER_CAPABILITY(MicrosoftGSMAudioCapability);
00177 H323_STATIC_LOAD_REGISTER_CAPABILITY(MicrosoftIMAAudioCapability);
00178 #endif
00179 
00180 
00181 #define OPAL_REGISTER_MSCODECS_H323 \
00182           H323_REGISTER_CAPABILITY(MicrosoftGSMAudioCapability, OPAL_MSGSM) \
00183           H323_REGISTER_CAPABILITY(MicrosoftIMAAudioCapability, OPAL_MSIMA)
00184 
00185 
00186 #else // ifndef NO_H323
00187 
00188 #define OPAL_REGISTER_MSCODECS_H323
00189 
00190 #endif // ifndef NO_H323
00191 
00192 
00194 
00195 class Opal_MSGSM_PCM : public Opal_GSM0610 {
00196   public:
00197     Opal_MSGSM_PCM();
00198     virtual BOOL ConvertFrame(const BYTE * src, BYTE * dst);
00199 };
00200 
00201 
00202 class Opal_PCM_MSGSM : public Opal_GSM0610 {
00203   public:
00204     Opal_PCM_MSGSM();
00205     virtual BOOL ConvertFrame(const BYTE * src, BYTE * dst);
00206 };
00207 
00208 
00210 
00211 class Opal_MSIMA_PCM : public OpalFramedTranscoder {
00212   public:
00213     Opal_MSIMA_PCM();
00214     virtual BOOL ConvertFrame(const BYTE * src, BYTE * dst);
00215 };
00216 
00217 
00218 struct adpcm_state {
00219   short valprev;        /* Previous output value */
00220   char  index;          /* Index into stepsize table */
00221 };
00222 
00223 class Opal_PCM_MSIMA : public OpalFramedTranscoder {
00224   public:
00225     Opal_PCM_MSIMA();
00226     virtual BOOL ConvertFrame(const BYTE * src, BYTE * dst);
00227   protected:
00228     adpcm_state s_adpcm;
00229 };
00230 
00231 
00233 
00234 #define OPAL_REGISTER_MSCODECS() \
00235           OPAL_REGISTER_MSCODECS_H323 \
00236           OPAL_REGISTER_TRANSCODER(Opal_MSGSM_PCM, OpalMSGSM, OpalPCM16); \
00237           OPAL_REGISTER_TRANSCODER(Opal_PCM_MSGSM, OpalPCM16, OpalMSGSM); \
00238           OPAL_REGISTER_TRANSCODER(Opal_MSIMA_PCM, OpalMSIMA, OpalPCM16); \
00239           OPAL_REGISTER_TRANSCODER(Opal_PCM_MSIMA, OpalPCM16, OpalMSIMA)
00240 
00241 
00242 #endif // __OPAL_MSCODECS_H
00243 
00244 

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