summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authormethodus <methodus@web.de>2012-09-30 15:52:54 +0200
committermethodus <methodus@web.de>2012-09-30 15:52:54 +0200
commitc8e697daf68f1c545ee3962d2f2e9b411c56b4f2 (patch)
tree48bc206a65ad956ab4284113c33d4b1d50398495 /include
parentdd3e8652f530c35febcc3f595e38443395f79198 (diff)
downloadvdr-plugin-upnp-c8e697daf68f1c545ee3962d2f2e9b411c56b4f2.tar.gz
vdr-plugin-upnp-c8e697daf68f1c545ee3962d2f2e9b411c56b4f2.tar.bz2
Working on plugin interface. PluginManager almost done.
Diffstat (limited to 'include')
-rw-r--r--include/media/mediaManager.h28
-rw-r--r--include/plugin.h2
-rw-r--r--include/pluginManager.h38
3 files changed, 53 insertions, 15 deletions
diff --git a/include/media/mediaManager.h b/include/media/mediaManager.h
index 09b3919..18cf458 100644
--- a/include/media/mediaManager.h
+++ b/include/media/mediaManager.h
@@ -40,13 +40,14 @@ public:
std::string GetTransferMode(const std::string& requestedMode ) const;
bool Seekable() const;
- bool Open(string uri);
+ bool Open();
size_t Read(char* buf, size_t bufLen);
bool Seek(size_t offset, int origin);
void Close();
};
class cMediaManager : public cThread {
+ friend class upnp::cPluginManager;
private:
struct MediaRequest {
@@ -80,7 +81,8 @@ public:
cMediaManager();
virtual ~cMediaManager();
- void SetDatabaseFile(string file);
+ void SetPluginDirectory(const string& directory);
+ void SetDatabaseFile(const string& file);
bool Initialise();
@@ -108,11 +110,23 @@ private:
cUPnPResourceProvider* CreateResourceProvider(const std::string& uri);
- uint32_t mSystemUpdateID;
- IdList mEventedContainerUpdateIDs;
- StringList mScanDirectories;
- string mDatabaseFile;
- tntdb::Connection mConnection;
+ void AddProviderFunctor(upnp::cPluginManager::FunctionPtr providerFunctor);
+ void AddProfiler(cMediaProfiler* profiler);
+
+ uint32_t systemUpdateID;
+ IdList eventedContainerUpdateIDs;
+ StringList scanDirectories;
+ string databaseFile;
+ string pluginDirectory;
+ tntdb::Connection connection;
+
+ upnp::cPluginManager* pluginManager;
+
+ typedef std::map<std::string, upnp::cPluginManager::FunctionPtr> ProviderMap;
+ typedef std::list<boost::shared_ptr<cMediaProfiler>> ProfilerList;
+
+ ProviderMap providers;
+ ProfilerList profilers;
};
diff --git a/include/plugin.h b/include/plugin.h
index da68ba9..6b4a94d 100644
--- a/include/plugin.h
+++ b/include/plugin.h
@@ -15,6 +15,8 @@
using namespace std;
+#define UPNPPLUGIN_VERSION "1.0.0"
+
namespace upnp {
namespace property {
diff --git a/include/pluginManager.h b/include/pluginManager.h
index 215f224..5c38e34 100644
--- a/include/pluginManager.h
+++ b/include/pluginManager.h
@@ -9,21 +9,43 @@
#define PLUGINMANAGER_H_
#include "../include/plugin.h"
+#include <string>
+#include <map>
+#include <list>
namespace upnp {
+class cMediaManager;
+
class cPluginManager {
public:
- cUPnPResourceProvider* CreateResourceProviderInstance(const std::string& schema);
-private:
- void LoadPlugins();
- void UnloadPlugins();
+ typedef void*(*FunctionPtr)(void);
- typedef std::list<cUPnPResourceProvider> ProviderList;
- typedef std::list<cMediaProfiler> ProfilerList;
+ cPluginManager(cMediaManager* manager);
+ virtual ~cPluginManager();
+
+ bool LoadPlugins(const std::string& directory);
+private:
+ class DLL {
+ public:
+ DLL(const std::string& file);
+ virtual ~DLL();
+
+ bool Load();
+ FunctionPtr GetProvider() const { return provider; };
+ FunctionPtr GetProfiler() const { return profiler; };
+ private:
+ std::string file;
+ void* handle;
+ FunctionPtr provider;
+ FunctionPtr profiler;
+ };
+
+ typedef std::list<boost::shared_ptr<DLL>> DLLList;
+
+ DLLList dlls;
+ cMediaManager* manager;
- ProviderList providers;
- ProfilerList profilers;
};
} // namespace upnp