From: <fea...@li...> - 2006-03-09 18:16:10
|
Revision: 60 Author: alex_lerch Date: 2006-03-09 10:15:49 -0800 (Thu, 09 Mar 2006) ViewCVS: http://svn.sourceforge.net/feapi/?rev=60&view=rev Log Message: ----------- rename HostUtils to HostUtilities Modified Paths: -------------- trunk/FEAPI/sdk/host/include/FEAPIHostDeclarations.h trunk/FEAPI/sdk/host/include/FEAPIPluginProxy.h trunk/FEAPI/sdk/host/src/FEAPIPluginProxy.cpp Added Paths: ----------- trunk/FEAPI/sdk/host/include/FEAPIHostUtilities.h trunk/FEAPI/sdk/host/src/FEAPIHostUtilities.cpp Removed Paths: ------------- trunk/FEAPI/sdk/host/include/FEAPIHostUtils.h trunk/FEAPI/sdk/host/src/FEAPIHostUtils.cpp Modified: trunk/FEAPI/sdk/host/include/FEAPIHostDeclarations.h =================================================================== --- trunk/FEAPI/sdk/host/include/FEAPIHostDeclarations.h 2006-03-09 15:49:54 UTC (rev 59) +++ trunk/FEAPI/sdk/host/include/FEAPIHostDeclarations.h 2006-03-09 18:15:49 UTC (rev 60) @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////// -// /*! \file FEAPIHost.h +// /*! \file FEAPIHostDeclarations.h // \brief host interface for Feature Extraction // Plug-In API (FEAPI). */ // Copied: trunk/FEAPI/sdk/host/include/FEAPIHostUtilities.h (from rev 58, trunk/FEAPI/sdk/host/include/FEAPIHostUtils.h) =================================================================== --- trunk/FEAPI/sdk/host/include/FEAPIHostUtilities.h (rev 0) +++ trunk/FEAPI/sdk/host/include/FEAPIHostUtilities.h 2006-03-09 18:15:49 UTC (rev 60) @@ -0,0 +1,85 @@ +//////////////////////////////////////////////////////////////////////////////////// +// /*! \file FEAPIHostUtilities.h +// \brief host utilities interface for Feature Extraction +// Plug-In API (FEAPI). */ +// +// Copyright (c) 2006, Ircam-Centre Pomidou +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must link to the FEAPI website +// http://www.sf.net/projects/feapi, +// reproduce this list of conditions and the following +// disclaimer in the documentation and/or other materials +// provided with the distribution. +// * The name of the contributors to this software must not be used +// to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +////////////////////////////////////////////////////////////////////////////////// + +/*! \brief avoid multiple header includes */ +#ifndef FEAPI_HOST_UTILS_HEADER_H +#define FEAPI_HOST_UTILS_HEADER_H + + +#include "FEAPI.h" // Feature Extraction API +#include "FEAPIHostDeclarations.h" // Feature Extraction API + +/*! + * get FEAPI function pointer from module + * + * @param *hModule : FEAPI Plugin Module (HMODULE on windows or CBundleRef on mac) + * @param *pstPluginFunctions : list of FEAPI function pointer to be filled + * + * @return static bool : return true on success false otherwise + */ +FEAPI_Error_t GetFunctionPointers (FEAPI_ModuleHandle_t hModule, FEAPI_PluginFunctions_t *pstPluginFunctions); + +/*! + * parse the current working directory for plug-ins + * + * @param *pstFileNames : list of detected plug-ins, to be written + * + * @return static int : number of detected plug-ins + */ +int FindPlugins(FEAPI_PluginFileNames_t *pstFileNames); + +/*! + * load a plugin specified by its filename + * + * @param *pcFilename : full path to plugin + * @param *hModule : pointer to a FEAPI_PluginModule_t + * + * @return static int : number of detected plug-ins + */ +FEAPI_Error_t LoadPluginModule(const char *pcFilename,FEAPI_ModuleHandle_t *phModule); + +/*! + * parse the current working directory for plug-ins + * + * @param *pstFileNames : list of detected plug-ins, to be written + * + * @return static int : number of detected plug-ins + */ +FEAPI_Error_t UnloadPluginModule(FEAPI_ModuleHandle_t hModule); + +#endif //FEAPI_HOST_UTILS_HEADER_H \ No newline at end of file Deleted: trunk/FEAPI/sdk/host/include/FEAPIHostUtils.h =================================================================== --- trunk/FEAPI/sdk/host/include/FEAPIHostUtils.h 2006-03-09 15:49:54 UTC (rev 59) +++ trunk/FEAPI/sdk/host/include/FEAPIHostUtils.h 2006-03-09 18:15:49 UTC (rev 60) @@ -1,85 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////////// -// /*! \file FEAPIHostUtils.h -// \brief host utilities interface for Feature Extraction -// Plug-In API (FEAPI). */ -// -// Copyright (c) 2006, Ircam-Centre Pomidou -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must link to the FEAPI website -// http://www.sf.net/projects/feapi, -// reproduce this list of conditions and the following -// disclaimer in the documentation and/or other materials -// provided with the distribution. -// * The name of the contributors to this software must not be used -// to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////////// - -/*! \brief avoid multiple header includes */ -#ifndef FEAPI_HOST_UTILS_HEADER_H -#define FEAPI_HOST_UTILS_HEADER_H - - -#include "FEAPI.h" // Feature Extraction API -#include "FEAPIHostDeclarations.h" // Feature Extraction API - -/*! - * get FEAPI function pointer from module - * - * @param *hModule : FEAPI Plugin Module (HMODULE on windows or CBundleRef on mac) - * @param *pstPluginFunctions : list of FEAPI function pointer to be filled - * - * @return static bool : return true on success false otherwise - */ -FEAPI_Error_t GetFunctionPointers (FEAPI_ModuleHandle_t hModule, FEAPI_PluginFunctions_t *pstPluginFunctions); - -/*! - * parse the current working directory for plug-ins - * - * @param *pstFileNames : list of detected plug-ins, to be written - * - * @return static int : number of detected plug-ins - */ -int FindPlugins(FEAPI_PluginFileNames_t *pstFileNames); - -/*! - * load a plugin specified by its filename - * - * @param *pcFilename : full path to plugin - * @param *hModule : pointer to a FEAPI_PluginModule_t - * - * @return static int : number of detected plug-ins - */ -FEAPI_Error_t LoadPluginModule(const char *pcFilename,FEAPI_ModuleHandle_t *phModule); - -/*! - * parse the current working directory for plug-ins - * - * @param *pstFileNames : list of detected plug-ins, to be written - * - * @return static int : number of detected plug-ins - */ -FEAPI_Error_t UnloadPluginModule(FEAPI_ModuleHandle_t hModule); - -#endif //FEAPI_HOST_UTILS_HEADER_H \ No newline at end of file Modified: trunk/FEAPI/sdk/host/include/FEAPIPluginProxy.h =================================================================== --- trunk/FEAPI/sdk/host/include/FEAPIPluginProxy.h 2006-03-09 15:49:54 UTC (rev 59) +++ trunk/FEAPI/sdk/host/include/FEAPIPluginProxy.h 2006-03-09 18:15:49 UTC (rev 60) @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////// -// /*! \file FEAPICPlugin.h +// /*! \file FEAPIPluginProxy.h // \brief proxy interface for a FEAPI Plugin. */ // // Copyright (c) 2006, Ircam-Centre Pomidou Copied: trunk/FEAPI/sdk/host/src/FEAPIHostUtilities.cpp (from rev 58, trunk/FEAPI/sdk/host/src/FEAPIHostUtils.cpp) =================================================================== --- trunk/FEAPI/sdk/host/src/FEAPIHostUtilities.cpp (rev 0) +++ trunk/FEAPI/sdk/host/src/FEAPIHostUtilities.cpp 2006-03-09 18:15:49 UTC (rev 60) @@ -0,0 +1,400 @@ +//////////////////////////////////////////////////////////////////////////////////// +// /*! \file FEAPIHostUtilities.cpp +// \brief host utilities for Feature Extraction +// Plug-In API (FEAPI). */ +// +// Copyright (c) 2006, Ircam-Centre Pomidou +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must link to the FEAPI website +// http://www.sf.net/projects/feapi, +// reproduce this list of conditions and the following +// disclaimer in the documentation and/or other materials +// provided with the distribution. +// * The name of the contributors to this software must not be used +// to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +//////////////////////////////////////////////////////////////////////////////// +// includes + +#include "FEAPIHostUtilities.h" +#include <iostream> + +#ifdef WIN32 + +FEAPI_Error_t GetFunctionPointers(FEAPI_ModuleHandle_t hModule, FEAPI_PluginFunctions_t *pstPluginFunctions) +{ + HMODULE hDllHandle = hModule; + + // get exports from dll + pstPluginFunctions->pFunCreateInstance = (FEAPI_CreatePluginInstance_t) GetProcAddress (hDllHandle, "FEAPI_CreatePluginInstance"); + if (!pstPluginFunctions->pFunCreateInstance) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunDestroyInstance = (FEAPI_DestroyPluginInstance_t) GetProcAddress (hDllHandle, "FEAPI_DestroyPluginInstance"); + if (!pstPluginFunctions->pFunDestroyInstance) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetApiVersion = (FEAPI_GetPluginAPIVersion_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginAPIVersion"); + if (!pstPluginFunctions->pFunGetApiVersion) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunInitializePlugin = (FEAPI_InitializePlugin_t) GetProcAddress (hDllHandle, "FEAPI_InitializePlugin"); + if (!pstPluginFunctions->pFunInitializePlugin) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginName = (FEAPI_GetPluginName_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginName"); ; + if (!pstPluginFunctions->pFunGetPluginName) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginVendor = (FEAPI_GetPluginVendor_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginVendor"); ; + if (!pstPluginFunctions->pFunGetPluginVendor) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginProperty = (FEAPI_GetPluginProperty_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginProperty"); ; + if (!pstPluginFunctions->pFunGetPluginVendor) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginId = (FEAPI_GetPluginId_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginId"); ; + if (!pstPluginFunctions->pFunGetPluginId) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginVendorVersion = (FEAPI_GetPluginVendorVersion_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginVendorVersion"); ; + if (!pstPluginFunctions->pFunGetPluginVendorVersion) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginDescription = (FEAPI_GetPluginDescription_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginDescription"); ; + if (!pstPluginFunctions->pFunGetPluginDescription) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginCopyright = (FEAPI_GetPluginCopyright_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginCopyright"); ; + if (!pstPluginFunctions->pFunGetPluginCopyright) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetNumberOfInputs = (FEAPI_GetPluginNumOfInputs_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginNumOfInputs"); ; + if (!pstPluginFunctions->pFunGetNumberOfInputs) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetInputDescription = (FEAPI_GetPluginInputDescription_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginInputDescription"); ; + if (!pstPluginFunctions->pFunGetInputDescription) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetNumberOfResults = (FEAPI_GetPluginNumOfResults_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginNumOfResults"); ; + if (!pstPluginFunctions->pFunGetNumberOfResults) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetResultDescription = (FEAPI_GetPluginResultDescription_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginResultDescription"); ; + if (!pstPluginFunctions->pFunGetResultDescription) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetNumberOfParameters = (FEAPI_GetPluginNumOfParameters_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginNumOfParameters"); ; + if (!pstPluginFunctions->pFunGetNumberOfParameters) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetParameterDescription = (FEAPI_GetPluginParameterDescription_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginParameterDescription"); ; + if (!pstPluginFunctions->pFunGetParameterDescription) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunSetParameter = (FEAPI_SetPluginParameter_t) GetProcAddress (hDllHandle, "FEAPI_SetPluginParameter"); ; + if (!pstPluginFunctions->pFunSetParameter) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetParameter = (FEAPI_GetPluginParameter_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginParameter"); ; + if (!pstPluginFunctions->pFunGetParameter) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunProcess = (FEAPI_ProcessPlugin_t) GetProcAddress (hDllHandle, "FEAPI_ProcessPlugin"); ; + if (!pstPluginFunctions->pFunProcess) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunProcessDone = (FEAPI_ProcessPluginDone_t) GetProcAddress (hDllHandle, "FEAPI_ProcessPluginDone"); ; + if (!pstPluginFunctions->pFunProcessDone) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetSizeOfResult = (FEAPI_GetPluginSizeOfResult_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginSizeOfResult"); ; + if (!pstPluginFunctions->pFunGetSizeOfResult) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetResult = (FEAPI_GetPluginResult_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginResult"); ; + if (!pstPluginFunctions->pFunGetResult) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetResultLatency = (FEAPI_GetPluginResultLatency_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginResultLatency"); ; + if (!pstPluginFunctions->pFunGetResultLatency) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunReset = (FEAPI_ResetPlugin_t) GetProcAddress (hDllHandle, "FEAPI_ResetPlugin"); ; + if (!pstPluginFunctions->pFunReset) + return FEAPI_kUnspecifiedError; + + return FEAPI_kNoError; +} + +#elif MAC + +FEAPI_Error_t GetFunctionPointers(FEAPI_ModuleHandle_t hModule, FEAPI_PluginFunctions_t *pstPluginFunctions) +{ + CFBundleRef cfBundle = hModule; + + // get exports from dll + pstPluginFunctions->pFunCreateInstance = (FEAPI_CreatePluginInstance_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_CreatePluginInstance")); + if (!pstPluginFunctions->pFunCreateInstance) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunDestroyInstance = (FEAPI_DestroyPluginInstance_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_DestroyPluginInstance")); + if (!pstPluginFunctions->pFunDestroyInstance) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetApiVersion = (FEAPI_GetPluginAPIVersion_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginAPIVersion")); + if (!pstPluginFunctions->pFunGetApiVersion) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunInitializePlugin = (FEAPI_InitializePlugin_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_InitializePlugin")); + if (!pstPluginFunctions->pFunInitializePlugin) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginName = (FEAPI_GetPluginName_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginName")); + if (!pstPluginFunctions->pFunGetPluginName) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginVendor = (FEAPI_GetPluginVendor_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginVendor")); + if (!pstPluginFunctions->pFunGetPluginVendor) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginProperty = (FEAPI_GetPluginProperty_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginProperty")); + if (!pstPluginFunctions->pFunGetPluginVendor) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginId = (FEAPI_GetPluginId_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginId")); + if (!pstPluginFunctions->pFunGetPluginId) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginVendorVersion = (FEAPI_GetPluginVendorVersion_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginVendorVersion")); + if (!pstPluginFunctions->pFunGetPluginVendorVersion) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginDescription = (FEAPI_GetPluginDescription_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginDescription")); + if (!pstPluginFunctions->pFunGetPluginDescription) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetPluginCopyright = (FEAPI_GetPluginCopyright_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginCopyright")); + if (!pstPluginFunctions->pFunGetPluginCopyright) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetNumberOfInputs = (FEAPI_GetPluginNumOfInputs_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginNumOfInputs")); + if (!pstPluginFunctions->pFunGetNumberOfInputs) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetInputDescription = (FEAPI_GetPluginInputDescription_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginInputDescription")); + if (!pstPluginFunctions->pFunGetInputDescription) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetNumberOfResults = (FEAPI_GetPluginNumOfResults_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginNumOfResults")); + if (!pstPluginFunctions->pFunGetNumberOfResults) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetResultDescription = (FEAPI_GetPluginResultDescription_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginResultDescription")); + if (!pstPluginFunctions->pFunGetResultDescription) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetNumberOfParameters = (FEAPI_GetPluginNumOfParameters_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginNumOfParameters")); + if (!pstPluginFunctions->pFunGetNumberOfParameters) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetParameterDescription = (FEAPI_GetPluginParameterDescription_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginParameterDescription")); + if (!pstPluginFunctions->pFunGetParameterDescription) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunSetParameter = (FEAPI_SetPluginParameter_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_SetPluginParameter")); + if (!pstPluginFunctions->pFunSetParameter) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetParameter = (FEAPI_GetPluginParameter_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginParameter")); + if (!pstPluginFunctions->pFunGetParameter) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunProcess = (FEAPI_ProcessPlugin_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_ProcessPlugin")); + if (!pstPluginFunctions->pFunProcess) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunProcessDone = (FEAPI_ProcessPluginDone_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_ProcessPluginDone")); + if (!pstPluginFunctions->pFunProcessDone) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetSizeOfResult = (FEAPI_GetPluginSizeOfResult_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginSizeOfResult")); + if (!pstPluginFunctions->pFunGetSizeOfResult) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetResult = (FEAPI_GetPluginResult_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginResult")); + if (!pstPluginFunctions->pFunGetResult) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunGetResultLatency = (FEAPI_GetPluginResultLatency_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginResultLatency")); + if (!pstPluginFunctions->pFunGetResultLatency) + return FEAPI_kUnspecifiedError; + pstPluginFunctions->pFunReset = (FEAPI_ResetPlugin_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_ResetPlugin")); + if (!pstPluginFunctions->pFunReset) + return FEAPI_kUnspecifiedError; + + return FEAPI_kNoError; +} +#else +// no implementation yet for other plateforms +#endif + + + +#ifdef WIN32 +int FindPlugins(FEAPI_PluginFileNames_t *pstFileNames) +{ + struct _finddata_t DllFile; + long hFile; + int iNumOfPlugins = 0; + FEAPI_PluginFileNames_t *pCurrentStruct = pstFileNames; + FEAPI_PluginFunctions_t stPluginFunctions; + + /* Find first .dll file in current directory */ + if( (hFile = _findfirst( "*.dll", &DllFile )) == -1L ) + return iNumOfPlugins; + else + { + HMODULE hDllHandle; + + hDllHandle = LoadLibrary (DllFile.name); + + if (GetFunctionPointers(hDllHandle, &stPluginFunctions)) + { + // add to list + strcpy(pCurrentStruct->acFilename, DllFile.name); + pCurrentStruct->iMajorVersion = stPluginFunctions.pFunGetApiVersion (FEAPI_kMajorVersion); + pCurrentStruct->pNextPlugin = new FEAPI_PluginFileNames_t; + pCurrentStruct = pCurrentStruct->pNextPlugin; + pCurrentStruct->pNextPlugin = 0; + iNumOfPlugins++; + } + + if (hDllHandle) + FreeLibrary (hDllHandle); + + /* Find the rest of the .dll files */ + while( _findnext( hFile, &DllFile ) == 0 ) + { + hDllHandle = LoadLibrary (DllFile.name); + + if (GetFunctionPointers(hDllHandle, &stPluginFunctions)) + { + // add to list + strcpy(pCurrentStruct->acFilename, DllFile.name); + pCurrentStruct->iMajorVersion = stPluginFunctions.pFunGetApiVersion (FEAPI_kMajorVersion); + pCurrentStruct->pNextPlugin = new FEAPI_PluginFileNames_t; + pCurrentStruct = pCurrentStruct->pNextPlugin; + pCurrentStruct->pNextPlugin = 0; + iNumOfPlugins++; + } + if (hDllHandle) + FreeLibrary (hDllHandle); + } + + _findclose( hFile ); + } + + return iNumOfPlugins; +} + +#elif MAC + +int FindPlugins(FEAPI_PluginFileNames_t *pstFileNames) +{ + int iNumOfPlugins = 0; + FEAPI_PluginFileNames_t *pCurrentStruct = pstFileNames; + FEAPI_PluginFunctions_t stPluginFunctions; + + char acFeapiPath[1024]; + strcpy(acFeapiPath,getenv("HOME")); + strcat(acFeapiPath,"/library/Audio/Plug-Ins/FEAPI"); + + CFStringRef cfFeapiPlugInPath = CFStringCreateWithCString(kCFAllocatorDefault,acFeapiPath,kCFStringEncodingMacRoman); + CFURLRef cfFeapiPluginsURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,cfFeapiPlugInPath,kCFURLPOSIXPathStyle,true); + + // do we need to release and/or unload the bundles when created like that? + CFArrayRef bundleArray = CFBundleCreateBundlesFromDirectory(kCFAllocatorDefault,cfFeapiPluginsURL,NULL); + CFIndex iNumOfBundles = CFArrayGetCount(bundleArray); + + if( iNumOfBundles <= 0 ) + { + CFRelease(cfFeapiPlugInPath); + CFRelease(cfFeapiPluginsURL); + CFRelease(bundleArray); + return iNumOfPlugins; + } + + // search all bundles for FEAPI plugins + for(int i=0; i<iNumOfBundles; ++i) + { + CFBundleRef cfBundle = (CFBundleRef) CFArrayGetValueAtIndex(bundleArray,i); + + if (GetFunctionPointers(cfBundle, &stPluginFunctions)) + { + // add to list + CFURLRef cfBundleURL = CFBundleCopyBundleURL(cfBundle); + char acBundlePath[1024]; + CFURLGetFileSystemRepresentation(cfBundleURL,true,(UInt8 *)acBundlePath,1024); + strcpy(pCurrentStruct->acFilename, (const char*)acBundlePath); + + pCurrentStruct->iMajorVersion = stPluginFunctions.pFunGetApiVersion (FEAPI_kMajorVersion); + pCurrentStruct->pNextPlugin = new FEAPI_PluginFileNames_t; + pCurrentStruct = pCurrentStruct->pNextPlugin; + pCurrentStruct->pNextPlugin = 0; + iNumOfPlugins++; + } + } + + CFRelease(cfFeapiPlugInPath); + CFRelease(cfFeapiPluginsURL); + CFRelease(bundleArray); + + return iNumOfPlugins; +} +#else +// no implementation yet for other plateforms +#endif //WIN32 + + +FEAPI_Error_t LoadPluginModule(const char *pcFilename,FEAPI_ModuleHandle_t *phModule) +{ +#ifdef WIN32 + HMODULE hDllHandle = LoadLibrary (pcFilename); + if(hDllHandle) + { + *phModule = (FEAPI_ModuleHandle_t)hDllHandle; + return FEAPI_kNoError; + } + else + { + *phModule = 0; + return FEAPI_kUnspecifiedError; + } +#elif MAC + CFStringRef bundlePath = CFStringCreateWithCString(kCFAllocatorDefault,pcFilename,kCFStringEncodingMacRoman); + CFURLRef bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,bundlePath,kCFURLPOSIXPathStyle,true); + + CFBundleRef cfBundle = CFBundleCreate(kCFAllocatorDefault,bundleURL); + + CFRelease(bundlePath); + CFRelease(bundleURL); + + if(cfBundle) + { + *phModule = (FEAPI_ModuleHandle_t)cfBundle; + return FEAPI_kNoError; + } + else + { + std::cerr << "cfBundle is NULL"<< std::endl; + *phModule = 0; + return FEAPI_kUnspecifiedError; + } +#else + return FEAPI_kUnspecifiedError; // not implemented + +#endif +} + + +FEAPI_Error_t UnloadPluginModule(FEAPI_ModuleHandle_t hModule) +{ +#ifdef WIN32 + HMODULE hDllHandle = hModule; + + if (hDllHandle) + FreeLibrary (hDllHandle); + + return FEAPI_kNoError; +#elif Mac + CFBundleRef cfBundle = (CFBundleRef)hModule; + + if (cfBundle) + { + CFBundleUnloadExecutable(cfBundle); + CFRelease(cfBundle); + } + + return FEAPI_kNoError; +#else + return FEAPI_kUnspecifiedError; // not implemented +#endif +} + Deleted: trunk/FEAPI/sdk/host/src/FEAPIHostUtils.cpp =================================================================== --- trunk/FEAPI/sdk/host/src/FEAPIHostUtils.cpp 2006-03-09 15:49:54 UTC (rev 59) +++ trunk/FEAPI/sdk/host/src/FEAPIHostUtils.cpp 2006-03-09 18:15:49 UTC (rev 60) @@ -1,400 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////////// -// /*! \file FEAPIHostUtils.cpp -// \brief host utilities for Feature Extraction -// Plug-In API (FEAPI). */ -// -// Copyright (c) 2006, Ircam-Centre Pomidou -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must link to the FEAPI website -// http://www.sf.net/projects/feapi, -// reproduce this list of conditions and the following -// disclaimer in the documentation and/or other materials -// provided with the distribution. -// * The name of the contributors to this software must not be used -// to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -//////////////////////////////////////////////////////////////////////////////// -// includes - -#include "FEAPIHostUtils.h" -#include <iostream> - -#ifdef WIN32 - -FEAPI_Error_t GetFunctionPointers(FEAPI_ModuleHandle_t hModule, FEAPI_PluginFunctions_t *pstPluginFunctions) -{ - HMODULE hDllHandle = hModule; - - // get exports from dll - pstPluginFunctions->pFunCreateInstance = (FEAPI_CreatePluginInstance_t) GetProcAddress (hDllHandle, "FEAPI_CreatePluginInstance"); - if (!pstPluginFunctions->pFunCreateInstance) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunDestroyInstance = (FEAPI_DestroyPluginInstance_t) GetProcAddress (hDllHandle, "FEAPI_DestroyPluginInstance"); - if (!pstPluginFunctions->pFunDestroyInstance) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetApiVersion = (FEAPI_GetPluginAPIVersion_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginAPIVersion"); - if (!pstPluginFunctions->pFunGetApiVersion) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunInitializePlugin = (FEAPI_InitializePlugin_t) GetProcAddress (hDllHandle, "FEAPI_InitializePlugin"); - if (!pstPluginFunctions->pFunInitializePlugin) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginName = (FEAPI_GetPluginName_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginName"); ; - if (!pstPluginFunctions->pFunGetPluginName) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginVendor = (FEAPI_GetPluginVendor_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginVendor"); ; - if (!pstPluginFunctions->pFunGetPluginVendor) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginProperty = (FEAPI_GetPluginProperty_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginProperty"); ; - if (!pstPluginFunctions->pFunGetPluginVendor) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginId = (FEAPI_GetPluginId_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginId"); ; - if (!pstPluginFunctions->pFunGetPluginId) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginVendorVersion = (FEAPI_GetPluginVendorVersion_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginVendorVersion"); ; - if (!pstPluginFunctions->pFunGetPluginVendorVersion) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginDescription = (FEAPI_GetPluginDescription_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginDescription"); ; - if (!pstPluginFunctions->pFunGetPluginDescription) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginCopyright = (FEAPI_GetPluginCopyright_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginCopyright"); ; - if (!pstPluginFunctions->pFunGetPluginCopyright) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetNumberOfInputs = (FEAPI_GetPluginNumOfInputs_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginNumOfInputs"); ; - if (!pstPluginFunctions->pFunGetNumberOfInputs) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetInputDescription = (FEAPI_GetPluginInputDescription_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginInputDescription"); ; - if (!pstPluginFunctions->pFunGetInputDescription) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetNumberOfResults = (FEAPI_GetPluginNumOfResults_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginNumOfResults"); ; - if (!pstPluginFunctions->pFunGetNumberOfResults) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetResultDescription = (FEAPI_GetPluginResultDescription_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginResultDescription"); ; - if (!pstPluginFunctions->pFunGetResultDescription) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetNumberOfParameters = (FEAPI_GetPluginNumOfParameters_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginNumOfParameters"); ; - if (!pstPluginFunctions->pFunGetNumberOfParameters) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetParameterDescription = (FEAPI_GetPluginParameterDescription_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginParameterDescription"); ; - if (!pstPluginFunctions->pFunGetParameterDescription) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunSetParameter = (FEAPI_SetPluginParameter_t) GetProcAddress (hDllHandle, "FEAPI_SetPluginParameter"); ; - if (!pstPluginFunctions->pFunSetParameter) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetParameter = (FEAPI_GetPluginParameter_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginParameter"); ; - if (!pstPluginFunctions->pFunGetParameter) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunProcess = (FEAPI_ProcessPlugin_t) GetProcAddress (hDllHandle, "FEAPI_ProcessPlugin"); ; - if (!pstPluginFunctions->pFunProcess) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunProcessDone = (FEAPI_ProcessPluginDone_t) GetProcAddress (hDllHandle, "FEAPI_ProcessPluginDone"); ; - if (!pstPluginFunctions->pFunProcessDone) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetSizeOfResult = (FEAPI_GetPluginSizeOfResult_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginSizeOfResult"); ; - if (!pstPluginFunctions->pFunGetSizeOfResult) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetResult = (FEAPI_GetPluginResult_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginResult"); ; - if (!pstPluginFunctions->pFunGetResult) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetResultLatency = (FEAPI_GetPluginResultLatency_t) GetProcAddress (hDllHandle, "FEAPI_GetPluginResultLatency"); ; - if (!pstPluginFunctions->pFunGetResultLatency) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunReset = (FEAPI_ResetPlugin_t) GetProcAddress (hDllHandle, "FEAPI_ResetPlugin"); ; - if (!pstPluginFunctions->pFunReset) - return FEAPI_kUnspecifiedError; - - return FEAPI_kNoError; -} - -#elif MAC - -FEAPI_Error_t GetFunctionPointers(FEAPI_ModuleHandle_t hModule, FEAPI_PluginFunctions_t *pstPluginFunctions) -{ - CFBundleRef cfBundle = hModule; - - // get exports from dll - pstPluginFunctions->pFunCreateInstance = (FEAPI_CreatePluginInstance_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_CreatePluginInstance")); - if (!pstPluginFunctions->pFunCreateInstance) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunDestroyInstance = (FEAPI_DestroyPluginInstance_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_DestroyPluginInstance")); - if (!pstPluginFunctions->pFunDestroyInstance) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetApiVersion = (FEAPI_GetPluginAPIVersion_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginAPIVersion")); - if (!pstPluginFunctions->pFunGetApiVersion) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunInitializePlugin = (FEAPI_InitializePlugin_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_InitializePlugin")); - if (!pstPluginFunctions->pFunInitializePlugin) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginName = (FEAPI_GetPluginName_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginName")); - if (!pstPluginFunctions->pFunGetPluginName) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginVendor = (FEAPI_GetPluginVendor_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginVendor")); - if (!pstPluginFunctions->pFunGetPluginVendor) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginProperty = (FEAPI_GetPluginProperty_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginProperty")); - if (!pstPluginFunctions->pFunGetPluginVendor) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginId = (FEAPI_GetPluginId_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginId")); - if (!pstPluginFunctions->pFunGetPluginId) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginVendorVersion = (FEAPI_GetPluginVendorVersion_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginVendorVersion")); - if (!pstPluginFunctions->pFunGetPluginVendorVersion) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginDescription = (FEAPI_GetPluginDescription_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginDescription")); - if (!pstPluginFunctions->pFunGetPluginDescription) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetPluginCopyright = (FEAPI_GetPluginCopyright_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginCopyright")); - if (!pstPluginFunctions->pFunGetPluginCopyright) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetNumberOfInputs = (FEAPI_GetPluginNumOfInputs_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginNumOfInputs")); - if (!pstPluginFunctions->pFunGetNumberOfInputs) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetInputDescription = (FEAPI_GetPluginInputDescription_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginInputDescription")); - if (!pstPluginFunctions->pFunGetInputDescription) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetNumberOfResults = (FEAPI_GetPluginNumOfResults_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginNumOfResults")); - if (!pstPluginFunctions->pFunGetNumberOfResults) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetResultDescription = (FEAPI_GetPluginResultDescription_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginResultDescription")); - if (!pstPluginFunctions->pFunGetResultDescription) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetNumberOfParameters = (FEAPI_GetPluginNumOfParameters_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginNumOfParameters")); - if (!pstPluginFunctions->pFunGetNumberOfParameters) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetParameterDescription = (FEAPI_GetPluginParameterDescription_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginParameterDescription")); - if (!pstPluginFunctions->pFunGetParameterDescription) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunSetParameter = (FEAPI_SetPluginParameter_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_SetPluginParameter")); - if (!pstPluginFunctions->pFunSetParameter) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetParameter = (FEAPI_GetPluginParameter_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginParameter")); - if (!pstPluginFunctions->pFunGetParameter) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunProcess = (FEAPI_ProcessPlugin_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_ProcessPlugin")); - if (!pstPluginFunctions->pFunProcess) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunProcessDone = (FEAPI_ProcessPluginDone_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_ProcessPluginDone")); - if (!pstPluginFunctions->pFunProcessDone) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetSizeOfResult = (FEAPI_GetPluginSizeOfResult_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginSizeOfResult")); - if (!pstPluginFunctions->pFunGetSizeOfResult) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetResult = (FEAPI_GetPluginResult_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginResult")); - if (!pstPluginFunctions->pFunGetResult) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunGetResultLatency = (FEAPI_GetPluginResultLatency_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_GetPluginResultLatency")); - if (!pstPluginFunctions->pFunGetResultLatency) - return FEAPI_kUnspecifiedError; - pstPluginFunctions->pFunReset = (FEAPI_ResetPlugin_t) CFBundleGetFunctionPointerForName (cfBundle, CFSTR("FEAPI_ResetPlugin")); - if (!pstPluginFunctions->pFunReset) - return FEAPI_kUnspecifiedError; - - return FEAPI_kNoError; -} -#else -// no implementation yet for other plateforms -#endif - - - -#ifdef WIN32 -int FindPlugins(FEAPI_PluginFileNames_t *pstFileNames) -{ - struct _finddata_t DllFile; - long hFile; - int iNumOfPlugins = 0; - FEAPI_PluginFileNames_t *pCurrentStruct = pstFileNames; - FEAPI_PluginFunctions_t stPluginFunctions; - - /* Find first .dll file in current directory */ - if( (hFile = _findfirst( "*.dll", &DllFile )) == -1L ) - return iNumOfPlugins; - else - { - HMODULE hDllHandle; - - hDllHandle = LoadLibrary (DllFile.name); - - if (GetFunctionPointers(hDllHandle, &stPluginFunctions)) - { - // add to list - strcpy(pCurrentStruct->acFilename, DllFile.name); - pCurrentStruct->iMajorVersion = stPluginFunctions.pFunGetApiVersion (FEAPI_kMajorVersion); - pCurrentStruct->pNextPlugin = new FEAPI_PluginFileNames_t; - pCurrentStruct = pCurrentStruct->pNextPlugin; - pCurrentStruct->pNextPlugin = 0; - iNumOfPlugins++; - } - - if (hDllHandle) - FreeLibrary (hDllHandle); - - /* Find the rest of the .dll files */ - while( _findnext( hFile, &DllFile ) == 0 ) - { - hDllHandle = LoadLibrary (DllFile.name); - - if (GetFunctionPointers(hDllHandle, &stPluginFunctions)) - { - // add to list - strcpy(pCurrentStruct->acFilename, DllFile.name); - pCurrentStruct->iMajorVersion = stPluginFunctions.pFunGetApiVersion (FEAPI_kMajorVersion); - pCurrentStruct->pNextPlugin = new FEAPI_PluginFileNames_t; - pCurrentStruct = pCurrentStruct->pNextPlugin; - pCurrentStruct->pNextPlugin = 0; - iNumOfPlugins++; - } - if (hDllHandle) - FreeLibrary (hDllHandle); - } - - _findclose( hFile ); - } - - return iNumOfPlugins; -} - -#elif MAC - -int FindPlugins(FEAPI_PluginFileNames_t *pstFileNames) -{ - int iNumOfPlugins = 0; - FEAPI_PluginFileNames_t *pCurrentStruct = pstFileNames; - FEAPI_PluginFunctions_t stPluginFunctions; - - char acFeapiPath[1024]; - strcpy(acFeapiPath,getenv("HOME")); - strcat(acFeapiPath,"/library/Audio/Plug-Ins/FEAPI"); - - CFStringRef cfFeapiPlugInPath = CFStringCreateWithCString(kCFAllocatorDefault,acFeapiPath,kCFStringEncodingMacRoman); - CFURLRef cfFeapiPluginsURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,cfFeapiPlugInPath,kCFURLPOSIXPathStyle,true); - - // do we need to release and/or unload the bundles when created like that? - CFArrayRef bundleArray = CFBundleCreateBundlesFromDirectory(kCFAllocatorDefault,cfFeapiPluginsURL,NULL); - CFIndex iNumOfBundles = CFArrayGetCount(bundleArray); - - if( iNumOfBundles <= 0 ) - { - CFRelease(cfFeapiPlugInPath); - CFRelease(cfFeapiPluginsURL); - CFRelease(bundleArray); - return iNumOfPlugins; - } - - // search all bundles for FEAPI plugins - for(int i=0; i<iNumOfBundles; ++i) - { - CFBundleRef cfBundle = (CFBundleRef) CFArrayGetValueAtIndex(bundleArray,i); - - if (GetFunctionPointers(cfBundle, &stPluginFunctions)) - { - // add to list - CFURLRef cfBundleURL = CFBundleCopyBundleURL(cfBundle); - char acBundlePath[1024]; - CFURLGetFileSystemRepresentation(cfBundleURL,true,(UInt8 *)acBundlePath,1024); - strcpy(pCurrentStruct->acFilename, (const char*)acBundlePath); - - pCurrentStruct->iMajorVersion = stPluginFunctions.pFunGetApiVersion (FEAPI_kMajorVersion); - pCurrentStruct->pNextPlugin = new FEAPI_PluginFileNames_t; - pCurrentStruct = pCurrentStruct->pNextPlugin; - pCurrentStruct->pNextPlugin = 0; - iNumOfPlugins++; - } - } - - CFRelease(cfFeapiPlugInPath); - CFRelease(cfFeapiPluginsURL); - CFRelease(bundleArray); - - return iNumOfPlugins; -} -#else -// no implementation yet for other plateforms -#endif //WIN32 - - -FEAPI_Error_t LoadPluginModule(const char *pcFilename,FEAPI_ModuleHandle_t *phModule) -{ -#ifdef WIN32 - HMODULE hDllHandle = LoadLibrary (pcFilename); - if(hDllHandle) - { - *phModule = (FEAPI_ModuleHandle_t)hDllHandle; - return FEAPI_kNoError; - } - else - { - *phModule = 0; - return FEAPI_kUnspecifiedError; - } -#elif MAC - CFStringRef bundlePath = CFStringCreateWithCString(kCFAllocatorDefault,pcFilename,kCFStringEncodingMacRoman); - CFURLRef bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,bundlePath,kCFURLPOSIXPathStyle,true); - - CFBundleRef cfBundle = CFBundleCreate(kCFAllocatorDefault,bundleURL); - - CFRelease(bundlePath); - CFRelease(bundleURL); - - if(cfBundle) - { - *phModule = (FEAPI_ModuleHandle_t)cfBundle; - return FEAPI_kNoError; - } - else - { - std::cerr << "cfBundle is NULL"<< std::endl; - *phModule = 0; - return FEAPI_kUnspecifiedError; - } -#else - return FEAPI_kUnspecifiedError; // not implemented - -#endif -} - - -FEAPI_Error_t UnloadPluginModule(FEAPI_ModuleHandle_t hModule) -{ -#ifdef WIN32 - HMODULE hDllHandle = hModule; - - if (hDllHandle) - FreeLibrary (hDllHandle); - - return FEAPI_kNoError; -#elif Mac - CFBundleRef cfBundle = (CFBundleRef)hModule; - - if (cfBundle) - { - CFBundleUnloadExecutable(cfBundle); - CFRelease(cfBundle); - } - - return FEAPI_kNoError; -#else - return FEAPI_kUnspecifiedError; // not implemented -#endif -} - Modified: trunk/FEAPI/sdk/host/src/FEAPIPluginProxy.cpp =================================================================== --- trunk/FEAPI/sdk/host/src/FEAPIPluginProxy.cpp 2006-03-09 15:49:54 UTC (rev 59) +++ trunk/FEAPI/sdk/host/src/FEAPIPluginProxy.cpp 2006-03-09 18:15:49 UTC (rev 60) @@ -37,7 +37,7 @@ ////////////////////////////////////////////////////////////////////////////////// #include "FEAPIPluginProxy.h" -#include "FEAPIHostUtils.h" +#include "FEAPIHostUtilities.h" #include <iostream> /*! this defines the version of the Host API */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |