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.16 2004/06/30 12:31:09 rjongbloed 00028 * Rewrite of plug in system to use single global variable for all factories to avoid all sorts 00029 * of issues with startup orders and Windows DLL multiple instances. 00030 * 00031 * Revision 1.15 2004/06/03 23:20:46 csoutheren 00032 * Fixed compile problem on some gcc variants 00033 * 00034 * Revision 1.14 2004/06/01 07:30:27 csoutheren 00035 * Removed accidental cut & paste in new code that removed capabilities 00036 * 00037 * Revision 1.13 2004/06/01 05:49:27 csoutheren 00038 * Added code to cleanup some allocated memory upon shutdown 00039 * 00040 * Revision 1.12 2004/05/23 12:40:34 rjongbloed 00041 * Simplified call for getting H323 plug manager instance 00042 * 00043 * Revision 1.11 2004/05/18 23:03:10 csoutheren 00044 * Added empty destructor to prevent gcc 3.3.3 from getting link errors. 00045 * 00046 * Revision 1.10 2004/05/18 22:32:54 csoutheren 00047 * Added pragma inteface 00048 * 00049 * Revision 1.9 2004/05/18 22:26:28 csoutheren 00050 * Initial support for embedded codecs 00051 * Fixed problems with streamed codec support 00052 * Updates for abstract factory loading methods 00053 * 00054 * Revision 1.8 2004/05/18 06:02:25 csoutheren 00055 * Deferred plugin codec loading until after main has executed by using abstract factory classes 00056 * 00057 * Revision 1.7 2004/05/12 13:41:26 csoutheren 00058 * Added support for getting lists of media formats from plugin manager 00059 * 00060 * Revision 1.6 2004/04/22 22:35:00 csoutheren 00061 * Fixed mispelling of Guilhem Tardy - my apologies to him 00062 * 00063 * Revision 1.5 2004/04/22 14:22:20 csoutheren 00064 * Added RFC 2190 H.263 code as created by Guilhem Tardy and AliceStreet 00065 * Many thanks to them for their contributions. 00066 * 00067 * Revision 1.4 2004/04/14 08:14:40 csoutheren 00068 * Changed to use generic plugin manager 00069 * 00070 * Revision 1.3 2004/04/09 12:24:18 csoutheren 00071 * Renamed h323plugin.h to opalplugin.h, and modified everything else 00072 * as required 00073 * 00074 * Revision 1.2 2004/04/03 10:38:24 csoutheren 00075 * Added in initial cut at codec plugin code. Branches are for wimps :) 00076 * 00077 * Revision 1.1.2.1 2004/03/31 11:03:16 csoutheren 00078 * Initial public version 00079 * 00080 * Revision 1.2 2004/01/27 14:55:46 craigs 00081 * Implemented static linking of new codecs 00082 * 00083 * Revision 1.1 2004/01/04 13:37:51 craigs 00084 * Implementation of codec plugins 00085 * 00086 * 00087 */ 00088 00089 #ifndef __OPAL_H323PLUGINMGR_H 00090 #define __OPAL_H323PLUGINMGR_H 00091 00092 #ifdef P_USE_PRAGMA 00093 #pragma interface 00094 #endif 00095 00096 #include <ptlib/pluginmgr.h> 00097 #include <opalplugin.h> 00098 #include <mediafmt.h> 00099 00100 class H323PluginCodecManager : public PPluginModuleManager 00101 { 00102 PCLASSINFO(H323PluginCodecManager, PPluginModuleManager); 00103 public: 00104 H323PluginCodecManager(PPluginManager * pluginMgr = NULL); 00105 ~H323PluginCodecManager(); 00106 00107 void RegisterStaticCodec(const char * name, 00108 PluginCodec_GetAPIVersionFunction getApiVerFn, 00109 PluginCodec_GetCodecFunction getCodecFn); 00110 00111 void OnLoadPlugin(PDynaLink & dll, INT code); 00112 00113 static OpalMediaFormat::List GetMediaFormats(); 00114 static void AddFormat(const OpalMediaFormat & fmt); 00115 00116 virtual void OnShutdown(); 00117 00118 protected: 00119 void CreateCapabilityAndMediaFormat( 00120 PluginCodec_Definition * _encoderCodec, 00121 PluginCodec_Definition * _decoderCodec 00122 ); 00123 00124 static OpalMediaFormat::List & GetMediaFormatList(); 00125 static PMutex & GetMediaFormatMutex(); 00126 00127 void RegisterCodecs (unsigned int count, void * codecList); 00128 void UnregisterCodecs(unsigned int count, void * codecList); 00129 }; 00130 00131 class H323DynaLink : public PDynaLink 00132 { 00133 PCLASSINFO(H323DynaLink, PDynaLink) 00134 00135 public: 00136 H323DynaLink(const char * basename, const char * reason); 00137 00138 virtual void Load(); 00139 virtual BOOL IsLoaded() 00140 { PWaitAndSignal m(processLock); return isLoadedOK; } 00141 virtual BOOL LoadPlugin (const PString & fileName); 00142 00143 protected: 00144 PMutex processLock; 00145 BOOL isLoadedOK; 00146 const char * baseName; 00147 const char * reason; 00148 }; 00149 00150 #endif