D:/Storage/CVS_Head/h323plus/include/codec/opalplugin.h

00001 /*
00002  * h323plugins.h
00003  *
00004  * H.323 codec plugins handler
00005  *
00006  * Open H323 Library
00007  *
00008  * Copyright (C) 2004 Post Increment
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 Post Increment
00023  *
00024  * Contributor(s): ______________________________________.
00025  *
00026  * $Log: opalplugin.h,v $
00027  * Revision 1.2  2007/10/19 19:53:43  shorne
00028  * ported latest Video updates in OpenH323 committed after h323plus initial fork thanks
00029  *  Robert
00030  *
00031  * Revision 1.1  2007/08/20 20:19:53  shorne
00032  * Moved opalplugin.h to codec directory to be plugin compile compatible with Opal
00033  *
00034  * Revision 1.2  2007/08/20 19:13:28  shorne
00035  * Added Generic Capability support. Fixed Linux compile errors
00036  *
00037  * Revision 1.1  2007/08/06 20:50:50  shorne
00038  * First commit of h323plus
00039  *
00040  * Revision 1.10.2.5  2007/09/26 05:14:28  rjongbloed
00041  * Added some extra RTP magic numbers: min header size, max packet size etc
00042  *
00043  * Revision 1.10.2.4  2007/08/17 08:38:22  rjongbloed
00044  * Back ported OPAL meda options based plug ins and H.323 generic capabilties.
00045  *
00046  * Revision 1.10.2.3  2007/02/19 20:12:45  shorne
00047  * added H.239 support
00048  *
00049  * Revision 1.10.2.2  2007/02/19 14:19:36  shorne
00050  * Added H.239 OIDs
00051  *
00052  * Revision 1.10.2.1  2006/12/23 19:08:02  shorne
00053  * Plugin video codecs & sundry
00054  *
00055  * Revision 1.10  2006/05/16 11:26:06  shorne
00056  * Added more hid key input mask types
00057  *
00058  * Revision 1.9  2005/11/21 21:04:10  shorne
00059  * Added more HID input switches
00060  *
00061  * Revision 1.8  2005/08/23 08:13:06  shorne
00062  * Added HID plugin volume & LCD display support
00063  *
00064  * Revision 1.7  2005/07/03 13:54:23  shorne
00065  * Added Initial LID Plugin Support
00066  *
00067  * Revision 1.6  2005/06/07 03:22:22  csoutheren
00068  * Added patch 1198741 with support for plugin codecs with generic capabilities
00069  * Added patch 1198754 with support for setting quality level on audio codecs
00070  * Added patch 1198760 with GSM-AMR codec support
00071  * Many thanks to Richard van der Hoff for his work
00072  *
00073  * Revision 1.5  2004/12/20 23:30:20  csoutheren
00074  * Added plugin support for packet loss concealment frames
00075  *
00076  * Revision 1.4  2004/11/29 06:30:53  csoutheren
00077  * Added support for wideband codecs
00078  *
00079  * Revision 1.3  2004/05/18 22:26:28  csoutheren
00080  * Initial support for embedded codecs
00081  * Fixed problems with streamed codec support
00082  * Updates for abstract factory loading methods
00083  *
00084  * Revision 1.2  2004/05/09 14:44:36  csoutheren
00085  * Added support for streamed plugin audio codecs
00086  *
00087  * Revision 1.1  2004/04/09 12:25:25  csoutheren
00088  * Renamed from h323plugin.h
00089  *
00090  * Revision 1.2  2004/04/03 10:38:24  csoutheren
00091  * Added in initial cut at codec plugin code. Branches are for wimps :)
00092  *
00093  * Revision 1.1.2.1  2004/03/31 11:03:16  csoutheren
00094  * Initial public version
00095  *
00096  * Revision 1.8  2004/02/23 13:17:32  craigs
00097  * Fixed problems with codec interface functions
00098  *
00099  * Revision 1.7  2004/02/23 13:04:09  craigs
00100  * Removed warnings when compliing plugins
00101  *
00102  * Revision 1.6  2004/01/27 14:55:46  craigs
00103  * Implemented static linking of new codecs
00104  *
00105  * Revision 1.5  2004/01/23 05:21:15  craigs
00106  * Updated for changes to the codec plugin interface
00107  *
00108  * Revision 1.4  2004/01/09 11:27:46  craigs
00109  * Plugin codec audio now works :)
00110  *
00111  * Revision 1.3  2004/01/09 07:32:22  craigs
00112  * More fixes for capability problems
00113  *
00114  * Revision 1.2  2004/01/06 07:05:03  craigs
00115  * Changed to support plugin codecs
00116  *
00117  * Revision 1.1  2004/01/04 13:37:51  craigs
00118  * Implementation of codec plugins
00119  *
00120  *
00121  */
00122 
00123 #ifndef __OPAL_CODECPLUGIN_H
00124 #define __OPAL_CODECPLUGIN_H
00125 
00126 #ifdef __cplusplus
00127 extern "C" {
00128 #endif
00129 
00130 #include <time.h>
00131 
00132 #ifdef _MSC_VER
00133 #pragma warning(disable:4201)
00134 #endif
00135 
00136 #ifdef _WIN32
00137 #  ifdef PLUGIN_CODEC_DLL_EXPORTS
00138 #    define PLUGIN_CODEC_DLL_API __declspec(dllexport)
00139 #  else
00140 #    define PLUGIN_CODEC_DLL_API __declspec(dllimport)
00141 #  endif
00142 
00143 #else
00144 
00145 #define PLUGIN_CODEC_DLL_API
00146 
00147 #endif
00148 
00149 #ifdef PWLIB_PLUGIN_API_VERSION
00150 #undef PWLIB_PLUGIN_API_VERSION
00151 #endif
00152 #define PWLIB_PLUGIN_API_VERSION 1
00153 
00154 #define PLUGIN_CODEC_VERSION            1    // initial version
00155 #define PLUGIN_CODEC_VERSION_WIDEBAND   2    // added wideband
00156 #define PLUGIN_CODEC_VERSION_VIDEO      3    // added video
00157 #define PLUGIN_CODEC_VERSION_FAX        4    // added fax
00158 #define PLUGIN_CODEC_VERSION_OPTIONS    5    // added options handling
00159 
00160 #define PLUGIN_CODEC_API_VER_FN       PWLibPlugin_GetAPIVersion
00161 #define PLUGIN_CODEC_API_VER_FN_STR   "PWLibPlugin_GetAPIVersion"
00162 
00163 #define PLUGIN_CODEC_GET_CODEC_FN     OpalCodecPlugin_GetCodecs
00164 #define PLUGIN_CODEC_GET_CODEC_FN_STR "OpalCodecPlugin_GetCodecs"
00165 
00166 #define PLUGIN_CODEC_API_VER_FN_DECLARE \
00167 PLUGIN_CODEC_DLL_API unsigned int PLUGIN_CODEC_API_VER_FN() \
00168 { return PWLIB_PLUGIN_API_VERSION; }
00169 
00170 enum {
00171   PluginCodec_License_None                           = 0,
00172   PluginCodec_Licence_None = PluginCodec_License_None,        // allow for old code with misspelled constant
00173   PluginCodec_License_GPL                            = 1,
00174   PluginCodec_License_MPL                            = 2,
00175   PluginCodec_License_Freeware                       = 3,
00176   PluginCodec_License_ResearchAndDevelopmentUseOnly  = 4,
00177   PluginCodec_License_BSD                            = 5,
00178   PluginCodec_License_LGPL                           = 6,
00179 
00180   PluginCodec_License_NoRoyalties                    = 0x7f,
00181 
00182   // any license codes above here require royalty payments
00183   PluginCodec_License_RoyaltiesRequired              = 0x80
00184 };
00185 
00186 struct PluginCodec_information {
00187   // start of version 1 fields
00188   time_t timestamp;                     // codec creation time and date - obtain with command: date -u "+%c = %s"
00189 
00190   const char * sourceAuthor;            // source code author
00191   const char * sourceVersion;           // source code version
00192   const char * sourceEmail;             // source code email contact information
00193   const char * sourceURL;               // source code web site
00194   const char * sourceCopyright;         // source code copyright
00195   const char * sourceLicense;           // source code license
00196   unsigned char sourceLicenseCode;      // source code license
00197 
00198   const char * codecDescription;        // codec description
00199   const char * codecAuthor;             // codec author
00200   const char * codecVersion;            // codec version
00201   const char * codecEmail;              // codec email contact information
00202   const char * codecURL;                // codec web site
00203   const char * codecCopyright;          // codec copyright information
00204   const char * codecLicense;            // codec license
00205   unsigned short codecLicenseCode;      // codec license code
00206   // end of version 1 fields
00207 
00208 };
00209 
00210 enum PluginCodec_Flags {
00211   PluginCodec_MediaTypeMask          = 0x000f,
00212   PluginCodec_MediaTypeAudio         = 0x0000,
00213   PluginCodec_MediaTypeVideo         = 0x0001,
00214   PluginCodec_MediaTypeAudioStreamed = 0x0002,
00215   PluginCodec_MediaTypeFax           = 0x0003,
00216   PluginCodec_MediaTypeExtVideo      = 0x0004,
00217 
00218   PluginCodec_InputTypeMask          = 0x0010,
00219   PluginCodec_InputTypeRaw           = 0x0000,
00220   PluginCodec_InputTypeRTP           = 0x0010,
00221 
00222   PluginCodec_OutputTypeMask         = 0x0020,
00223   PluginCodec_OutputTypeRaw          = 0x0000,
00224   PluginCodec_OutputTypeRTP          = 0x0020,
00225 
00226   PluginCodec_RTPTypeMask            = 0x0040,
00227   PluginCodec_RTPTypeDynamic         = 0x0000,
00228   PluginCodec_RTPTypeExplicit        = 0x0040,
00229 
00230   PluginCodec_RTPSharedMask          = 0x0080,
00231   PluginCodec_RTPTypeNotShared       = 0x0000,
00232   PluginCodec_RTPTypeShared          = 0x0080,
00233 
00234   PluginCodec_DecodeSilenceMask      = 0x0100,
00235   PluginCodec_NoDecodeSilence        = 0x0000,
00236   PluginCodec_DecodeSilence          = 0x0100,
00237 
00238   PluginCodec_EncodeSilenceMask      = 0x0200,
00239   PluginCodec_NoEncodeSilence        = 0x0000,
00240   PluginCodec_EncodeSilence          = 0x0200,
00241 
00242   PluginCodec_BitsPerSamplePos       = 12,
00243   PluginCodec_BitsPerSampleMask      = 0xf000,
00244 };
00245 
00246 enum PluginCodec_CoderFlags {
00247   PluginCodec_CoderSilenceFrame      = 1,    // request audio codec to create silence frame
00248   PluginCodec_CoderForceIFrame       = 2     // request video codec to force I frame
00249 };
00250 
00251 enum PluginCodec_ReturnCoderFlags {
00252   PluginCodec_ReturnCoderLastFrame     = 1,    // indicates when video codec returns last data for frame
00253   PluginCodec_ReturnCoderIFrame        = 2,    // indicates when video returns I frame
00254   PluginCodec_ReturnCoderRequestIFrame = 4     // indicates when video decoder request I frame for resync
00255 };
00256 
00257 struct PluginCodec_Definition;
00258 
00259 struct PluginCodec_ControlDefn {
00260   const char * name;
00261   int (*control)(const struct PluginCodec_Definition * codec, void * context, 
00262                  const char * name, void * parm, unsigned * parmLen);
00263  
00264 };
00265 
00266 enum PluginCodec_OptionTypes {
00267   PluginCodec_StringOption,
00268   PluginCodec_BoolOption,
00269   PluginCodec_IntegerOption,
00270   PluginCodec_RealOption,
00271   PluginCodec_EnumOption,
00272   PluginCodec_OctetsOption,
00273   PluginCodec_NumOptionTypes,
00274 };
00275 
00276 enum PluginCodec_OptionMerge {
00277   PluginCodec_NoMerge,
00278   PluginCodec_MinMerge,
00279   PluginCodec_MaxMerge,
00280   PluginCodec_EqualMerge,
00281   PluginCodec_NotEqualMerge,
00282   PluginCodec_AlwaysMerge,
00283   PluginCodec_NumOptionMerge,
00284 
00285   PluginCodec_AndMerge = PluginCodec_MaxMerge,
00286   PluginCodec_OrMerge  = PluginCodec_MinMerge,
00287   PluginCodec_XorMerge = PluginCodec_NotEqualMerge,
00288   PluginCodec_NotXorMerge = PluginCodec_EqualMerge
00289 };
00290 
00291 #define PluginCodec_H245_Collapsing    0x40000000
00292 #define PluginCodec_H245_NonCollapsing 0x20000000
00293 #define PluginCodec_H245_Unsigned32    0x10000000
00294 #define PluginCodec_H245_BooleanArray  0x08000000
00295 #define PluginCodec_H245_TCS           0x04000000
00296 #define PluginCodec_H245_OLC           0x02000000
00297 #define PluginCodec_H245_ReqMode       0x01000000
00298 #define PluginCodec_H245_OrdinalMask   0x0000ffff
00299 
00300 struct PluginCodec_Option {
00301   // start of version 4 fields
00302   enum PluginCodec_OptionTypes m_type;
00303   const char *                 m_name;
00304   unsigned                     m_readOnly;
00305   enum PluginCodec_OptionMerge m_merge;
00306   const char *                 m_value;
00307   const char *                 m_FMTPName;
00308   const char *                 m_FMTPDefault;
00309   int                          m_H245Generic;
00310   const char *                 m_minimum;
00311   const char *                 m_maximum;
00312 };
00313 
00314 
00315 struct PluginCodec_Definition {
00316   unsigned int version;                                // codec structure version
00317 
00318   // start of version 1 fields
00319   struct PluginCodec_information * info;   // license information
00320 
00321   unsigned int flags;                      // b0-3: 0 = audio,        1 = video
00322                                            // b4:   0 = raw input,    1 = RTP input
00323                                            // b5:   0 = raw output,   1 = RTP output
00324                                            // b6:   0 = dynamic RTP,  1 = explicit RTP
00325                                            // b7:   0 = no share RTP, 1 = share RTP
00326 
00327   const char * descr;                                  // text decription
00328 
00329   const char * sourceFormat;               // source format
00330   const char * destFormat;                 // destination format
00331 
00332   const void * userData;                   // user data value
00333 
00334   unsigned int sampleRate;                 // samples per second
00335   unsigned int bitsPerSec;                     // raw bits per second
00336   unsigned int usPerFrame;                 // microseconds per frame
00337 
00338   union _parm {
00339     struct _audio {
00340       unsigned int samplesPerFrame;            // audio: samples per frame
00341       unsigned int bytesPerFrame;              // audio: max bytes per frame
00342       unsigned int recommendedFramesPerPacket; // audio: recommended number of frames per packet
00343       unsigned int maxFramesPerPacket;         // audio: maximum number of frames per packet
00344     } audio;
00345     struct _video {
00346       unsigned int maxFrameWidth;              // video: frame width
00347       unsigned int maxFrameHeight;             // video: frame height
00348       unsigned int recommendedFrameRate;       // video: recommended frame rate
00349       unsigned int maxFrameRate;               // video: max frame rate
00350     } video;
00351   } parm;
00352 
00353   unsigned char rtpPayload;                      // IANA RTP payload code (if defined)
00354   const char * sdpFormat;                  // SDP format string (or NULL, if no SDP format)
00355 
00356   void * (*createCodec)(const struct PluginCodec_Definition * codec);                     // create codec 
00357   void (*destroyCodec) (const struct PluginCodec_Definition * codec,  void * context);  // destroy codec
00358   int (*codecFunction) (const struct PluginCodec_Definition * codec,  void * context,   // do codec function
00359                                   const void * from, unsigned * fromLen,
00360                                         void * to,   unsigned * toLen,
00361                                         unsigned int * flag);
00362   struct PluginCodec_ControlDefn * codecControls;
00363  
00364   // H323 specific fields
00365   unsigned char h323CapabilityType;
00366   const void  * h323CapabilityData;
00367 
00368   // end of version 1 fields
00369 
00370   // NOTE!!!!! Due to an error in judgement, you cannot add ANY more fields
00371   // to this structure without an API version change!!!!
00372 };
00373 
00374 typedef struct PluginCodec_Definition * (* PluginCodec_GetCodecFunction)(unsigned int *, unsigned int);
00375 typedef unsigned (* PluginCodec_GetAPIVersionFunction)();
00376 
00378 //
00379 //  H.323 specific values
00380 //
00381 
00382 
00383 struct PluginCodec_H323CapabilityExtension {
00384   unsigned int index;
00385   void * data;
00386   unsigned dataLength;
00387 };
00388 
00389 struct PluginCodec_H323NonStandardCodecData {
00390   const char * objectId;
00391   unsigned char  t35CountryCode;
00392   unsigned char  t35Extension;
00393   unsigned short manufacturerCode;
00394   const unsigned char * data;
00395   unsigned int dataLength;
00396   int (*capabilityMatchFunction)(struct PluginCodec_H323NonStandardCodecData *);
00397 };
00398 
00399 
00400 struct PluginCodec_H323GenericParameterDefinition
00401 {
00402   /* The following used to be a simple integer for the collapsing flag in
00403      version 3 and earlier. We hope that all those implementations just used
00404      zero and one (a good bet) and thus the below bit fields will be backward
00405      compatible, putting the parameter in all three PDU types.
00406    */ 
00407   struct {
00408     int collapsing:1; /* boolean */
00409     int excludeTCS:1;
00410     int excludeOLC:1;
00411     int excludeReqMode:1;
00412     int readOnly:1;
00413   };
00414 
00415     unsigned int id;
00416 
00417     enum PluginCodec_H323GenericParameterType {
00418         /* these need to be in the same order as the choices in
00419            H245_ParameterValue::Choices, as the value is just cast to that type
00420         */
00421         PluginCodec_GenericParameter_Logical = 0,
00422         PluginCodec_GenericParameter_BooleanArray,
00423         PluginCodec_GenericParameter_UnsignedMin,
00424         PluginCodec_GenericParameter_UnsignedMax,
00425         PluginCodec_GenericParameter_Unsigned32Min,
00426         PluginCodec_GenericParameter_Unsigned32Max,
00427         PluginCodec_GenericParameter_OctetString,
00428         PluginCodec_GenericParameter_GenericParameter,
00429         
00430     PluginCodec_GenericParameter_logical = 0,
00431     PluginCodec_GenericParameter_booleanArray,
00432     PluginCodec_GenericParameter_unsignedMin,
00433     PluginCodec_GenericParameter_unsignedMax,
00434     PluginCodec_GenericParameter_unsigned32Min,
00435     PluginCodec_GenericParameter_unsigned32Max,
00436     PluginCodec_GenericParameter_octetString,
00437     PluginCodec_GenericParameter_genericParameter
00438     } type;
00439 
00440     union {
00441         unsigned long integer;
00442     const char * octetstring;
00443         struct PluginCodec_H323GenericParameterDefinition *genericparameter;
00444     } value;
00445 };
00446 
00447 struct PluginCodec_H323GenericCodecData
00448 {
00449     // some cunning structures & lists, and associated logic in 
00450     // H323CodecPluginGenericAudioCapability::H323CodecPluginGenericAudioCapability()
00451     const char * standardIdentifier;
00452     unsigned int maxBitRate; // Zero means use value from OpalMediaFormat
00453 
00454     /* parameters; these are the parameters which are set in the
00455        'TerminalCapabilitySet' and 'OpenLogicalChannel' requests */
00456     unsigned int nParameters;
00457     /* an array of nParameters parameter definitions */
00458     const struct PluginCodec_H323GenericParameterDefinition *params; 
00459 };
00460     
00461 
00462 struct PluginCodec_H323AudioGSMData {
00463   int comfortNoise:1;
00464   int scrambled:1;
00465 };
00466 
00467 struct  PluginCodec_H323AudioG7231AnnexC {
00468   unsigned char maxAl_sduAudioFrames;
00469   int silenceSuppression:1;
00470   int highRateMode0:6;                // INTEGER (27..78),      -- units octets
00471   int   highRateMode1:6;                // INTEGER (27..78),    -- units octets
00472   int   lowRateMode0:6;                 // INTEGER (23..66),    -- units octets
00473   int   lowRateMode1:6;                 // INTEGER (23..66),    -- units octets
00474   int   sidMode0:4;                         // INTEGER (6..17), -- units octets
00475   int   sidMode1:4;                         // INTEGER (6..17), -- units octets
00476 };
00477 
00478 
00479 enum {
00480   PluginCodec_H323Codec_undefined,                      // must be zero, so empty struct is undefined
00481   PluginCodec_H323Codec_programmed,                     // H323ProgrammedCapability
00482   PluginCodec_H323Codec_nonStandard,            // H323NonStandardData
00483   PluginCodec_H323Codec_generic,            // H323GenericCodecData
00484 
00485   // audio codecs
00486   PluginCodec_H323AudioCodec_g711Alaw_64k,                  // int
00487   PluginCodec_H323AudioCodec_g711Alaw_56k,                  // int
00488   PluginCodec_H323AudioCodec_g711Ulaw_64k,                  // int
00489   PluginCodec_H323AudioCodec_g711Ulaw_56k,                  // int
00490   PluginCodec_H323AudioCodec_g722_64k,                        // int
00491   PluginCodec_H323AudioCodec_g722_56k,                        // int
00492   PluginCodec_H323AudioCodec_g722_48k,                        // int
00493   PluginCodec_H323AudioCodec_g7231,                               // H323AudioG7231Data
00494   PluginCodec_H323AudioCodec_g728,                                // int
00495   PluginCodec_H323AudioCodec_g729,                                // int
00496   PluginCodec_H323AudioCodec_g729AnnexA,                      // int
00497   PluginCodec_H323AudioCodec_is11172,             // not yet implemented
00498   PluginCodec_H323AudioCodec_is13818Audio,        // not yet implemented
00499   PluginCodec_H323AudioCodec_g729wAnnexB,                     // int
00500   PluginCodec_H323AudioCodec_g729AnnexAwAnnexB,   // int
00501   PluginCodec_H323AudioCodec_g7231AnnexC,         // H323AudioG7231AnnexC
00502   PluginCodec_H323AudioCodec_gsmFullRate,                     // H323AudioGSMData
00503   PluginCodec_H323AudioCodec_gsmHalfRate,                     // H323AudioGSMData
00504   PluginCodec_H323AudioCodec_gsmEnhancedFullRate,       // H323AudioGSMData
00505   PluginCodec_H323AudioCodec_g729Extensions,      // not yet implemented
00506 
00507   // video codecs
00508   PluginCodec_H323VideoCodec_h261,                // implemented 
00509   PluginCodec_H323VideoCodec_h262,                // not yet implemented
00510   PluginCodec_H323VideoCodec_h263,                // implemented
00511   PluginCodec_H323VideoCodec_is11172,             // not yet implemented
00512 
00513   // other capabilities
00514   PluginCodec_H323VideoCodec_Extended,            // implemented (for use with H.239)
00515   PluginCodec_H323T38Codec,                       // not yet implemented
00516 
00517   // special codes
00518   PluginCodec_H323Codec_NoH323 = 0xff,            // used for SIP-only codecs
00519 };
00520 
00522 //
00523 // Generic Codec Standard Identifiers
00524 //
00525 
00526 // Audio Capabilities
00527 // AMR (as defined in H.245v13 Annex I)
00528 #define OpalPluginCodec_Identifer_AMR             "0.0.8.245.1.1.1"
00529 
00530 // AMR-NB\WB  (as defined in H.245v13 Annex R)
00531 #define OpalPluginCodec_Identifer_AMR_NB          "0.0.8.245.1.1.9"
00532 #define OpalPluginCodec_Identifer_AMR_WB          "0.0.8.245.1.1.10"
00533 
00534 // G.722.2 (aka AMR-WB)
00535 #define OpalPluginCodec_Identifer_G7222           "0.0.7.7222.1.0"
00536 
00537 // iLBC (as defined in H.245v13 Annex S)
00538 #define OpalPluginCodec_Identifer_iLBC            "0.0.8.245.1.1.11"
00539 
00540 
00541 // Video Capabilities
00542 
00543 // H264 (as defined in H.241)
00544 #define OpalPluginCodec_Identifer_H264            "0.0.8.241.0.0.0.0"
00545 #define OpalPluginCodec_Identifer_H264_RFC3984    "0.0.8.241.0.0.0.1"
00546 #define OpalPluginCodec_Identifer_H264_RFC3984Int "0.0.8.241.0.0.0.2"
00547 #define OpalPluginCodec_Identifer_H264_Generic    "0.0.8.241.0.0.1"
00548 
00549 // ISO/IEC 14496-2 MPEG4 part 2 (as defined in H.245v13 Annex E)
00550 #define OpalPluginCodec_Identifer_MPEG4           "0.0.8.245.1.0.0"
00551 
00552 // Extended Video Capability (as defined in H.239)
00553 #define OpalPluginCodec_Identifer_H239            "0.0.8.239.1"
00554 #define OpalPluginCodec_Identifer_H239_Video      "0.0.8.239.2"
00555 #define OpalPluginCodec_Identifer_H239_Generic    "0.0.8.239.3"
00556 
00558 //
00559 // RTP specific definitions
00560 //
00561 
00562 #define PluginCodec_RTP_MaxPacketSize  (1518-14-4-8-20-16)  // Max Ethernet packet (1518 bytes) minus 802.3/CRC, 802.3, IP, UDP headers
00563 #define PluginCodec_RTP_MinHeaderSize  (12)
00564 #define PluginCodec_RTP_MaxPayloadSize (PluginCodec_RTP_MaxPacketSize - PluginCodec_RTP_MinHeaderSize)
00565 
00566 #define PluginCodec_RTP_GetHeaderLength(ptr)      ((((BYTE*)(ptr))[0] & 0x0f)*4 + PluginCodec_RTP_MinHeaderSize)
00567 #define PluginCodec_RTP_GetPayloadPtr(ptr)          ((BYTE*)(ptr) + PluginCodec_RTP_GetHeaderLength(ptr))
00568 #define PluginCodec_RTP_GetPayloadType(ptr)        (((BYTE*)(ptr))[1] & 0x7f)
00569 #define PluginCodec_RTP_SetPayloadType(ptr, type)  (((BYTE*)(ptr))[1] = (((BYTE*)(ptr))[1] & 0x80) | (type & 0x7f))
00570 #define PluginCodec_RTP_GetMarker(ptr)            ((((BYTE*)(ptr))[1] & 0x80) != 0)
00571 #define PluginCodec_RTP_SetMarker(ptr, mark)       (((BYTE*)(ptr))[1] = (((BYTE*)(ptr))[1] & 0x7f) | (mark != 0 ? 0x80 : 0))
00572 #define PluginCodec_RTP_GetTimestamp(ptr)         ((((BYTE*)(ptr))[4] << 24) | (((BYTE*)(ptr))[5] << 16) | (((BYTE*)(ptr))[6] << 8) | ((BYTE*)(ptr))[7])
00573 #define PluginCodec_RTP_SetTimestamp(ptr, ts)     ((((BYTE*)(ptr))[4] = ((ts) >> 24)),(((BYTE*)(ptr))[5] = ((ts) >> 16)),(((BYTE*)(ptr))[6] = ((ts) >> 8)),(((BYTE*)(ptr))[7] = (ts)))
00574 
00575 
00577 //
00578 // video specific definitions
00579 //
00580 
00581 struct PluginCodec_Video_FrameHeader {
00582   unsigned int  x;
00583   unsigned int  y;
00584   unsigned int  width;
00585   unsigned int  height;
00586 };
00587 
00588 #ifdef __cplusplus
00589 };
00590 
00591 inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(struct PluginCodec_Video_FrameHeader * base)
00592 { return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); }
00593 
00594 inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(const PluginCodec_Video_FrameHeader * base)
00595 { return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); }
00596 
00597 extern "C" {
00598 #endif
00599 
00600 #define PLUGIN_CODEC_VIDEO_SET_FRAME_SIZE_FN    "set_frame_size"    // argument is struct PluginCodec_VideoSetFrameInfo
00601 struct PluginCodec_Video_SetFrameInfo {
00602   int width;
00603   int height;
00604 };
00605 
00606 
00608 //
00609 // experimental definitions for statically linking codecs
00610 //
00611 
00612 #ifdef OPAL_STATIC_CODEC
00613 
00614 #  undef PLUGIN_CODEC_DLL_API
00615 #  define PLUGIN_CODEC_DLL_API static
00616 #  define PLUGIN_CODEC_IMPLEMENT(name) \
00617 unsigned int Opal_StaticCodec_##name##_GetAPIVersion() \
00618 { return PWLIB_PLUGIN_API_VERSION; } \
00619 static struct PluginCodec_Definition * PLUGIN_CODEC_GET_CODEC_FN(unsigned * count, unsigned /*version*/); \
00620 struct PluginCodec_Definition * Opal_StaticCodec_##name##_GetCodecs(unsigned * p1, unsigned p2) \
00621 { return PLUGIN_CODEC_GET_CODEC_FN(p1,p2); } \
00622 
00623 #else
00624 
00625 #  define PLUGIN_CODEC_IMPLEMENT(name) \
00626 PLUGIN_CODEC_DLL_API unsigned int PLUGIN_CODEC_API_VER_FN() \
00627 { return PWLIB_PLUGIN_API_VERSION; } \
00628 
00629 #  define PLUGIN_CODEC_IMPLEMENT_ALL(name, table, ver) \
00630 PLUGIN_CODEC_IMPLEMENT(name) \
00631 PLUGIN_CODEC_DLL_API struct PluginCodec_Definition * PLUGIN_CODEC_GET_CODEC_FN(unsigned * count, unsigned version) \
00632 { *count = sizeof(table)/sizeof(struct PluginCodec_Definition); return version < ver ? NULL : table; }
00633 
00634 
00635 #endif
00636 
00637 #ifdef __cplusplus
00638 };
00639 #endif
00640 
00641 
00642 #ifdef _MSC_VER
00643 #pragma warning(default:4201)
00644 #endif
00645 
00646 #endif // __OPAL_CODECPLUGIN_H

Generated on Thu Oct 25 13:41:58 2007 for h323plus by  doxygen 1.5.2