~oxalin/lightspark/buildnaudioplugin

« back to all changes in this revision

Viewing changes to backends/pluginmanager.h

  • Committer: Alessandro
  • Date: 2010-09-06 19:31:31 UTC
  • mfrom: (911.13.93)
  • Revision ID: git-v1:9f6175895e49dc81d39f6f99e66e2adc5a82bdb3
Merge branch 'master' of http://github.com/Oxalin/lightspark

Conflicts:
        CMakeLists.txt
        scripting/flashnet.cpp

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
    Lightspark, a free flash player implementation
 
3
 
 
4
    Copyright (C) 2009,2010  Alessandro Pignotti (a.pignotti@sssup.it)
 
5
 
 
6
    This program is free software: you can redistribute it and/or modify
 
7
    it under the terms of the GNU Lesser General Public License as published by
 
8
    the Free Software Foundation, either version 3 of the License, or
 
9
    (at your option) any later version.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
    GNU Lesser General Public License for more details.
 
15
 
 
16
    You should have received a copy of the GNU Lesser General Public License
 
17
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
**************************************************************************/
 
19
 
 
20
#ifndef PLUGINMANAGER_H
 
21
#define PLUGINMANAGER_H
 
22
 
 
23
#include "compat.h"
 
24
#include <iostream>
 
25
#include <boost/filesystem.hpp>
 
26
 
 
27
#include "interfaces/IPlugin.h"
 
28
 
 
29
using namespace std;
 
30
using namespace boost::filesystem;
 
31
 
 
32
//convenience typedef for the pointers to the 2 functions we expect to find in the plugin libraries
 
33
typedef IPlugin * ( *PLUGIN_FACTORY ) ();
 
34
typedef void ( *PLUGIN_CLEANUP ) ( IPlugin * );
 
35
 
 
36
namespace lightspark
 
37
{
 
38
 
 
39
class PluginModule;
 
40
 
 
41
class PluginManager
 
42
{
 
43
private:
 
44
        vector<PluginModule *> pluginsList;
 
45
        void findPlugins();
 
46
        void addPluginToList ( IPlugin *o_plugin, string pathToPlugin );
 
47
        void removePluginFromList ( string plugin_path );
 
48
        int32_t findPluginInList ( string desiredname = "", string desiredbackend = "", string desiredpath = "",
 
49
                                   HMODULE hdesiredLoadPlugin = NULL, IPlugin *o_desiredPlugin = NULL );
 
50
        void loadPlugin ( uint32_t desiredindex );
 
51
        void unloadPlugin ( uint32_t desiredIndex );
 
52
 
 
53
public:
 
54
        PluginManager();
 
55
        vector<string *> get_backendsList ( PLUGIN_TYPES typeSearched );
 
56
        IPlugin *get_plugin ( string desiredBackend );
 
57
        void release_plugin ( IPlugin *o_plugin );
 
58
        ~PluginManager();
 
59
};
 
60
 
 
61
class PluginModule
 
62
{
 
63
        friend class PluginManager;
 
64
protected:
 
65
        string pluginName;              //plugin name
 
66
        PLUGIN_TYPES pluginType;        //plugin type to be able to filter them
 
67
        string backendName;     //backend (can be something like pulseaudio, opengl, ffmpeg)
 
68
        string pluginPath;              //full path to the plugin file
 
69
        bool enabled;           //should it be enabled (if the audio backend is present)?
 
70
        HMODULE hLoadedPlugin;  //when loaded, handle to the plugin so we can unload it later
 
71
        IPlugin *oLoadedPlugin; //when instanciated, object to the class
 
72
 
 
73
public:
 
74
        PluginModule();
 
75
        ~PluginModule();
 
76
};
 
77
 
 
78
}
 
79
 
 
80
#endif