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: h323pluginmgr.h,v $ 00027 * Revision 1.2 2007/08/20 20:19:52 shorne 00028 * Moved opalplugin.h to codec directory to be plugin compile compatible with Opal 00029 * 00030 * Revision 1.1 2007/08/06 20:50:49 shorne 00031 * First commit of h323plus 00032 * 00033 * Revision 1.24.4.1 2006/12/23 19:08:02 shorne 00034 * Plugin video codecs & sundry 00035 * 00036 * Revision 1.24 2005/11/30 13:05:01 csoutheren 00037 * Changed tags for Doxygen 00038 * 00039 * Revision 1.23 2005/06/21 06:46:35 csoutheren 00040 * Add ability to create capabilities without codecs for external RTP interface 00041 * 00042 * Revision 1.22 2005/04/28 04:00:15 dereksmithies 00043 * Add documentation to the OpalFactoryCodec. Thanks to Craig Southeren for clarifying 00044 * the meaning of the toLen field. 00045 * 00046 * Revision 1.21 2005/01/04 08:08:39 csoutheren 00047 * More changes to implement the new configuration methodology, and also to 00048 * attack the global static problem 00049 * 00050 * Revision 1.20 2005/01/03 14:03:20 csoutheren 00051 * Added new configure options and ability to disable/enable modules 00052 * 00053 * Revision 1.19 2004/12/08 02:03:58 csoutheren 00054 * Fixed problem with detection of non-FFH.263 00055 * 00056 * Revision 1.18 2004/11/29 06:30:51 csoutheren 00057 * Added support for wideband codecs 00058 * 00059 * Revision 1.17 2004/08/26 08:05:02 csoutheren 00060 * Codecs now appear in abstract factory system 00061 * Fixed Windows factory bootstrap system (again) 00062 * 00063 * Revision 1.16 2004/06/30 12:31:09 rjongbloed 00064 * Rewrite of plug in system to use single global variable for all factories to avoid all sorts 00065 * of issues with startup orders and Windows DLL multiple instances. 00066 * 00067 * Revision 1.15 2004/06/03 23:20:46 csoutheren 00068 * Fixed compile problem on some gcc variants 00069 * 00070 * Revision 1.14 2004/06/01 07:30:27 csoutheren 00071 * Removed accidental cut & paste in new code that removed capabilities 00072 * 00073 * Revision 1.13 2004/06/01 05:49:27 csoutheren 00074 * Added code to cleanup some allocated memory upon shutdown 00075 * 00076 * Revision 1.12 2004/05/23 12:40:34 rjongbloed 00077 * Simplified call for getting H323 plug manager instance 00078 * 00079 * Revision 1.11 2004/05/18 23:03:10 csoutheren 00080 * Added empty destructor to prevent gcc 3.3.3 from getting link errors. 00081 * 00082 * Revision 1.10 2004/05/18 22:32:54 csoutheren 00083 * Added pragma inteface 00084 * 00085 * Revision 1.9 2004/05/18 22:26:28 csoutheren 00086 * Initial support for embedded codecs 00087 * Fixed problems with streamed codec support 00088 * Updates for abstract factory loading methods 00089 * 00090 * Revision 1.8 2004/05/18 06:02:25 csoutheren 00091 * Deferred plugin codec loading until after main has executed by using abstract factory classes 00092 * 00093 * Revision 1.7 2004/05/12 13:41:26 csoutheren 00094 * Added support for getting lists of media formats from plugin manager 00095 * 00096 * Revision 1.6 2004/04/22 22:35:00 csoutheren 00097 * Fixed mispelling of Guilhem Tardy - my apologies to him 00098 * 00099 * Revision 1.5 2004/04/22 14:22:20 csoutheren 00100 * Added RFC 2190 H.263 code as created by Guilhem Tardy and AliceStreet 00101 * Many thanks to them for their contributions. 00102 * 00103 * Revision 1.4 2004/04/14 08:14:40 csoutheren 00104 * Changed to use generic plugin manager 00105 * 00106 * Revision 1.3 2004/04/09 12:24:18 csoutheren 00107 * Renamed h323plugin.h to opalplugin.h, and modified everything else 00108 * as required 00109 * 00110 * Revision 1.2 2004/04/03 10:38:24 csoutheren 00111 * Added in initial cut at codec plugin code. Branches are for wimps :) 00112 * 00113 * Revision 1.1.2.1 2004/03/31 11:03:16 csoutheren 00114 * Initial public version 00115 * 00116 * Revision 1.2 2004/01/27 14:55:46 craigs 00117 * Implemented static linking of new codecs 00118 * 00119 * Revision 1.1 2004/01/04 13:37:51 craigs 00120 * Implementation of codec plugins 00121 * 00122 * 00123 */ 00124 00125 #ifndef __OPAL_H323PLUGINMGR_H 00126 #define __OPAL_H323PLUGINMGR_H 00127 00128 #ifdef P_USE_PRAGMA 00129 #pragma interface 00130 #endif 00131 00132 #include <ptlib/pluginmgr.h> 00133 #include <codec/opalplugin.h> 00134 #include <mediafmt.h> 00135 #include <ptlib/pfactory.h> 00136 00137 #include <h323caps.h> 00138 00139 class H323Capability; 00140 00141 class H323PluginCodecManager : public PPluginModuleManager 00142 { 00143 PCLASSINFO(H323PluginCodecManager, PPluginModuleManager); 00144 public: 00145 H323PluginCodecManager(PPluginManager * pluginMgr = NULL); 00146 ~H323PluginCodecManager(); 00147 00148 void RegisterStaticCodec(const char * name, 00149 PluginCodec_GetAPIVersionFunction getApiVerFn, 00150 PluginCodec_GetCodecFunction getCodecFn); 00151 00152 void OnLoadPlugin(PDynaLink & dll, INT code); 00153 00154 static OpalMediaFormat::List GetMediaFormats(); 00155 static void AddFormat(const OpalMediaFormat & fmt); 00156 static void AddFormat(OpalMediaFormat * fmt); 00157 00158 virtual void OnShutdown(); 00159 00160 static void Bootstrap(); 00161 /* 00162 H323Capability * CreateCapability( 00163 const PString & _mediaFormat, 00164 const PString & _baseName, 00165 unsigned maxFramesPerPacket, 00166 unsigned recommendedFramesPerPacket, 00167 unsigned _pluginSubType); 00168 */ 00169 protected: 00170 void CreateCapabilityAndMediaFormat( 00171 PluginCodec_Definition * _encoderCodec, 00172 PluginCodec_Definition * _decoderCodec 00173 ); 00174 00175 static OpalMediaFormat::List & GetMediaFormatList(); 00176 static PMutex & GetMediaFormatMutex(); 00177 00178 void RegisterCodecs (unsigned int count, void * codecList); 00179 void UnregisterCodecs(unsigned int count, void * codecList); 00180 00181 void RegisterCapability(PluginCodec_Definition * encoderCodec, PluginCodec_Definition * decoderCodec); 00182 struct CapabilityListCreateEntry { 00183 CapabilityListCreateEntry(PluginCodec_Definition * e, PluginCodec_Definition * d) 00184 : encoderCodec(e), decoderCodec(d) { } 00185 PluginCodec_Definition * encoderCodec; 00186 PluginCodec_Definition * decoderCodec; 00187 }; 00188 typedef vector<CapabilityListCreateEntry> CapabilityCreateListType; 00189 CapabilityCreateListType capabilityCreateList; 00190 00191 }; 00192 00193 class H323DynaLink : public PDynaLink 00194 { 00195 PCLASSINFO(H323DynaLink, PDynaLink) 00196 00197 public: 00198 H323DynaLink(const char * basename, const char * reason = NULL); 00199 00200 virtual void Load(); 00201 virtual BOOL IsLoaded() 00202 { PWaitAndSignal m(processLock); return isLoadedOK; } 00203 virtual BOOL LoadPlugin (const PString & fileName); 00204 00205 protected: 00206 PMutex processLock; 00207 BOOL isLoadedOK; 00208 const char * baseName; 00209 const char * reason; 00210 }; 00211 00213 // 00214 // this is the base class for codecs accesible via the abstract factory functions 00215 // 00216 00224 class OpalFactoryCodec : public PObject { 00225 PCLASSINFO(OpalFactoryCodec, PObject) 00226 public: 00228 virtual const struct PluginCodec_Definition * GetDefinition() 00229 { return NULL; } 00230 00232 virtual PString GetInputFormat() const = 0; 00233 00235 virtual PString GetOutputFormat() const = 0; 00236 00238 virtual int Encode(const void * from, 00239 unsigned * fromLen, 00240 void * to, 00241 unsigned * toLen, 00242 unsigned int * flag 00243 ) = 0; 00244 00246 virtual unsigned int GetSampleRate() const = 0; 00247 00249 virtual unsigned int GetBitsPerSec() const = 0; 00250 00252 virtual unsigned int GetFrameTime() const = 0; 00253 00255 virtual unsigned int GetSamplesPerFrame() const = 0; 00256 00258 virtual unsigned int GetBytesPerFrame() const = 0; 00259 00261 virtual unsigned int GetRecommendedFramesPerPacket() const = 0; 00262 00264 virtual unsigned int GetMaxFramesPerPacket() const = 0; 00265 00267 virtual BYTE GetRTPPayload() const = 0; 00268 00270 virtual PString GetSDPFormat() const = 0; 00271 }; 00272 00273 #endif
1.5.2