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
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 #ifndef __OPAL_H323PLUGINMGR_H
00103 #define __OPAL_H323PLUGINMGR_H
00104
00105 #ifdef P_USE_PRAGMA
00106 #pragma interface
00107 #endif
00108
00109 #include <ptlib/pluginmgr.h>
00110 #include <opalplugin.h>
00111 #include <mediafmt.h>
00112 #include <ptlib/pfactory.h>
00113
00114 namespace PWLibStupidLinkerHacks {
00115
00116 #ifndef NO_H323_VIDEO
00117 extern int h261Loader;
00118 extern int rfc2190h263Loader;
00119 #endif
00120
00121 extern int opalwavfileLoader;
00122
00123 extern void H323BootStrapPlugins();
00124 extern void H323BootStrapNonPlugins();
00125
00126 }
00127
00128
00129 class H323PluginCodecManager : public PPluginModuleManager
00130 {
00131 PCLASSINFO(H323PluginCodecManager, PPluginModuleManager);
00132 public:
00133 H323PluginCodecManager(PPluginManager * pluginMgr = NULL);
00134 ~H323PluginCodecManager();
00135
00136 void RegisterStaticCodec(const char * name,
00137 PluginCodec_GetAPIVersionFunction getApiVerFn,
00138 PluginCodec_GetCodecFunction getCodecFn);
00139
00140 void OnLoadPlugin(PDynaLink & dll, INT code);
00141
00142 static OpalMediaFormat::List GetMediaFormats();
00143 static void AddFormat(const OpalMediaFormat & fmt);
00144 static void AddFormat(OpalMediaFormat * fmt);
00145
00146 virtual void OnShutdown();
00147
00148 protected:
00149 void CreateCapabilityAndMediaFormat(
00150 PluginCodec_Definition * _encoderCodec,
00151 PluginCodec_Definition * _decoderCodec
00152 );
00153
00154 static OpalMediaFormat::List & GetMediaFormatList();
00155 static PMutex & GetMediaFormatMutex();
00156
00157 void RegisterCodecs (unsigned int count, void * codecList);
00158 void UnregisterCodecs(unsigned int count, void * codecList);
00159
00160 friend void PWLibStupidLinkerHacks::H323BootStrapPlugins();
00161 };
00162
00163 class H323DynaLink : public PDynaLink
00164 {
00165 PCLASSINFO(H323DynaLink, PDynaLink)
00166
00167 public:
00168 H323DynaLink(const char * basename, const char * reason = NULL);
00169
00170 virtual void Load();
00171 virtual BOOL IsLoaded()
00172 { PWaitAndSignal m(processLock); return isLoadedOK; }
00173 virtual BOOL LoadPlugin (const PString & fileName);
00174
00175 protected:
00176 PMutex processLock;
00177 BOOL isLoadedOK;
00178 const char * baseName;
00179 const char * reason;
00180 };
00181
00183
00184
00185
00186
00187 class OpalFactoryCodec : public PObject {
00188 PCLASSINFO(OpalFactoryCodec, PObject)
00189 public:
00190 virtual const struct PluginCodec_Definition * GetDefinition()
00191 { return NULL; }
00192
00193 virtual PString GetInputFormat() const = 0;
00194 virtual PString GetOutputFormat() const = 0;
00195
00196 virtual int Encode(const void * from, unsigned * fromLen,
00197 void * to, unsigned * toLen,
00198 unsigned int * flag) = 0;
00199
00200 virtual unsigned int GetSampleRate() const = 0;
00201 virtual unsigned int GetBitsPerSec() const = 0;
00202 virtual unsigned int GetFrameTime() const = 0;
00203 virtual unsigned int GetSamplesPerFrame() const = 0;
00204 virtual unsigned int GetBytesPerFrame() const = 0;
00205 virtual unsigned int GetRecommendedFramesPerPacket() const = 0;
00206 virtual unsigned int GetMaxFramesPerPacket() const = 0;
00207 virtual BYTE GetRTPPayload() const = 0;
00208 virtual PString GetSDPFormat() const = 0;
00209 };
00210
00211 #endif