# opalplugin.h

Go to the documentation of this file.

    00001 /*
    00002  * opalplugins.h
    00003  *
    00004  * OPAL codec plugins handler
    00005  *
    00006  * Open Phone Abstraction Library (OPAL)
    00007  * Formally known as the Open H323 project.
    00008  *
    00009  * Copyright (C) 2004-2011 Post Increment
    00010  *
    00011  * Redistribution and use in source and binary forms, with or without
    00012  * modification, are permitted provided that the following conditions
    00013  * are met:
    00014  *
    00015  * - Redistributions of source code must retain the above copyright
    00016  *   notice, this list of conditions and the following disclaimer.
    00017
    00018  * - Redistributions in binary form must reproduce the above copyright
    00019  *   notice, this list of conditions and the following disclaimer in the
    00020  *   documentation and/or other materials provided with the distribution.
    00021  *
    00022  * - Neither the name of the Xiph.org Foundation nor the names of its
    00023  *   contributors may be used to endorse or promote products derived from
    00024  *   this software without specific prior written permission.
    00025  *
    00026  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    00027  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    00028  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    00029  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
    00030  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    00031  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    00032  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    00033  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    00034  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    00035  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00036  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00037  *
    00038  * $Revision: 28932 $
    00039  * $Author: csoutheren $
    00040  * $Date: 2013-01-18 06:34:20 -0600 (Fri, 18 Jan 2013) $
    00041  */
    00042
    00043 #ifndef OPAL_CODEC_OPALPLUGIN_H
    00044 #define OPAL_CODEC_OPALPLUGIN_H
    00045
    00046 #ifdef __cplusplus
    00047 extern "C" {
    00048 #endif
    00049
    00050 #ifndef _CRT_NONSTDC_NO_DEPRECATE
    00051 #define _CRT_NONSTDC_NO_DEPRECATE 1
    00052 #endif
    00053
    00054 #ifndef _CRT_SECURE_NO_WARNINGS
    00055 #define _CRT_SECURE_NO_WARNINGS 1
    00056 #endif
    00057
    00058 #include <time.h>
    00059
    00060 #ifdef _MSC_VER
    00061 #pragma warning(disable:4201)
    00062 #endif
    00063
    00064 #ifdef _MSC_VER
    00065 #  ifdef PLUGIN_CODEC_DLL_EXPORTS
    00066 #    define PLUGIN_CODEC_DLL_API __declspec(dllexport)
    00067 #  else
    00068 #    define PLUGIN_CODEC_DLL_API __declspec(dllimport)
    00069 #  endif
    00070
    00071 #if !defined(strcasecmp) && !defined(_WIN32_WCE)
    00072 #define strcasecmp stricmp
    00073 #endif
    00074
    00075 #else
    00076
    00077 #define PLUGIN_CODEC_DLL_API
    00078
    00079 #endif
    00080
    00081 #ifdef PWLIB_PLUGIN_API_VERSION
    00082 #undef PWLIB_PLUGIN_API_VERSION
    00083 #endif
    00084 #define PWLIB_PLUGIN_API_VERSION 1
    00085
    00086 #define  PLUGIN_CODEC_VERSION_FIRST     1    // initial version
    00087 #define  PLUGIN_CODEC_VERSION_WIDEBAND  2    // added wideband
    00088 #define  PLUGIN_CODEC_VERSION_VIDEO     3    // added video
    00089 #define  PLUGIN_CODEC_VERSION_FAX       4    // added fax
    00090 #define  PLUGIN_CODEC_VERSION_OPTIONS   5    // added options handling
    00091 #define  PLUGIN_CODEC_VERSION_INTERSECT 6    // added media option intersection merge functionality
    00092 #define  PLUGIN_CODEC_VERSION_H245_DEF_GEN_PARAM 7 // added suppression of H.245 generic parameters via default
    00093
    00094 #define  PLUGIN_CODEC_VERSION PLUGIN_CODEC_VERSION_H245_DEF_GEN_PARAM // Always latest version
    00095
    00096 #define PLUGIN_CODEC_API_VER_FN       PWLibPlugin_GetAPIVersion
    00097 #define PLUGIN_CODEC_API_VER_FN_STR   "PWLibPlugin_GetAPIVersion"
    00098
    00099 #define PLUGIN_CODEC_GET_CODEC_FN     OpalCodecPlugin_GetCodecs
    00100 #define PLUGIN_CODEC_GET_CODEC_FN_STR "OpalCodecPlugin_GetCodecs"
    00101
    00102 #define PLUGIN_CODEC_API_VER_FN_DECLARE \
    00103 PLUGIN_CODEC_DLL_API unsigned int PLUGIN_CODEC_API_VER_FN() \
    00104 { return PWLIB_PLUGIN_API_VERSION; }
    00105
    00106 enum {
    00107   PluginCodec_License_None                           = 0,
    00108   PluginCodec_Licence_None = PluginCodec_License_None,        // allow for old code with misspelled constant
    00109   PluginCodec_License_GPL                            = 1,
    00110   PluginCodec_License_MPL                            = 2,
    00111   PluginCodec_License_Freeware                       = 3,
    00112   PluginCodec_License_ResearchAndDevelopmentUseOnly  = 4,
    00113   PluginCodec_License_BSD                            = 5,
    00114   PluginCodec_License_LGPL                           = 6,
    00115
    00116   PluginCodec_License_NoRoyalties                    = 0x7f,
    00117
    00118   // any license codes above here require royalty payments
    00119   PluginCodec_License_RoyaltiesRequired              = 0x80
    00120 };
    00121
    00122 struct PluginCodec_information {
    00123   // start of version 1 fields
    00124   time_t timestamp_deprecated;
    00125
    00126   const char * sourceAuthor;            // source code author
    00127   const char * sourceVersion;           // source code version
    00128   const char * sourceEmail;             // source code email contact information
    00129   const char * sourceURL;               // source code web site
    00130   const char * sourceCopyright;         // source code copyright
    00131   const char * sourceLicense;           // source code license
    00132   unsigned char sourceLicenseCode;      // source code license
    00133
    00134   const char * codecDescription;        // codec description
    00135   const char * codecAuthor;             // codec author
    00136   const char * codecVersion;            // codec version
    00137   const char * codecEmail;              // codec email contact information
    00138   const char * codecURL;                // codec web site
    00139   const char * codecCopyright;          // codec copyright information
    00140   const char * codecLicense;            // codec license
    00141   unsigned short codecLicenseCode;      // codec license code
    00142   // end of version 1 fields
    00143
    00144   const char * timestamp;               // String form of timestamp for plug in, generally as provided by __TIMESTAMP__
    00145 };
    00146
    00147 enum PluginCodec_Flags {
    00148   PluginCodec_MediaTypeMask          = 0x000f,
    00149   PluginCodec_MediaTypeAudio         = 0x0000,
    00150   PluginCodec_MediaTypeVideo         = 0x0001,
    00151   PluginCodec_MediaTypeAudioStreamed = 0x0002,
    00152   PluginCodec_MediaTypeFax           = 0x0003,
    00153
    00154   PluginCodec_InputTypeMask          = 0x0010,
    00155   PluginCodec_InputTypeRaw           = 0x0000, // Note video is always RTP
    00156   PluginCodec_InputTypeRTP           = 0x0010,
    00157
    00158   PluginCodec_OutputTypeMask         = 0x0020,
    00159   PluginCodec_OutputTypeRaw          = 0x0000, // Note video is always RTP
    00160   PluginCodec_OutputTypeRTP          = 0x0020,
    00161
    00162   PluginCodec_RTPTypeMask            = 0x0040,
    00163   PluginCodec_RTPTypeDynamic         = 0x0000,
    00164   PluginCodec_RTPTypeExplicit        = 0x0040,
    00165
    00166   PluginCodec_RTPSharedMask          = 0x0080,
    00167   PluginCodec_RTPTypeNotShared       = 0x0000,
    00168   PluginCodec_RTPTypeShared          = 0x0080,
    00169
    00170   PluginCodec_DecodeSilenceMask      = 0x0100,
    00171   PluginCodec_NoDecodeSilence        = 0x0000,
    00172   PluginCodec_DecodeSilence          = 0x0100,
    00173
    00174   PluginCodec_EncodeSilenceMask      = 0x0200,
    00175   PluginCodec_NoEncodeSilence        = 0x0000,
    00176   PluginCodec_EncodeSilence          = 0x0200,
    00177
    00178   PluginCodec_MediaExtensionMask     = 0x0400,
    00179   PluginCodec_MediaTypeExtVideo      = 0x0400,
    00180
    00181   PluginCodec_ComfortNoiseMask       = 0x0800,  // Audio only
    00182   PluginCodec_ComfortNoise           = 0x0800,
    00183
    00184   PluginCodec_ErrorConcealmentMask   = 0x0800,  // Video only
    00185   PluginCodec_ErrorConcealment       = 0x0800,
    00186
    00187   PluginCodec_EmptyPayloadMask       = 0x1000,
    00188   PluginCodec_EmptyPayload           = 0x1000,
    00189
    00190   PluginCodec_OtherPayloadMask       = 0x2000,
    00191   PluginCodec_OtherPayload           = 0x2000,
    00192
    00193   PluginCodec_BitsPerSamplePos       = 12,
    00194   PluginCodec_BitsPerSampleMask      = 0xf000,
    00195
    00196   PluginCodec_ChannelsPos            = 16,
    00197   PluginCodec_ChannelsMask           = 0x003f0000
    00198 };
    00199
    00200 #define PluginCodec_SetChannels(n) (((n-1)<<PluginCodec_ChannelsPos)&PluginCodec_ChannelsMask)
    00201
    00202
    00203 enum PluginCodec_CoderFlags {
    00204   PluginCodec_CoderSilenceFrame      = 1,    // request audio codec to create silence frame
    00205   PluginCodec_CoderForceIFrame       = 2,    // request video codec to force I frame
    00206   PluginCodec_CoderPacketLoss        = 4     // indicate to video codec packets were lost
    00207 };
    00208
    00209 enum PluginCodec_ReturnCoderFlags {
    00210   PluginCodec_ReturnCoderLastFrame      = 1,    // indicates when video codec returns last data for frame
    00211   PluginCodec_ReturnCoderIFrame         = 2,    // indicates when video returns I frame
    00212   PluginCodec_ReturnCoderRequestIFrame  = 4,    // indicates when video decoder request I frame for resync
    00213   PluginCodec_ReturnCoderBufferTooSmall = 8     // indicates when output buffer is not large enough to receive
    00214                                                 // the data, another call to get_output_data_size is required
    00215 };
    00216
    00217 struct PluginCodec_Definition;
    00218
    00219 // Control function names
    00220
    00221 #define PLUGINCODEC_CONTROL_VALID_FOR_PROTOCOL    "valid_for_protocol"
    00222 #define PLUGINCODEC_CONTROL_GET_CODEC_OPTIONS     "get_codec_options"
    00223 #define PLUGINCODEC_CONTROL_FREE_CODEC_OPTIONS    "free_codec_options"
    00224 #define PLUGINCODEC_CONTROL_GET_OUTPUT_DATA_SIZE  "get_output_data_size"
    00225 #define PLUGINCODEC_CONTROL_SET_CODEC_OPTIONS     "set_codec_options"
    00226 #define PLUGINCODEC_CONTROL_GET_ACTIVE_OPTIONS    "get_active_options"
    00227 #define PLUGINCODEC_CONTROL_TO_NORMALISED_OPTIONS "to_normalised_options"
    00228 #define PLUGINCODEC_CONTROL_TO_CUSTOMISED_OPTIONS "to_customised_options"
    00229 #define PLUGINCODEC_CONTROL_SET_INSTANCE_ID       "set_instance_id"
    00230 #define PLUGINCODEC_CONTROL_SET_LOG_FUNCTION      "set_log_function"
    00231 #define PLUGINCODEC_CONTROL_GET_STATISTICS        "get_statistics"
    00232 #define PLUGINCODEC_CONTROL_TERMINATE_CODEC       "terminate_codec"
    00233
    00234
    00235 /* Log function, plug in gets a pointer to this function which allows
    00236    it to use the standard OPAL logging system. The function returns 0 if
    00237    no logging was performed due to the log level. Note if log == NULL
    00238    then this return state is all that happens, so this may be executed
    00239    first to prevent lengthy logs that would not result in any output. */
    00240 typedef int (*PluginCodec_LogFunction)(unsigned level,
    00241                                        const char * file,
    00242                                        unsigned line,
    00243                                        const char * section,
    00244                                        const char * log);
    00245
    00246
    00247 struct PluginCodec_ControlDefn {
    00248   const char * name;
    00249   int (*control)(const struct PluginCodec_Definition * codec, void * context,
    00250                  const char * name, void * parm, unsigned * parmLen);
    00251
    00252 };
    00253
    00254 enum PluginCodec_OptionTypes {
    00255   PluginCodec_StringOption,
    00256   PluginCodec_BoolOption,
    00257   PluginCodec_IntegerOption,
    00258   PluginCodec_RealOption,
    00259   PluginCodec_EnumOption,
    00260   PluginCodec_OctetsOption,
    00261   PluginCodec_NumOptionTypes,
    00262 };
    00263
    00264 enum PluginCodec_OptionMerge {
    00265   PluginCodec_NoMerge,
    00266   PluginCodec_MinMerge,
    00267   PluginCodec_MaxMerge,
    00268   PluginCodec_EqualMerge,
    00269   PluginCodec_NotEqualMerge,
    00270   PluginCodec_AlwaysMerge,
    00271   PluginCodec_CustomMerge,
    00272   PluginCodec_IntersectionMerge,
    00273
    00274   PluginCodec_AndMerge = PluginCodec_MinMerge,
    00275   PluginCodec_OrMerge  = PluginCodec_MaxMerge
    00276 };
    00277
    00278 #define PluginCodec_H245_Collapsing    0x40000000
    00279 #define PluginCodec_H245_NonCollapsing 0x20000000
    00280 #define PluginCodec_H245_Unsigned32    0x10000000
    00281 #define PluginCodec_H245_BooleanArray  0x08000000
    00282 #define PluginCodec_H245_TCS           0x04000000
    00283 #define PluginCodec_H245_OLC           0x02000000
    00284 #define PluginCodec_H245_ReqMode       0x01000000
    00285 #define PluginCodec_H245_OrdinalMask   0x0000ffff
    00286 #define PluginCodec_H245_PositionMask  0x00ff0000
    00287 #define PluginCodec_H245_PositionShift 16
    00288
    00289 typedef int (*PluginCodec_MergeFunction)(char ** result, const char * dest, const char * src);
    00290 typedef void (*PluginCodec_FreeFunction)(char * string);
    00291
    00292 struct PluginCodec_Option {
    00293   // start of version 4 fields
    00294   enum PluginCodec_OptionTypes m_type;
    00295   const char *                 m_name;
    00296   unsigned                     m_readOnly;
    00297   enum PluginCodec_OptionMerge m_merge;
    00298   const char *                 m_value;
    00299   const char *                 m_FMTPName;
    00300   const char *                 m_FMTPDefault;
    00301   int                          m_H245Generic;
    00302   const char *                 m_minimum;
    00303   const char *                 m_maximum;
    00304   PluginCodec_MergeFunction    m_mergeFunction; // Used if m_merge==PluginCodec_CustomMerge
    00305   PluginCodec_FreeFunction     m_freeFunction;
    00306   const char *                 m_H245Default;
    00307 };
    00308
    00309
    00310 // Normalised option names
    00311 #define PLUGINCODEC_OPTION_NEEDS_JITTER               "Needs Jitter"
    00312 #define PLUGINCODEC_OPTION_CLOCK_RATE                 "Clock Rate"
    00313 #define PLUGINCODEC_OPTION_CHANNELS                   "Channels"
    00314 #define PLUGINCODEC_OPTION_FRAME_TIME                 "Frame Time"
    00315 #define PLUGINCODEC_OPTION_MAX_FRAME_SIZE             "Max Frame Size"
    00316 #define PLUGINCODEC_OPTION_MAX_TX_PACKET_SIZE         "Max Tx Packet Size"   /* Really max PAYLOAD size */
    00317 #define PLUGINCODEC_OPTION_MAX_BIT_RATE               "Max Bit Rate"
    00318 #define PLUGINCODEC_OPTION_TARGET_BIT_RATE            "Target Bit Rate"
    00319 #define PLUGINCODEC_OPTION_RATE_CONTROL_PERIOD        "Rate Control Period"
    00320 #define PLUGINCODEC_OPTION_RX_FRAMES_PER_PACKET       "Rx Frames Per Packet"
    00321 #define PLUGINCODEC_OPTION_TX_FRAMES_PER_PACKET       "Tx Frames Per Packet"
    00322 #define PLUGINCODEC_OPTION_FRAME_WIDTH                "Frame Width"
    00323 #define PLUGINCODEC_OPTION_FRAME_HEIGHT               "Frame Height"
    00324 #define PLUGINCODEC_OPTION_MIN_RX_FRAME_WIDTH         "Min Rx Frame Width"
    00325 #define PLUGINCODEC_OPTION_MIN_RX_FRAME_HEIGHT        "Min Rx Frame Height"
    00326 #define PLUGINCODEC_OPTION_MAX_RX_FRAME_WIDTH         "Max Rx Frame Width"
    00327 #define PLUGINCODEC_OPTION_MAX_RX_FRAME_HEIGHT        "Max Rx Frame Height"
    00328 #define PLUGINCODEC_OPTION_TEMPORAL_SPATIAL_TRADE_OFF "Temporal Spatial Trade Off"
    00329 #define PLUGINCODEC_OPTION_TX_KEY_FRAME_PERIOD        "Tx Key Frame Period"
    00330
    00331 #define PLUGINCODEC_OPTION_PROTOCOL      "Protocol"
    00332 #define PLUGINCODEC_OPTION_PROTOCOL_H323 "H.323"
    00333 #define PLUGINCODEC_OPTION_PROTOCOL_SIP  "SIP"
    00334
    00335
    00336 // Full definition of the codec
    00337
    00338 struct PluginCodec_Definition {
    00339   unsigned int version;                     // codec structure version
    00340
    00341   // start of version 1 fields
    00342   const struct PluginCodec_information * info;   // license information
    00343
    00344   unsigned int flags;                      // b0-3: 0 = audio,        1 = video
    00345                                            // b4:   0 = raw input,    1 = RTP input
    00346                                            // b5:   0 = raw output,   1 = RTP output
    00347                                            // b6:   0 = dynamic RTP,  1 = explicit RTP
    00348                                            // b7:   0 = no share RTP, 1 = share RTP
    00349
    00350   const char * descr;                       // text decription
    00351
    00352   const char * sourceFormat;               // source format
    00353   const char * destFormat;                 // destination format
    00354
    00355   const void * userData;                   // user data value
    00356
    00357   unsigned int sampleRate;                 // samples per second
    00358   unsigned int bitsPerSec;                // raw bits per second
    00359   unsigned int usPerFrame;                 // microseconds per frame
    00360
    00361   union _parm {
    00362     struct _audio {
    00363       unsigned int samplesPerFrame;            // audio: samples per frame
    00364       unsigned int bytesPerFrame;              // audio: max bytes per frame
    00365       unsigned int recommendedFramesPerPacket; // audio: recommended number of frames per packet
    00366       unsigned int maxFramesPerPacket;         // audio: maximum number of frames per packet
    00367     } audio;
    00368     struct _video {
    00369       unsigned int maxFrameWidth;              // video: frame width
    00370       unsigned int maxFrameHeight;             // video: frame height
    00371       unsigned int recommendedFrameRate;       // video: recommended frame rate
    00372       unsigned int maxFrameRate;               // video: max frame rate
    00373     } video;
    00374   } parm;
    00375
    00376   unsigned char rtpPayload;                 // IANA RTP payload code (if defined)
    00377   const char * sdpFormat;                  // SDP format string (or NULL, if no SDP format)
    00378
    00379   void * (*createCodec)(const struct PluginCodec_Definition * codec);                    // create codec
    00380   void (*destroyCodec) (const struct PluginCodec_Definition * codec,  void * context);   // destroy codec
    00381   int (*codecFunction) (const struct PluginCodec_Definition * codec,  void * context,   // do codec function
    00382                                   const void * from, unsigned * fromLen,
    00383                                         void * to,   unsigned * toLen,
    00384                                         unsigned int * flag);
    00385   struct PluginCodec_ControlDefn * codecControls;
    00386
    00387   // H323 specific fields
    00388   unsigned char h323CapabilityType;
    00389   const void  * h323CapabilityData;
    00390
    00391   // end of version 1 fields
    00392
    00393   // NOTE!!!!! Due to an error in judgement, you cannot add ANY more fields
    00394   // to this structure without an API version change!!!!
    00395 };
    00396
    00397 typedef const struct PluginCodec_Definition * (* PluginCodec_GetCodecFunction)(unsigned int *, unsigned int);
    00398 typedef unsigned (* PluginCodec_GetAPIVersionFunction)();
    00399
    00400
    00402
    00403 #define PLUGINCODEC_RAW_AUDIO "L16"
    00404 #define PLUGINCODEC_RAW_VIDEO "YUV420P"
    00405 #define PLUGINCODEC_VIDEO_CLOCK 90000
    00406 #define PLUGINCODEC_MAX_FRAME_RATE 30
    00407
    00408 #define PLUGINCODEC_CIF_WIDTH     352
    00409 #define PLUGINCODEC_CIF_HEIGHT    288
    00410
    00411 #define PLUGINCODEC_CIF4_WIDTH   (PLUGINCODEC_CIF_WIDTH*2)
    00412 #define PLUGINCODEC_CIF4_HEIGHT  (PLUGINCODEC_CIF_HEIGHT*2)
    00413
    00414 #define PLUGINCODEC_CIF16_WIDTH  (PLUGINCODEC_CIF_WIDTH*4)
    00415 #define PLUGINCODEC_CIF16_HEIGHT (PLUGINCODEC_CIF_HEIGHT*4)
    00416
    00417 #define PLUGINCODEC_QCIF_WIDTH   (PLUGINCODEC_CIF_WIDTH/2)
    00418 #define PLUGINCODEC_QCIF_HEIGHT  (PLUGINCODEC_CIF_HEIGHT/2)
    00419
    00420 #define PLUGINCODEC_QCIF4_WIDTH  (PLUGINCODEC_CIF4_WIDTH/2)
    00421 #define PLUGINCODEC_QCIF4_HEIGHT (PLUGINCODEC_CIF4_HEIGHT/2)
    00422
    00423 #define PLUGINCODEC_SQCIF_WIDTH   128
    00424 #define PLUGINCODEC_SQCIF_HEIGHT   96
    00425
    00426
    00427 #ifndef __TIMESTAMP__
    00428 #define __TIMESTAMP__ "0"
    00429 #endif
    00430
    00431 #define PLUGINCODEC_LICENSE(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15) \
    00432   static struct PluginCodec_information MyLicenseInfo = { 0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,__TIMESTAMP__ }
    00433
    00434
    00436 #define PLUGINCODEC_CODEC_PAIR(MediaFormat,     \
    00437                                PayloadName,     \
    00438                                Description,     \
    00439                                SampleRate,      \
    00440                                BitsPerSecond,   \
    00441                                FrameTime,       \
    00442                                p1,p2,p3,p4, \
    00443                                PayloadType,     \
    00444                                H323type,        \
    00445                                H323data,        \
    00446                                CreateEncoder,   \
    00447                                DestroyEncoder,  \
    00448                                EncodeMedia,     \
    00449                                CreateDecoder,   \
    00450                                DestroyDecoder,  \
    00451                                DecodeMedia,     \
    00452                                ControlsTable,   \
    00453                                Flags,           \
    00454                                RawFormat,       \
    00455                                UserData         \
    00456                                ) \
    00457   { \
    00458     PLUGIN_CODEC_VERSION, &MyLicenseInfo, Flags, Description, RawFormat, MediaFormat, UserData, \
    00459     SampleRate, BitsPerSecond, FrameTime, {{ p1,p2,p3,p4 }}, PayloadType, PayloadName, \
    00460     CreateEncoder, DestroyEncoder, EncodeMedia, ControlsTable, H323type, H323data \
    00461   }, \
    00462   { \
    00463     PLUGIN_CODEC_VERSION, &MyLicenseInfo, Flags, Description, MediaFormat, RawFormat, UserData, \
    00464     SampleRate, BitsPerSecond, FrameTime, {{ p1,p2,p3,p4 }}, PayloadType, PayloadName, \
    00465     CreateDecoder, DestroyDecoder, DecodeMedia, ControlsTable, H323type, H323data \
    00466   }
    00467
    00468 #define PLUGINCODEC_AUDIO_CODEC(MediaFormat,      \
    00469                                 PayloadName,      \
    00470                                 Description,      \
    00471                                 SampleRate,       \
    00472                                 BitsPerSecond,    \
    00473                                 SamplesPerFrame,  \
    00474                                 RecFramesPerPacket,  \
    00475                                 MaxFramesPerPacket,  \
    00476                                 RtpFlags,          \
    00477                                 PayloadType,       \
    00478                                 H323type,          \
    00479                                 H323data,          \
    00480                                 CreateEncoder,     \
    00481                                 DestroyEncoder,    \
    00482                                 EncodeAudio,       \
    00483                                 CreateDecoder,     \
    00484                                 DestroyDecoder,    \
    00485                                 DecodeAudio,       \
    00486                                 ControlsTable      \
    00487                                 ) \
    00488          PLUGINCODEC_CODEC_PAIR(MediaFormat, \
    00489                                 PayloadName, \
    00490                                 Description, \
    00491                                 SampleRate, \
    00492                                 BitsPerSecond, \
    00493                                 (SamplesPerFrame)*1000000/(SampleRate), \
    00494                                 SamplesPerFrame, \
    00495                                 (BitsPerSecond)*(SampleRate)/(SamplesPerFrame)/8, \
    00496                                 RecFramesPerPacket, \
    00497                                 MaxFramesPerPacket, \
    00498                                 PayloadType, \
    00499                                 H323type, \
    00500                                 H323data, \
    00501                                 CreateEncoder, \
    00502                                 DestroyEncoder, \
    00503                                 EncodeAudio, \
    00504                                 CreateDecoder, \
    00505                                 DestroyDecoder, \
    00506                                 DecodeAudio, \
    00507                                 ControlsTable, \
    00508                                 PluginCodec_MediaTypeAudio | /* audio codec */ \
    00509                                 PluginCodec_InputTypeRaw |   /* raw input data */ \
    00510                                 PluginCodec_OutputTypeRaw |  /* raw output data */ \
    00511                                 (RtpFlags), \
    00512                                 PLUGINCODEC_RAW_AUDIO, \
    00513                                 NULL)
    00514
    00515 #define PLUGINCODEC_ONE_AUDIO_CODEC(MediaFormat,      \
    00516                                     PayloadName,      \
    00517                                     Description,      \
    00518                                     SampleRate,       \
    00519                                     BitsPerSecond,    \
    00520                                     SamplesPerFrame,  \
    00521                                     RecFramesPerPacket,  \
    00522                                     MaxFramesPerPacket,  \
    00523                                     RtpFlags,          \
    00524                                     PayloadType,       \
    00525                                     H323type,          \
    00526                                     H323data           \
    00527                                 ) \
    00528     static struct PluginCodec_Definition CodecDefinitionTable[] = { \
    00529             PLUGINCODEC_AUDIO_CODEC(MediaFormat, \
    00530                                     PayloadName, \
    00531                                     Description, \
    00532                                     SampleRate, \
    00533                                     BitsPerSecond, \
    00534                                     SamplesPerFrame, \
    00535                                     RecFramesPerPacket, \
    00536                                     MaxFramesPerPacket, \
    00537                                     RtpFlags, \
    00538                                     PayloadType, \
    00539                                     H323type, \
    00540                                     H323data, \
    00541                                     MyCreateEncoder, \
    00542                                     MyDestroyEncoder, \
    00543                                     MyEncodeAudio, \
    00544                                     MyCreateDecoder, \
    00545                                     MyDestroyDecoder, \
    00546                                     MyDecodeAudio, \
    00547                                     MyControlsTable \
    00548                                     ) \
    00549     }
    00550
    00551 #define PLUGINCODEC_VIDEO_CODEC(MediaFormat,      \
    00552                                 PayloadName,      \
    00553                                 Description,      \
    00554                                 BitsPerSecond,    \
    00555                                 MaxWidth,         \
    00556                                 MaxHeight,        \
    00557                                 RtpFlags,         \
    00558                                 PayloadType,      \
    00559                                 H323type,         \
    00560                                 H323data,         \
    00561                                 CreateEncoder,    \
    00562                                 DestroyEncoder,   \
    00563                                 EncodeVideo,      \
    00564                                 CreateDecoder,    \
    00565                                 DestroyDecoder,   \
    00566                                 DecodeVideo,      \
    00567                                 ControlsTable     \
    00568                                 ) \
    00569          PLUGINCODEC_CODEC_PAIR(MediaFormat, \
    00570                                 PayloadName, \
    00571                                 Description, \
    00572                                 SampleRate, \
    00573                                 BitsPerSecond, \
    00574                                 PLUGINCODEC_VIDEO_CLOCK, \
    00575                                 BitsPerSecond, \
    00576                                 1000000/PLUGINCODEC_MAX_FRAME_RATE, \
    00577                                 MaxWidth, \
    00578                                 MaxHeight, \
    00579                                 0,PLUGINCODEC_MAX_FRAME_RATE, \
    00580                                 PayloadType, \
    00581                                 H323type, \
    00582                                 H323data, \
    00583                                 CreateEncoder, \
    00584                                 DestroyEncoder, \
    00585                                 EncodeVideo, \
    00586                                 CreateDecoder, \
    00587                                 DestroyDecoder, \
    00588                                 DecodeVideo, \
    00589                                 ControlsTable, \
    00590                                 PluginCodec_MediaTypeVideo | /* video codec */ \
    00591                                 PluginCodec_InputTypeRTP |   /* RTP input data */ \
    00592                                 PluginCodec_OutputTypeRTP |  /* RTP output data */ \
    00593                                 (RtpFlags), \
    00594                                 PLUGINCODEC_RAW_VIDEO, \
    00595                                 NULL)
    00596
    00597 #define PLUGINCODEC_ONE_VIDEO_CODEC(MediaFormat,      \
    00598                                     PayloadName,      \
    00599                                     Description,      \
    00600                                     BitsPerSecond,    \
    00601                                     MaxWidth,         \
    00602                                     MaxHeight,        \
    00603                                     RtpFlags,         \
    00604                                     PayloadType,      \
    00605                                     H323type,         \
    00606                                     H323data          \
    00607                                 ) \
    00608     static struct PluginCodec_Definition CodecDefinitionTable[] = { \
    00609             PLUGINCODEC_VIDEO_CODEC(MediaFormat, \
    00610                                     PayloadName, \
    00611                                     Description, \
    00612                                     BitsPerSecond, \
    00613                                     MaxWidth, \
    00614                                     MaxHeight, \
    00615                                     RtpFlags, \
    00616                                     PayloadType, \
    00617                                     H323type, \
    00618                                     H323data, \
    00619                                     CreateEncoder, \
    00620                                     DestroyEncoder, \
    00621                                     EncodeAudio, \
    00622                                     CreateDecoder, \
    00623                                     DestroyDecoder, \
    00624                                     DecodeAudio, \
    00625                                     ControlsTable \
    00626                                     ) \
    00627     }
    00628
    00629
    00631 //
    00632 //  H.323 specific values
    00633 //
    00634
    00635
    00636 struct PluginCodec_H323CapabilityExtension {
    00637   unsigned int index;
    00638   void * data;
    00639   unsigned dataLength;
    00640 };
    00641
    00642 struct PluginCodec_H323NonStandardCodecData {
    00643   const char * objectId;
    00644   unsigned char  t35CountryCode;
    00645   unsigned char  t35Extension;
    00646   unsigned short manufacturerCode;
    00647   const unsigned char * data;
    00648   unsigned int dataLength;
    00649   int (*capabilityMatchFunction)(struct PluginCodec_H323NonStandardCodecData *);
    00650 };
    00651
    00652
    00653 struct PluginCodec_H323GenericParameterDefinition
    00654 {
    00655   /* The following used to be a simple integer for the collapsing flag in
    00656      version 3 and earlier. We hope that all those implementations just used
    00657      zero and one (a good bet) and thus the below bit fields will be backward
    00658      compatible, putting the parameter in all three PDU types.
    00659    */
    00660 #ifndef SOLARIS
    00661   struct {
    00662 #endif
    00663     int collapsing:1; /* boolean */
    00664     int excludeTCS:1;
    00665     int excludeOLC:1;
    00666     int excludeReqMode:1;
    00667     int readOnly:1;
    00668 #ifndef SOLARIS
    00669   };
    00670 #endif
    00671
    00672   unsigned int id;
    00673
    00674   enum PluginCodec_H323GenericParameterType {
    00675     /* these need to be in the same order as the choices in
    00676       H245_ParameterValue::Choices, as the value is just cast to that type
    00677     */
    00678     PluginCodec_GenericParameter_Logical = 0,
    00679     PluginCodec_GenericParameter_BooleanArray,
    00680     PluginCodec_GenericParameter_UnsignedMin,
    00681     PluginCodec_GenericParameter_UnsignedMax,
    00682     PluginCodec_GenericParameter_Unsigned32Min,
    00683     PluginCodec_GenericParameter_Unsigned32Max,
    00684     PluginCodec_GenericParameter_OctetString,
    00685     PluginCodec_GenericParameter_GenericParameter,
    00686
    00687     PluginCodec_GenericParameter_logical = 0,
    00688     PluginCodec_GenericParameter_booleanArray,
    00689     PluginCodec_GenericParameter_unsignedMin,
    00690     PluginCodec_GenericParameter_unsignedMax,
    00691     PluginCodec_GenericParameter_unsigned32Min,
    00692     PluginCodec_GenericParameter_unsigned32Max,
    00693     PluginCodec_GenericParameter_octetString,
    00694     PluginCodec_GenericParameter_genericParameter
    00695   } type;
    00696
    00697   union {
    00698     unsigned long integer;
    00699     const char * octetstring;
    00700     struct PluginCodec_H323GenericParameterDefinition *genericparameter;
    00701   } value;
    00702 };
    00703
    00704 struct PluginCodec_H323GenericCodecData
    00705 {
    00706   // some cunning structures & lists, and associated logic in
    00707   // H323CodecPluginGenericAudioCapability::H323CodecPluginGenericAudioCapability()
    00708   const char * standardIdentifier;
    00709   unsigned int maxBitRate; // Zero means use value from OpalMediaFormat
    00710
    00711   /* parameters; these are the parameters which are set in the
    00712      'TerminalCapabilitySet' and 'OpenLogicalChannel' requests */
    00713   unsigned int nParameters;
    00714   /* an array of nParameters parameter definitions */
    00715   const struct PluginCodec_H323GenericParameterDefinition *params;
    00716 };
    00717
    00718
    00719 struct PluginCodec_H323AudioGSMData {
    00720   int comfortNoise:1;
    00721   int scrambled:1;
    00722 };
    00723
    00724 struct  PluginCodec_H323AudioG7231AnnexC {
    00725   unsigned char maxAl_sduAudioFrames;
    00726   int silenceSuppression:1;
    00727   int highRateMode0:6;          // INTEGER (27..78),  -- units octets
    00728   int  highRateMode1:6;          // INTEGER (27..78),  -- units octets
    00729   int  lowRateMode0:6;            // INTEGER (23..66),  -- units octets
    00730   int  lowRateMode1:6;            // INTEGER (23..66),  -- units octets
    00731   int  sidMode0:4;                // INTEGER (6..17),  -- units octets
    00732   int  sidMode1:4;                // INTEGER (6..17),  -- units octets
    00733 };
    00734
    00735
    00736 enum {
    00737   PluginCodec_H323Codec_undefined,      // must be zero, so empty struct is undefined
    00738   PluginCodec_H323Codec_programmed,      // H323ProgrammedCapability
    00739   PluginCodec_H323Codec_nonStandard,    // H323NonStandardData
    00740   PluginCodec_H323Codec_generic,            // H323GenericCodecData
    00741
    00742   // audio codecs
    00743   PluginCodec_H323AudioCodec_g711Alaw_64k,        // int
    00744   PluginCodec_H323AudioCodec_g711Alaw_56k,        // int
    00745   PluginCodec_H323AudioCodec_g711Ulaw_64k,        // int
    00746   PluginCodec_H323AudioCodec_g711Ulaw_56k,        // int
    00747   PluginCodec_H323AudioCodec_g722_64k,            // int
    00748   PluginCodec_H323AudioCodec_g722_56k,            // int
    00749   PluginCodec_H323AudioCodec_g722_48k,            // int
    00750   PluginCodec_H323AudioCodec_g7231,                // H323AudioG7231Data
    00751   PluginCodec_H323AudioCodec_g728,                // int
    00752   PluginCodec_H323AudioCodec_g729,                // int
    00753   PluginCodec_H323AudioCodec_g729AnnexA,          // int
    00754   PluginCodec_H323AudioCodec_is11172,             // not yet implemented
    00755   PluginCodec_H323AudioCodec_is13818Audio,        // not yet implemented
    00756   PluginCodec_H323AudioCodec_g729wAnnexB,          // int
    00757   PluginCodec_H323AudioCodec_g729AnnexAwAnnexB,    // int
    00758   PluginCodec_H323AudioCodec_g7231AnnexC,         // H323AudioG7231AnnexC
    00759   PluginCodec_H323AudioCodec_gsmFullRate,          // H323AudioGSMData
    00760   PluginCodec_H323AudioCodec_gsmHalfRate,          // H323AudioGSMData
    00761   PluginCodec_H323AudioCodec_gsmEnhancedFullRate,  // H323AudioGSMData
    00762   PluginCodec_H323AudioCodec_g729Extensions,      // not yet implemented
    00763
    00764   // video codecs
    00765   PluginCodec_H323VideoCodec_h261,                // implemented
    00766   PluginCodec_H323VideoCodec_h262,                // not yet implemented
    00767   PluginCodec_H323VideoCodec_h263,                // implemented
    00768   PluginCodec_H323VideoCodec_is11172,             // not yet implemented
    00769
    00770   // other capabilities
    00771   PluginCodec_H323VideoCodec_Extended,            // implemented (for use with H.239)
    00772   PluginCodec_H323T38Codec,                       // not yet implemented
    00773
    00774   // special codes
    00775   PluginCodec_H323Codec_NoH323 = 0xff,            // used for SIP-only codecs
    00776 };
    00777
    00779 //
    00780 // Generic Codec Standard Identifiers
    00781 //
    00782
    00783 // Audio Capabilities
    00784 // AMR (as defined in H.245v13 Annex I)
    00785 #define OpalPluginCodec_Identifer_AMR             "0.0.8.245.1.1.1"
    00786
    00787 // AMR-NB\WB  (as defined in H.245v13 Annex R)
    00788 #define OpalPluginCodec_Identifer_AMR_NB          "0.0.8.245.1.1.9"
    00789 #define OpalPluginCodec_Identifer_AMR_WB          "0.0.8.245.1.1.10"
    00790
    00791 // G.722.1
    00792 #define OpalPluginCodec_Identifer_G7221           "0.0.7.7221.1.0"
    00793 #define OpalPluginCodec_Identifer_G7221ext        "0.0.7.7221.1.1.0"
    00794
    00795 // G.722.2 (aka AMR-WB)
    00796 #define OpalPluginCodec_Identifer_G7222           "0.0.7.7222.1.0"
    00797
    00798 // iLBC (as defined in H.245v13 Annex S)
    00799 #define OpalPluginCodec_Identifer_iLBC            "0.0.8.245.1.1.11"
    00800
    00801
    00802 // Video Capabilities
    00803
    00804 // H264 (as defined in H.241)
    00805 #define OpalPluginCodec_Identifer_H264_Aligned        "0.0.8.241.0.0.0.0"
    00806 #define OpalPluginCodec_Identifer_H264_NonInterleaved "0.0.8.241.0.0.0.1"
    00807 #define OpalPluginCodec_Identifer_H264_Interleaved    "0.0.8.241.0.0.0.2"
    00808 #define OpalPluginCodec_Identifer_H264_Generic        "0.0.8.241.0.0.1"
    00809
    00810 // ISO/IEC 14496-2 MPEG4 part 2 (as defined in H.245v13 Annex E)
    00811 #define OpalPluginCodec_Identifer_MPEG4           "0.0.8.245.1.0.0"
    00812
    00813
    00815 //
    00816 // Predefined options for H.323 codecs
    00817 //
    00818
    00819 #define PLUGINCODEC_SQCIF_MPI   "SQCIF MPI"
    00820 #define PLUGINCODEC_QCIF_MPI     "QCIF MPI"
    00821 #define PLUGINCODEC_CIF_MPI       "CIF MPI"
    00822 #define PLUGINCODEC_CIF4_MPI     "CIF4 MPI"
    00823 #define PLUGINCODEC_CIF16_MPI   "CIF16 MPI"
    00824 #define PLUGINCODEC_CUSTOM_MPI "Custom MPI"
    00825
    00826 #define PLUGINCODEC_MPI_DISABLED 33
    00827
    00828 #define PLUGINCODEC_MEDIA_PACKETIZATION  "Media Packetization"
    00829 #define PLUGINCODEC_MEDIA_PACKETIZATIONS "Media Packetizations"
    00830
    00831 #define H261_ANNEX_D "Annex D - Still Image Transmit"
    00832 #define H263_ANNEX_D "Annex D - Unrestricted Motion Vector"
    00833 #define H263_ANNEX_F "Annex F - Advanced Prediction"
    00834 #define H263_ANNEX_I "Annex I - Advanced INTRA Coding"
    00835 #define H263_ANNEX_J "Annex J - Deblocking Filter"
    00836 #define H263_ANNEX_K "Annex K - Slice Structure"
    00837 #define H263_ANNEX_N "Annex N - Reference Picture Selection"
    00838 #define H263_ANNEX_S "Annex S - Alternative INTER VLC"
    00839 #define H263_ANNEX_T "Annex T - Modified Quantization"
    00840
    00841 #ifndef STRINGIZE
    00842 #define __INTERNAL_STRINGIZE__(v) #v
    00843 #define STRINGIZE(v) __INTERNAL_STRINGIZE__(v)
    00844 #endif
    00845
    00846
    00848 //
    00849 // RTP specific definitions
    00850 //
    00851
    00852 #define PluginCodec_RTP_MaxPacketSize  (1518-14-4-8-20-16)  // Max Ethernet packet (1518 bytes) minus 802.3/CRC, 802.3, IP, UDP headers
    00853 #define PluginCodec_RTP_MinHeaderSize  (12)
    00854 #define PluginCodec_RTP_MaxPayloadSize (PluginCodec_RTP_MaxPacketSize - PluginCodec_RTP_MinHeaderSize)
    00855
    00856 #define PluginCodec_RTP_GetWORD(ptr, off)       ((((unsigned char*)(ptr))[off] << 8) | ((unsigned char*)(ptr))[off+1])
    00857
    00858 #define PluginCodec_RTP_GetDWORD(ptr, off)      ((((unsigned char*)(ptr))[off  ] << 24)|\
    00859                                                  (((unsigned char*)(ptr))[off+1] << 16)|\
    00860                                                  (((unsigned char*)(ptr))[off+2] << 8 )|\
    00861                                                   ((unsigned char*)(ptr))[off+3])
    00862
    00863 #define PluginCodec_RTP_SetWORD(ptr, off, val)  ((((unsigned char*)(ptr))[off  ] = (unsigned char)((val) >> 8 )),\
    00864                                                  (((unsigned char*)(ptr))[off+1] = (unsigned char) (val)      ))
    00865
    00866 #define PluginCodec_RTP_SetDWORD(ptr, off, val) ((((unsigned char*)(ptr))[off  ] = (unsigned char)((val) >> 24)),\
    00867                                                  (((unsigned char*)(ptr))[off+1] = (unsigned char)((val) >> 16)),\
    00868                                                  (((unsigned char*)(ptr))[off+2] = (unsigned char)((val) >> 8 )),\
    00869                                                  (((unsigned char*)(ptr))[off+3] = (unsigned char) (val)      ))
    00870
    00871 #define PluginCodec_RTP_GetCSRCHdrLength(ptr)      ((((unsigned char*)(ptr))[0] & 0x0f)*4 + PluginCodec_RTP_MinHeaderSize)
    00872 #define PluginCodec_RTP_GetExtHdrLength(ptr)       ((((unsigned char*)(ptr))[0] & 0x10) ? (PluginCodec_RTP_GetWORD(ptr, PluginCodec_RTP_GetCSRCHdrLength(ptr)+2)*4+4) : 0)
    00873
    00874 #define PluginCodec_RTP_GetHeaderLength(ptr)       (PluginCodec_RTP_GetCSRCHdrLength(ptr) + PluginCodec_RTP_GetExtHdrLength(ptr))
    00875 #define PluginCodec_RTP_GetPayloadPtr(ptr)           ((unsigned char*)(ptr) + PluginCodec_RTP_GetHeaderLength(ptr))
    00876 #define PluginCodec_RTP_GetPayloadType(ptr)         (((unsigned char*)(ptr))[1] & 0x7f)
    00877 #define PluginCodec_RTP_SetPayloadType(ptr, type)   (((unsigned char*)(ptr))[1] = (unsigned char)((((unsigned char*)(ptr))[1] & 0x80) | (type & 0x7f)))
    00878 #define PluginCodec_RTP_GetMarker(ptr)             ((((unsigned char*)(ptr))[1] & 0x80) != 0)
    00879 #define PluginCodec_RTP_SetMarker(ptr, mark)        (((unsigned char*)(ptr))[1] = (unsigned char)((((unsigned char*)(ptr))[1] & 0x7f) | (mark != 0 ? 0x80 : 0)))
    00880 #define PluginCodec_RTP_GetTimestamp(ptr)          PluginCodec_RTP_GetDWORD(ptr, 4)
    00881 #define PluginCodec_RTP_SetTimestamp(ptr, ts)      PluginCodec_RTP_SetDWORD(ptr, 4, ts)
    00882 #define PluginCodec_RTP_GetSequenceNumber(ptr)     PluginCodec_RTP_GetWORD(ptr, 2)
    00883 #define PluginCodec_RTP_SetSequenceNumber(ptr, sn) PluginCodec_RTP_SetWORD(ptr, 2, sn)
    00884 #define PluginCodec_RTP_GetSSRC(ptr)               PluginCodec_RTP_GetDWORD(ptr, 8)
    00885 #define PluginCodec_RTP_SetSSRC(ptr, ssrc)         PluginCodec_RTP_SetDWORD(ptr, 8, ssrc)
    00886
    00887
    00888
    00890 //
    00891 // video specific definitions
    00892 //
    00893
    00894 struct PluginCodec_Video_FrameHeader {
    00895   unsigned int  x;
    00896   unsigned int  y;
    00897   unsigned int  width;
    00898   unsigned int  height;
    00899 };
    00900
    00901 #ifdef __cplusplus
    00902 };
    00903
    00904 inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(struct PluginCodec_Video_FrameHeader * base)
    00905 { return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); }
    00906
    00907 inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(const PluginCodec_Video_FrameHeader * base)
    00908 { return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); }
    00909
    00910 extern "C" {
    00911 #endif
    00912
    00913
    00915 //
    00916 // experimental definitions for statically linking codecs
    00917 //
    00918
    00919 #ifdef OPAL_STATIC_CODEC
    00920
    00921 #  undef PLUGIN_CODEC_DLL_API
    00922 #  define PLUGIN_CODEC_DLL_API static
    00923 #  define PLUGIN_CODEC_IMPLEMENT(name) \
    00924 unsigned int Opal_StaticCodec_##name##_GetAPIVersion() \
    00925 { return PWLIB_PLUGIN_API_VERSION; } \
    00926 static const struct PluginCodec_Definition * PLUGIN_CODEC_GET_CODEC_FN(unsigned * count, unsigned /*version*/); \
    00927 struct const PluginCodec_Definition * Opal_StaticCodec_##name##_GetCodecs(unsigned * p1, unsigned p2) \
    00928 { return PLUGIN_CODEC_GET_CODEC_FN(p1,p2); } \
    00929
    00930 #  define PLUGIN_CODEC_IMPLEMENT_ALL(name, table, ver) \
    00931 unsigned int Opal_StaticCodec_##name##_GetAPIVersion() \
    00932 { return PWLIB_PLUGIN_API_VERSION; } \
    00933 PLUGIN_CODEC_DLL_API const struct PluginCodec_Definition * Opal_StaticCodec_##name##_GetCodecs(unsigned * count, unsigned version) \
    00934 { *count = sizeof(table)/sizeof(struct PluginCodec_Definition); return version < ver ? NULL : table; }
    00935
    00936
    00937 #else
    00938
    00939 #  define PLUGIN_CODEC_IMPLEMENT(name) \
    00940 PLUGIN_CODEC_DLL_API unsigned int PLUGIN_CODEC_API_VER_FN() \
    00941 { return PWLIB_PLUGIN_API_VERSION; } \
    00942
    00943 #  define PLUGIN_CODEC_IMPLEMENT_ALL(name, table, ver) \
    00944 PLUGIN_CODEC_IMPLEMENT(name) \
    00945 PLUGIN_CODEC_DLL_API const struct PluginCodec_Definition * PLUGIN_CODEC_GET_CODEC_FN(unsigned * count, unsigned version) \
    00946 { *count = sizeof(table)/sizeof(struct PluginCodec_Definition); return version < ver ? NULL : table; }
    00947
    00948
    00949 #endif
    00950
    00951 #ifdef __cplusplus
    00952 };
    00953 #endif
    00954
    00955
    00956 #ifdef _MSC_VER
    00957 #pragma warning(default:4201)
    00958 #endif
    00959
    00960 #endif // OPAL_CODEC_OPALPLUGIN_H