00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 #ifndef __OPAL_H323PLUGIN_H
00081 #define __OPAL_H323PLUGIN_H
00082
00083 #ifdef __cplusplus
00084 extern "C" {
00085 #endif
00086
00087 #include <time.h>
00088
00089 #ifdef _WIN32
00090 # ifdef PLUGIN_CODEC_DLL_EXPORTS
00091 # define PLUGIN_CODEC_DLL_API __declspec(dllexport)
00092 # else
00093 # define PLUGIN_CODEC_DLL_API __declspec(dllimport)
00094 # endif
00095
00096 #else
00097
00098 #define PLUGIN_CODEC_DLL_API
00099
00100 #endif
00101
00102 #define PWLIB_PLUGIN_API_VERSION 0
00103
00104 #define PLUGIN_CODEC_VERSION 1 // initial version
00105 #define PLUGIN_CODEC_VERSION_WIDEBAND 2 // added wideband
00106
00107 #define PLUGIN_CODEC_API_VER_FN PWLibPlugin_GetAPIVersion
00108 #define PLUGIN_CODEC_API_VER_FN_STR "PWLibPlugin_GetAPIVersion"
00109
00110 #define PLUGIN_CODEC_GET_CODEC_FN OpalCodecPlugin_GetCodecs
00111 #define PLUGIN_CODEC_GET_CODEC_FN_STR "OpalCodecPlugin_GetCodecs"
00112
00113 #define PLUGIN_CODEC_API_VER_FN_DECLARE \
00114 PLUGIN_CODEC_DLL_API unsigned int PLUGIN_CODEC_API_VER_FN() \
00115 { return PWLIB_PLUGIN_API_VERSION; }
00116
00117 enum {
00118 PluginCodec_Licence_None = 0,
00119 PluginCodec_License_GPL = 1,
00120 PluginCodec_License_MPL = 2,
00121 PluginCodec_License_Freeware = 3,
00122 PluginCodec_License_ResearchAndDevelopmentUseOnly = 4,
00123 PluginCodec_License_BSD = 5,
00124
00125 PluginCodec_License_NoRoyalties = 0x7f,
00126
00127
00128 PluginCodec_License_RoyaltiesRequired = 0x80
00129 };
00130
00131 struct PluginCodec_information {
00132
00133 time_t timestamp;
00134
00135 const char * sourceAuthor;
00136 const char * sourceVersion;
00137 const char * sourceEmail;
00138 const char * sourceURL;
00139 const char * sourceCopyright;
00140 const char * sourceLicense;
00141 unsigned char sourceLicenseCode;
00142
00143 const char * codecDescription;
00144 const char * codecAuthor;
00145 const char * codecVersion;
00146 const char * codecEmail;
00147 const char * codecURL;
00148 const char * codecCopyright;
00149 const char * codecLicense;
00150 unsigned short codecLicenseCode;
00151
00152
00153 };
00154
00155 enum PluginCodec_Flags {
00156 PluginCodec_MediaTypeMask = 0x000f,
00157 PluginCodec_MediaTypeAudio = 0x0000,
00158 PluginCodec_MediaTypeVideo = 0x0001,
00159 PluginCodec_MediaTypeAudioStreamed = 0x0002,
00160
00161 PluginCodec_InputTypeMask = 0x0010,
00162 PluginCodec_InputTypeRaw = 0x0000,
00163 PluginCodec_InputTypeRTP = 0x0010,
00164
00165 PluginCodec_OutputTypeMask = 0x0020,
00166 PluginCodec_OutputTypeRaw = 0x0000,
00167 PluginCodec_OutputTypeRTP = 0x0020,
00168
00169 PluginCodec_RTPTypeMask = 0x0040,
00170 PluginCodec_RTPTypeDynamic = 0x0000,
00171 PluginCodec_RTPTypeExplicit = 0x0040,
00172
00173 PluginCodec_RTPSharedMask = 0x0080,
00174 PluginCodec_RTPTypeNotShared = 0x0000,
00175 PluginCodec_RTPTypeShared = 0x0080,
00176
00177 PluginCodec_DecodeSilenceMask = 0x0100,
00178 PluginCodec_NoDecodeSilence = 0x0000,
00179 PluginCodec_DecodeSilence = 0x0100,
00180
00181 PluginCodec_BitsPerSamplePos = 12,
00182 PluginCodec_BitsPerSampleMask = 0xf000,
00183 };
00184
00185 enum PluginCodec_CoderFlags {
00186 PluginCodec_CoderSilenceFrame = 1
00187 };
00188
00189 struct PluginCodec_Definition;
00190
00191 struct PluginCodec_ControlDefn {
00192 const char * name;
00193 int (*control)(const struct PluginCodec_Definition * codec, void * context,
00194 const char * name, void * parm, unsigned * parmLen);
00195
00196 };
00197
00198 struct PluginCodec_Definition {
00199 unsigned int version;
00200
00201
00202 struct PluginCodec_information * info;
00203
00204 unsigned int flags;
00205
00206
00207
00208
00209
00210 const char * descr;
00211
00212 const char * sourceFormat;
00213 const char * destFormat;
00214
00215 const void * userData;
00216
00217 unsigned int sampleRate;
00218 unsigned int bitsPerSec;
00219 unsigned int nsPerFrame;
00220 unsigned int samplesPerFrame;
00221 unsigned int bytesPerFrame;
00222 unsigned int recommendedFramesPerPacket;
00223 unsigned int maxFramesPerPacket;
00224
00225 unsigned char rtpPayload;
00226 const char * sdpFormat;
00227
00228 void * (*createCodec)(const struct PluginCodec_Definition * codec);
00229 void (*destroyCodec) (const struct PluginCodec_Definition * codec, void * context);
00230 int (*codecFunction) (const struct PluginCodec_Definition * codec, void * context,
00231 const void * from, unsigned * fromLen,
00232 void * to, unsigned * toLen,
00233 unsigned int * flag);
00234 struct PluginCodec_ControlDefn * codecControls;
00235
00236
00237 unsigned char h323CapabilityType;
00238 void * h323CapabilityData;
00239
00240
00241 };
00242
00243 typedef struct PluginCodec_Definition * (* PluginCodec_GetCodecFunction)(unsigned int *, unsigned int);
00244 typedef unsigned (* PluginCodec_GetAPIVersionFunction)();
00245
00247
00248
00249
00250
00251
00252 struct PluginCodec_H323CapabilityExtension {
00253 unsigned int index;
00254 void * data;
00255 unsigned dataLength;
00256 };
00257
00258 struct PluginCodec_H323NonStandardCodecData {
00259 const char * objectId;
00260 unsigned char t35CountryCode;
00261 unsigned char t35Extension;
00262 unsigned short manufacturerCode;
00263 const unsigned char * data;
00264 unsigned int dataLength;
00265 int (*capabilityMatchFunction)(struct PluginCodec_H323NonStandardCodecData *);
00266 };
00267
00268 struct PluginCodec_H323AudioGSMData {
00269 int comfortNoise:1;
00270 int scrambled:1;
00271 };
00272
00273 struct PluginCodec_H323AudioG7231AnnexC {
00274 unsigned char maxAl_sduAudioFrames;
00275 int silenceSuppression:1;
00276 int highRateMode0:6;
00277 int highRateMode1:6;
00278 int lowRateMode0:6;
00279 int lowRateMode1:6;
00280 int sidMode0:4;
00281 int sidMode1:4;
00282 };
00283
00284 struct PluginCodec_H323VideoH261
00285 {
00286 int qcifMPI:2;
00287 int cifMPI:2;
00288 int temporalSpatialTradeOffCapability;
00289 int maxBitRate;
00290 int stillImageTransmission:1;
00291 int videoBadMBsCap:1;
00292 const struct PluginCodec_H323CapabilityExtension * extensions;
00293 };
00294
00295 enum {
00296 PluginCodec_H323Codec_undefined,
00297 PluginCodec_H323Codec_programmed,
00298 PluginCodec_H323Codec_nonStandard,
00299 PluginCodec_H323Codec_generic,
00300
00301
00302 PluginCodec_H323AudioCodec_g711Alaw_64k,
00303 PluginCodec_H323AudioCodec_g711Alaw_56k,
00304 PluginCodec_H323AudioCodec_g711Ulaw_64k,
00305 PluginCodec_H323AudioCodec_g711Ulaw_56k,
00306 PluginCodec_H323AudioCodec_g722_64k,
00307 PluginCodec_H323AudioCodec_g722_56k,
00308 PluginCodec_H323AudioCodec_g722_48k,
00309 PluginCodec_H323AudioCodec_g7231,
00310 PluginCodec_H323AudioCodec_g728,
00311 PluginCodec_H323AudioCodec_g729,
00312 PluginCodec_H323AudioCodec_g729AnnexA,
00313 PluginCodec_H323AudioCodec_is11172,
00314 PluginCodec_H323AudioCodec_is13818Audio,
00315 PluginCodec_H323AudioCodec_g729wAnnexB,
00316 PluginCodec_H323AudioCodec_g729AnnexAwAnnexB,
00317 PluginCodec_H323AudioCodec_g7231AnnexC,
00318 PluginCodec_H323AudioCodec_gsmFullRate,
00319 PluginCodec_H323AudioCodec_gsmHalfRate,
00320 PluginCodec_H323AudioCodec_gsmEnhancedFullRate,
00321 PluginCodec_H323AudioCodec_g729Extensions,
00322
00323
00324 PluginCodec_H323VideoCodec_h261,
00325 PluginCodec_H323VideoCodec_h262,
00326 PluginCodec_H323VideoCodec_h263,
00327 PluginCodec_H323VideoCodec_is11172,
00328 };
00329
00330
00331
00332 #ifdef OPAL_STATIC_CODEC
00333
00334 # undef PLUGIN_CODEC_DLL_API
00335 # define PLUGIN_CODEC_DLL_API static
00336 # define PLUGIN_CODEC_IMPLEMENT(name) \
00337 unsigned int Opal_StaticCodec_##name##_GetAPIVersion() \
00338 { return PWLIB_PLUGIN_API_VERSION; } \
00339 static struct PluginCodec_Definition * PLUGIN_CODEC_GET_CODEC_FN(unsigned * count, unsigned ); \
00340 struct PluginCodec_Definition * Opal_StaticCodec_##name##_GetCodecs(unsigned * p1, unsigned p2) \
00341 { return PLUGIN_CODEC_GET_CODEC_FN(p1,p2); } \
00342
00343 #else
00344
00345 # define PLUGIN_CODEC_IMPLEMENT(name) \
00346 PLUGIN_CODEC_DLL_API unsigned int PLUGIN_CODEC_API_VER_FN() \
00347 { return PWLIB_PLUGIN_API_VERSION; } \
00348
00349 #endif
00350
00351 #ifdef __cplusplus
00352 };
00353 #endif
00354
00355 #endif