Exemplo n.º 1
0
DocumentWriterPlugin::DocumentWriterPlugin()
#ifdef SCASE1_PLUGIN_DOCUMENTWRITER_PREDICTION_ENABLED
    : presageCallback(presageStdContext),
      presage(&presageCallback, "plugins/presage/presage.xml")
#endif
{
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf-8"));

    browserItemDelegate = NULL;
    rootLevel = NULL;

    autosave = true;

#ifdef SCASE1_PLUGIN_DEBUG_LEVEL_VERBOSE
    qDebug() << "DocumentWriterPlugin::DocumentWriterPlugin:pluginDirPath?" << getPluginPath();
#endif

    settings = new QSettings(getPluginPath() + SCASE1_PLUGIN_DOCUMENTWRITER_SETTINGS_FILE + ".ini", QSettings::IniFormat, this);

    presentationWidget = new DWPTextEdit(settings->value("presentation/ignore_keypresses", false).toBool());

    presentationWidget->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    presentationWidget->setUndoRedoEnabled(true);
    presentationWidget->ensureCursorVisible();
    presentationWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

#ifdef SCASE1_PLUGIN_DOCUMENTWRITER_PREDICTION_ENABLED
    predictedItemsAdded = 0;
#endif

    connect(presentationWidget, SIGNAL(textChanged()), this, SLOT(textHasChanged()));
}
Exemplo n.º 2
0
//----------------------------------------------------------------------------
long ctkPluginFrameworkLauncher::install(const QString& symbolicName, ctkPluginContext* context)
{
  QString pluginPath = getPluginPath(symbolicName);
  if (pluginPath.isEmpty()) return -1;

  ctkPluginContext* pc = context;

  if (pc == 0 && d->fwFactory == 0) {
    d->fwFactory = new ctkPluginFrameworkFactory(d->fwProps);
    try
    {
      d->fwFactory->getFramework()->init();
      pc = getPluginContext();
    }
    catch (const ctkPluginException& exc)
    {
      qCritical() << "Failed to initialize the plug-in framework:" << exc;
      delete d->fwFactory;
      d->fwFactory = 0;
      return -1;
    }
  }

  try
  {
    return pc->installPlugin(QUrl::fromLocalFile(pluginPath))->getPluginId();
  }
  catch (const ctkPluginException& exc)
  {
    qWarning() << "Failed to install plugin:" << exc;
    return -1;
  }

}
Exemplo n.º 3
0
int linkToNetworkTransmission(char * moduleName,char * modulePossiblePath ,char * moduleLib)
{
   char *error;
   char functionNameStr[1024]={0};

   if (!getPluginPath(modulePossiblePath,moduleLib,functionNameStr,1024))
       {
          fprintf(stderr,RED "Could not find %s (try adding it to current directory)\n" NORMAL , moduleLib);
          return 0;
       }

   remoteNetworkDLhandle = dlopen (functionNameStr, RTLD_LAZY);
   if (!remoteNetworkDLhandle)
       {
        fprintf (stderr,RED "Failed while loading code for %s plugin from %s\n Error : %s\n" NORMAL, moduleName , functionNameStr , dlerror());
        return 0;
       }

  dlerror();    /* Clear any existing error */


  //Start Stop ================================================================================================================
  startPushingToRemoteNetwork = dlsym(remoteNetworkDLhandle, "networkBackbone_startPushingToRemote" );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW "Could not find a definition of networkBackbone_startPushingToRemote : %s\n" NORMAL,error); }

  stopPushingToRemoteNetwork = dlsym(remoteNetworkDLhandle, "networkBackbone_stopPushingToRemote" );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW "Could not find a definition of networkBackbone_stopPushingToRemote : %s\n" NORMAL,error); }

  pushImageToRemoteNetwork = dlsym(remoteNetworkDLhandle, "networkBackbone_pushImageToRemote" );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW "Could not find a definition of networkBackbone_pushImageToRemote : %s\n" NORMAL,error); }

  return 1;
}
Exemplo n.º 4
0
//----------------------------------------------------------------------------
bool ctkPluginFrameworkLauncher::start(const QString& symbolicName, ctkPlugin::StartOptions options,
                                       ctkPluginContext* context)
{
  // instantiate and start the framework
  if (context == 0 && d->fwFactory == 0) {
    d->fwFactory = new ctkPluginFrameworkFactory(d->fwProps);
    try
    {
      d->fwFactory->getFramework()->start();
    }
    catch (const ctkPluginException& exc)
    {
      qCritical() << "Failed to start the plug-in framework:" << exc;
      delete d->fwFactory;
      d->fwFactory = 0;
      return false;
    }
  }
  else if (context == 0 && d->fwFactory->getFramework()->getState() != ctkPlugin::ACTIVE)
  {
    try
    {
      d->fwFactory->getFramework()->start(options);
    }
    catch (const ctkPluginException& exc)
    {
      qCritical() << "Failed to start the plug-in framework:" << exc;
      delete d->fwFactory;
      d->fwFactory = 0;
      return false;
    }
  }

  if(!symbolicName.isEmpty())
  {
    QString pluginPath = getPluginPath(symbolicName);
    if (pluginPath.isEmpty()) return false;

    ctkPluginContext* pc = context ? context : getPluginContext();
    try
    {
      pc->installPlugin(QUrl::fromLocalFile(pluginPath))->start(options);
    }
    catch (const ctkPluginException& exc)
    {
      qWarning() << "Failed to install plugin:" << exc;
      return false;
    }
  }

  return true;
}
Exemplo n.º 5
0
int acquisitionIsModuleLinked(ModuleIdentifier moduleID)
{
  if (moduleID < NUMBER_OF_POSSIBLE_MODULES)
  {
   char tmp[1024];
   return getPluginPath (
                         getPluginStr(moduleID,PLUGIN_PATH_STR) ,
                         getPluginStr(moduleID,PLUGIN_LIBNAME_STR) ,
                         tmp,
                         1024
                         );
  }
  return 0;
}
Exemplo n.º 6
0
void
FeatureExtractionPluginFactory::generateTaxonomy()
{
    std::vector<QString> pluginPath = getPluginPath();
    std::vector<QString> path;

    for (size_t i = 0; i < pluginPath.size(); ++i) {
	if (pluginPath[i].contains("/lib/")) {
	    QString p(pluginPath[i]);
            path.push_back(p);
	    p.replace("/lib/", "/share/");
	    path.push_back(p);
	}
	path.push_back(pluginPath[i]);
    }

    for (size_t i = 0; i < path.size(); ++i) {

	QDir dir(path[i], "*.cat");

//	std::cerr << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i].toStdString() << " has " << dir.count() << " .cat files" << std::endl;
	for (unsigned int j = 0; j < dir.count(); ++j) {

	    QFile file(path[i] + "/" + dir[j]);

//	    std::cerr << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i].toStdString() + "/" + dir[j].toStdString()) << std::endl;

	    if (file.open(QIODevice::ReadOnly)) {
//		    std::cerr << "...opened" << std::endl;
		QTextStream stream(&file);
		QString line;

		while (!stream.atEnd()) {
		    line = stream.readLine();
//		    std::cerr << "line is: \"" << line.toStdString() << "\"" << std::endl;
		    QString id = PluginIdentifier::canonicalise
                        (line.section("::", 0, 0));
		    QString cat = line.section("::", 1, 1);
		    m_taxonomy[id] = cat;
//		    std::cerr << "FeatureExtractionPluginFactory: set id \"" << id.toStdString() << "\" to cat \"" << cat.toStdString() << "\"" << std::endl;
		}
	    }
	}
    }
}    
Exemplo n.º 7
0
void Audio::init(void)
{
#ifndef BUILD_STATIC
    char path[256];
    dir_t dir;
    const char *dp = getPluginPath();
    char filename[65];

    if(!dp)
        return;

    dir.open(dp);

    while(is(dir) && dir.read(filename, sizeof(filename)) > 0) {
        if(filename[0] == '.')
            continue;

        snprintf(path, sizeof(path), "%s/%s", dp, filename);
        fsys::load(path);
    }
    dir.close();
#endif
}
Exemplo n.º 8
0
//----------------------------------------------------------------------------
bool ctkPluginFrameworkLauncher::stop(const QString& symbolicName,
                                      ctkPlugin::StopOptions options, ctkPluginContext* context)
{
  if (d->fwFactory == 0) return true;

  ctkPluginContext* pc = context ? context : getPluginContext();
  if (pc == 0)
  {
    qWarning() << "No valid plug-in context available";
    return false;
  }

  if(!symbolicName.isEmpty())
  {
    QString pluginPath = getPluginPath(symbolicName);
    if (pluginPath.isEmpty()) return false;

    try
    {
      QList<QSharedPointer<ctkPlugin> > plugins = pc->getPlugins();
      foreach(QSharedPointer<ctkPlugin> plugin, plugins)
      {
        if (plugin->getSymbolicName() == symbolicName)
        {
          plugin->stop(options);
          return true;
        }
      }
      qWarning() << "Plug-in" << symbolicName << "not found";
      return false;
    }
    catch (const ctkPluginException& exc)
    {
      qWarning() << "Failed to stop plug-in:" << exc;
      return false;
    }
  }
Exemplo n.º 9
0
int linkToPlugin(char * moduleName,char * modulePossiblePath ,char * moduleLib ,  ModuleIdentifier moduleID)
{

   char *error;
   char functionNameStr[1024]={0};

   if (!getPluginPath(modulePossiblePath,moduleLib,functionNameStr,1024))
       {
          fprintf(stderr,RED "Could not find %s (try adding it to current directory)\n" NORMAL , moduleLib);
          return 0;
       }

   plugins[moduleID].handle = dlopen (functionNameStr, RTLD_LAZY);
   if (!plugins[moduleID].handle)
       {
        fprintf (stderr,RED "Failed while loading code for %s plugin from %s\n Error : %s\n" NORMAL, moduleName , functionNameStr , dlerror());
        return 0;
       }

    dlerror();    /* Clear any existing error */


  //Start Stop ================================================================================================================
  sprintf(functionNameStr,"start%sModule",moduleName);
  plugins[moduleID].startModule = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }

  sprintf(functionNameStr,"stop%sModule",moduleName);
  plugins[moduleID].stopModule = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }

  //================================================================================================================
  sprintf(functionNameStr,"map%sDepthToRGB",moduleName);
  plugins[moduleID].mapDepthToRGB = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"map%sRGBToDepth",moduleName);
  plugins[moduleID].mapRGBToDepth = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }


  sprintf(functionNameStr,"create%sDevice",moduleName);
  plugins[moduleID].createDevice = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"destroy%sDevice",moduleName);
  plugins[moduleID].destroyDevice = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }


  sprintf(functionNameStr,"get%sNumberOfDevices",moduleName);
  plugins[moduleID].getNumberOfDevices = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }


  sprintf(functionNameStr,"seek%sFrame",moduleName);
  plugins[moduleID].seekFrame = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"snap%sFrames",moduleName);
  plugins[moduleID].snapFrames = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }


  sprintf(functionNameStr,"getLast%sColorTimestamp",moduleName);
  plugins[moduleID].getLastColorTimestamp = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"getLast%sDepthTimestamp",moduleName);
  plugins[moduleID].getLastDepthTimestamp = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }


  sprintf(functionNameStr,"get%sColorWidth",moduleName);
  plugins[moduleID].getColorWidth = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sColorHeight",moduleName);
  plugins[moduleID].getColorHeight = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sColorDataSize",moduleName);
  plugins[moduleID].getColorDataSize = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sColorChannels",moduleName);
  plugins[moduleID].getColorChannels = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sColorBitsPerPixel",moduleName);
  plugins[moduleID].getColorBitsPerPixel = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sColorPixels",moduleName);
  plugins[moduleID].getColorPixels = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sColorFocalLength",moduleName);
  plugins[moduleID].getColorFocalLength = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sColorPixelSize",moduleName);
  plugins[moduleID].getColorPixelSize = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sColorCalibration",moduleName);
  plugins[moduleID].getColorCalibration = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"set%sColorCalibration",moduleName);
  plugins[moduleID].setColorCalibration = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }



  sprintf(functionNameStr,"get%sDepthWidth",moduleName);
  plugins[moduleID].getDepthWidth = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sDepthHeight",moduleName);
  plugins[moduleID].getDepthHeight = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sDepthDataSize",moduleName);
  plugins[moduleID].getDepthDataSize = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sDepthChannels",moduleName);
  plugins[moduleID].getDepthChannels = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sDepthBitsPerPixel",moduleName);
  plugins[moduleID].getDepthBitsPerPixel = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sDepthPixels",moduleName);
  plugins[moduleID].getDepthPixels = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sDepthFocalLength",moduleName);
  plugins[moduleID].getDepthFocalLength = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sDepthPixelSize",moduleName);
  plugins[moduleID].getDepthPixelSize = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"get%sDepthCalibration",moduleName);
  plugins[moduleID].getDepthCalibration = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }
  sprintf(functionNameStr,"set%sDepthCalibration",moduleName);
  plugins[moduleID].setDepthCalibration = dlsym(plugins[moduleID].handle, functionNameStr );
  if ((error = dlerror()) != NULL)  { fprintf (stderr, YELLOW  "Could not find a definition of %s : %s\n" NORMAL ,functionNameStr ,  error); }

  return 1;
}
Exemplo n.º 10
0
QString
FeatureExtractionPluginFactory::findPluginFile(QString soname, QString inDir)
{
    QString file = "";

#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
    std::cerr << "FeatureExtractionPluginFactory::findPluginFile(\""
              << soname.toStdString() << "\", \"" << inDir.toStdString() << "\")"
              << std::endl;
#endif

    if (inDir != "") {

        QDir dir(inDir, PLUGIN_GLOB,
                 QDir::Name | QDir::IgnoreCase,
                 QDir::Files | QDir::Readable);
        if (!dir.exists()) return "";

        file = dir.filePath(QFileInfo(soname).fileName());

        if (QFileInfo(file).exists() && QFileInfo(file).isFile()) {

#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
            std::cerr << "FeatureExtractionPluginFactory::findPluginFile: "
                      << "found trivially at " << file.toStdString() << std::endl;
#endif

            return file;
        }

	for (unsigned int j = 0; j < dir.count(); ++j) {
            file = dir.filePath(dir[j]);
            if (QFileInfo(file).baseName() == QFileInfo(soname).baseName()) {

#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
                std::cerr << "FeatureExtractionPluginFactory::findPluginFile: "
                          << "found \"" << soname.toStdString() << "\" at " << file.toStdString() << std::endl;
#endif

                return file;
            }
        }

#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
        std::cerr << "FeatureExtractionPluginFactory::findPluginFile (with dir): "
                  << "not found" << std::endl;
#endif

        return "";

    } else {

        QFileInfo fi(soname);

        if (fi.isAbsolute() && fi.exists() && fi.isFile()) {
#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
            std::cerr << "FeatureExtractionPluginFactory::findPluginFile: "
                      << "found trivially at " << soname.toStdString() << std::endl;
#endif
            return soname;
        }

        if (fi.isAbsolute() && fi.absolutePath() != "") {
            file = findPluginFile(soname, fi.absolutePath());
            if (file != "") return file;
        }

        std::vector<QString> path = getPluginPath();
        for (std::vector<QString>::iterator i = path.begin();
             i != path.end(); ++i) {
            if (*i != "") {
                file = findPluginFile(soname, *i);
                if (file != "") return file;
            }
        }

#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
        std::cerr << "FeatureExtractionPluginFactory::findPluginFile: "
                  << "not found" << std::endl;
#endif

        return "";
    }
}
Exemplo n.º 11
0
std::vector<QString>
FeatureExtractionPluginFactory::getPluginIdentifiers()
{
    Profiler profiler("FeatureExtractionPluginFactory::getPluginIdentifiers");

    std::vector<QString> rv;
    std::vector<QString> path = getPluginPath();
    
    for (std::vector<QString>::iterator i = path.begin(); i != path.end(); ++i) {

#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
        std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: scanning directory " << i->toStdString() << std::endl;
#endif

	QDir pluginDir(*i, PLUGIN_GLOB,
                       QDir::Name | QDir::IgnoreCase,
                       QDir::Files | QDir::Readable);

	for (unsigned int j = 0; j < pluginDir.count(); ++j) {

            QString soname = pluginDir.filePath(pluginDir[j]);

#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
            std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: trying potential library " << soname.toStdString() << std::endl;
#endif

            void *libraryHandle = DLOPEN(soname, RTLD_LAZY | RTLD_LOCAL);
            
            if (!libraryHandle) {
                std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Failed to load library " << soname.toStdString() << ": " << DLERROR() << std::endl;
                continue;
            }

#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
            std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: It's a library all right, checking for descriptor" << std::endl;
#endif

            VampGetPluginDescriptorFunction fn = (VampGetPluginDescriptorFunction)
                DLSYM(libraryHandle, "vampGetPluginDescriptor");

            if (!fn) {
                std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: No descriptor function in " << soname.toStdString() << std::endl;
                if (DLCLOSE(libraryHandle) != 0) {
                    std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Failed to unload library " << soname.toStdString() << std::endl;
                }
                continue;
            }

#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
            std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Vamp descriptor found" << std::endl;
#endif

            const VampPluginDescriptor *descriptor = 0;
            int index = 0;

            std::map<std::string, int> known;
            bool ok = true;

            while ((descriptor = fn(VAMP_API_VERSION, index))) {

                if (known.find(descriptor->identifier) != known.end()) {
                    std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Plugin library "
                              << soname.toStdString()
                              << " returns the same plugin identifier \""
                              << descriptor->identifier << "\" at indices "
                              << known[descriptor->identifier] << " and "
                              << index << std::endl;
                    std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Avoiding this library (obsolete API?)" << std::endl;
                    ok = false;
                    break;
                } else {
                    known[descriptor->identifier] = index;
                }

                ++index;
            }

            if (ok) {

                index = 0;

                while ((descriptor = fn(VAMP_API_VERSION, index))) {

                    QString id = PluginIdentifier::createIdentifier
                        ("vamp", soname, descriptor->identifier);
                    rv.push_back(id);
#ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
                    std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Found plugin id " << id.toStdString() << " at index " << index << std::endl;
#endif
                    ++index;
                }
            }
            
            if (DLCLOSE(libraryHandle) != 0) {
                std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Failed to unload library " << soname.toStdString() << std::endl;
            }
	}
    }

    generateTaxonomy();

    return rv;
}
Exemplo n.º 12
0
#include "overlay_texture.h"
#include <Windows.h>
#include "filesystem.h"
#include "common.h"
#include "util.h"
#include "jvm_connection.hpp"
#include "logging.h"

static const char* RFACTOR_PATH = getRFactorPath();
static const char* PLUGIN_PATH = getPluginPath();
static const char* CONFIG_PATH = getConfigPath();

static char* fileBuffer = (char*)malloc( MAX_PATH );

OverlayTextureManager* textureManager = NULL;

unsigned short resX, resY;

static PixelBufferCallback* pixBuffCallback = new PixelBufferCallback();

unsigned char* PixelBufferCallback::getPixelBuffer( const unsigned char textureIndex, void** userObject )
{
    return ( getGlobal()->jvmConn.d3dFuncs.getPixelData( textureIndex ) );
}

void PixelBufferCallback::releasePixelBuffer( const unsigned char textureIndex, unsigned char* buffer, void* userObject )
{
    getGlobal()->jvmConn.d3dFuncs.releasePixelData( textureIndex, buffer );
}

void D3DManager::renderOverlay( void* d3dDev, const float postScaleX, const float postScaleY, JVMD3DUpdateFunctions* d3dFuncs )