AmPlugIn.h
Go to the documentation of this file.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
00029 #ifndef _AmPlugIn_h_
00030 #define _AmPlugIn_h_
00031
00032 #include <string>
00033 #include <map>
00034 #include <vector>
00035 #include <set>
00036 using std::string;
00037 using std::vector;
00038
00039 class AmPluginFactory;
00040 class AmSessionFactory;
00041 class AmSessionEventHandlerFactory;
00042 class AmDynInvokeFactory;
00043 class AmSIPEventHandler;
00044 class AmLoggingFacility;
00045 class AmCtrlInterfaceFactory;
00046
00047 struct amci_exports_t;
00048 struct amci_codec_t;
00049 struct amci_payload_t;
00050 struct amci_inoutfmt_t;
00051 struct amci_subtype_t;
00052
00054 class AmPayloadProviderInterface {
00055 public:
00056 AmPayloadProviderInterface() { }
00057 virtual ~AmPayloadProviderInterface() { }
00058
00064 virtual amci_payload_t* payload(int payload_id) = 0;
00065
00071 virtual int getDynPayload(const string& name, int rate, int encoding_param) = 0;
00072 };
00073
00077 class AmPlugIn : public AmPayloadProviderInterface
00078 {
00079 public:
00080
00081
00082
00083
00084
00085 private:
00086 static AmPlugIn* _instance;
00087
00088 vector<void*> dlls;
00089
00090 std::map<int,amci_codec_t*> codecs;
00091 std::map<int,amci_payload_t*> payloads;
00092 std::map<int,int> payload_order;
00093 std::map<string,amci_inoutfmt_t*> file_formats;
00094 std::map<string,AmSessionFactory*> name2app;
00095
00096 std::map<string,AmSessionEventHandlerFactory*> name2seh;
00097 std::map<string,AmPluginFactory*> name2base;
00098 std::map<string,AmDynInvokeFactory*> name2di;
00099 std::map<string,AmSIPEventHandler*> name2sipeh;
00100 std::map<string,AmLoggingFacility*> name2logfac;
00101 AmCtrlInterfaceFactory *ctrlIface;
00102
00103 int dynamic_pl;
00104 std::set<string> excluded_payloads;
00105
00106 AmPlugIn();
00107 virtual ~AmPlugIn();
00108
00110 int loadPlugIn(const string& file);
00111
00112 int loadAudioPlugIn(amci_exports_t* exports);
00113 int loadAppPlugIn(AmPluginFactory* cb);
00114 int loadSehPlugIn(AmPluginFactory* cb);
00115 int loadBasePlugIn(AmPluginFactory* cb);
00116 int loadDiPlugIn(AmPluginFactory* cb);
00117 int loadSIPehPlugIn(AmPluginFactory* f);
00118 int loadLogFacPlugIn(AmPluginFactory* f);
00119 int loadCtrlFacPlugIn(AmPluginFactory* f);
00120
00121 public:
00122
00123 int addCodec(amci_codec_t* c);
00124 int addPayload(amci_payload_t* p);
00125 int addFileFormat(amci_inoutfmt_t* f);
00126
00127 static AmPlugIn* instance();
00128
00129 void init();
00130
00135 int load(const string& directory, const string& plugins);
00136
00142 amci_payload_t* payload(int payload_id);
00143
00149 int getDynPayload(const string& name, int rate, int encoding_param);
00150
00152 const std::map<int,amci_payload_t*>& getPayloads() { return payloads; }
00154 const std::map<int,int>& getPayloadOrder() { return payload_order; }
00162 amci_inoutfmt_t* fileFormat(const string& fmt_name, const string& ext = "");
00169 amci_subtype_t* subtype(amci_inoutfmt_t* iofmt, int subtype);
00175 amci_codec_t* codec(int id);
00181 AmSessionFactory* getFactory4App(const string& app_name);
00182
00188 AmSessionEventHandlerFactory* getFactory4Seh(const string& name);
00189
00193 AmDynInvokeFactory* getFactory4Di(const string& name);
00194
00200 AmSIPEventHandler* getFactory4SIPeh(const string& name);
00201
00207 AmLoggingFacility* getFactory4LogFaclty(const string& name);
00208
00210 bool registerFactory4App(const string& app_name, AmSessionFactory* f);
00211 };
00212
00213 #endif
Generated on Fri May 16 12:02:05 2008 for SEMS by
1.5.1