|
CLAM-Development
1.3
|
00001 #ifndef RunTimeLadspaLibraryLoader_hxx 00002 #define RunTimeLadspaLibraryLoader_hxx 00003 00004 #include <dirent.h> 00005 //#include "RunTimeLibraryLoader.hxx" 00006 00007 #include "ProcessingFactory.hxx" 00008 #include "LadspaWrapperCreator.hxx" 00009 #include <ladspa.h> 00010 00011 00012 class RunTimeLadspaLibraryLoader : public RunTimeLibraryLoader 00013 { 00014 00015 protected: 00016 00017 virtual const bool needReleaseHandlerOnReload() const { return false;} 00018 void SetupLibrary(void* handle, const std::string & pluginFullFilename) const 00019 { 00020 LADSPA_Descriptor_Function descriptorTable = 0; 00021 descriptorTable = (LADSPA_Descriptor_Function)GetSymbol(handle, "ladspa_descriptor"); 00022 if (!descriptorTable) 00023 { 00024 std::cout << "[LADSPA Plugin] Warning: trying to open non ladspa plugin: " << pluginFullFilename << std::endl; 00025 return; 00026 } 00027 //std::cout << "[LADSPA] \topened plugin: " << pluginFullFilename << std::endl; 00028 CLAM::ProcessingFactory& factory = CLAM::ProcessingFactory::GetInstance(); 00029 for (unsigned long i=0; descriptorTable(i); i++) 00030 { 00031 LADSPA_Descriptor* descriptor = (LADSPA_Descriptor*)descriptorTable(i); 00032 const char* id = descriptor->Label; 00033 factory.AddCreatorWarningRepetitions(id, 00034 new CLAM::LadspaWrapperCreator(pluginFullFilename, 00035 i, 00036 id)); 00037 factory.AddAttribute(id, "category", "LADSPA"); 00038 factory.AddAttribute(id, "description", descriptor->Name); 00039 factory.AddAttribute(id, "library", pluginFullFilename); 00040 00041 std::ostringstream oss; 00042 oss << descriptor->Label << "_buffer" << i; 00043 std::string id2=oss.str(); 00044 factory.AddCreatorWarningRepetitions(id2, 00045 new CLAM::LadspaWrapperBufferCreator(pluginFullFilename, 00046 i, 00047 id2)); 00048 factory.AddAttribute(id2, "category", "LADSPA_BUFFER"); 00049 factory.AddAttribute(id2, "description", descriptor->Name); 00050 factory.AddAttribute(id2, "library", pluginFullFilename); 00051 //std::cout << "[LADSPA] added \"" << plugin.factoryID << "\" to the Factory" << std::endl; 00052 } 00053 if (ReleaseLibraryHandler(handle, pluginFullFilename)) 00054 { 00055 std::cout<<"[LADSPA Plugin] error unloading library handle of: " << pluginFullFilename<<std::endl; 00056 std::cout<<LibraryLoadError()<<std::endl; 00057 } 00058 } 00059 00060 const char ** standardPaths() const 00061 { 00062 static const char * result[] = 00063 { 00064 "/usr/local/lib/ladspa", 00065 "/usr/lib/ladspa", 00066 0 00067 }; 00068 return result; 00069 } 00070 00071 const char * homePath() const { return "/.ladspa"; } 00072 const char * pathEnvironmentVar() const { return "LADSPA_PATH"; } 00073 const char * libraryType() const { return "LADSPA"; } 00074 }; 00075 00076 #endif // RunTimeLadspaLibraryLoader_hxx 00077 00078
1.7.6.1