1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
#ifndef f_PLUGINS_H
#define f_PLUGINS_H
#include <vd2/system/vdtypes.h>
#include <vd2/system/VDString.h>
#include <vd2/plugin/vdvideofilt.h>
#include <vector>
#include <map>
class VDExternalModule;
struct VDXPluginInfo;
typedef VDXPluginInfo VDPluginInfo;
struct VDPluginDescription {
VDStringW mName;
VDStringW mAuthor;
VDStringW mDescription;
uint32 mVersion;
uint32 mType;
VDExternalModule *mpModule;
const VDPluginInfo *mpInfo;
const VDPluginInfo *mpShadowedInfo;
bool mbHasStaticAbout;
bool mbHasStaticConfigure;
};
struct VDXFilterModule { // formerly FilterModule
struct VDXFilterModule *next, *prev;
VDXHINSTANCE hInstModule;
VDXFilterModuleInitProc initProc;
VDXFilterModuleDeinitProc deinitProc;
};
class VDExternalModule {
public:
VDExternalModule(const VDStringW& filename);
~VDExternalModule();
bool Lock();
void Unlock();
bool IsConfigureSupported() const;
bool IsAboutSupported() const;
int GetVideoFilterAPIVersion() const { return mVFHighVersion; }
const VDStringW& GetFilename() const { return mFilename; }
VDXFilterModule& GetFilterModuleInfo() { return mModuleInfo; }
protected:
void DisconnectOldPlugins();
void ReconnectOldPlugins();
bool ReconnectPlugins();
VDStringW mFilename;
HMODULE mhModule;
int mModuleRefCount;
int mVFHighVersion; // video filter high version (from module init)
VDXFilterModule mModuleInfo;
};
void VDDeinitPluginSystem();
bool VDAddPluginModule(const wchar_t *pFilename);
void VDAddInternalPlugins(const VDPluginInfo *const *ppInfo);
VDExternalModule * VDGetExternalModuleByFilterModule(const VDXFilterModule *);
VDPluginDescription * VDGetPluginDescription(const wchar_t *pName, uint32 mType);
void VDEnumeratePluginDescriptions(std::vector<VDPluginDescription *>& plugins, uint32 type);
void VDLoadPlugins(const VDStringW& path, int& succeeded, int& failed);
const VDPluginInfo * VDLockPlugin(VDPluginDescription *pDesc);
void VDUnlockPlugin(VDPluginDescription *pDesc);
void VDConnectPluginDescription(const VDPluginInfo *pInfo, VDExternalModule *pModule);
class VDPluginPtr {
public:
VDPluginPtr() : mpDesc(NULL) {}
VDPluginPtr(VDPluginDescription *pDesc);
VDPluginPtr(const VDPluginPtr& src);
~VDPluginPtr();
VDPluginPtr& operator=(const VDPluginPtr& src);
VDPluginPtr& operator=(VDPluginDescription *pDesc);
bool operator!() const { return !mpDesc; }
VDPluginDescription *operator->() const { return mpDesc; }
VDPluginDescription& operator*() const { return *mpDesc; }
protected:
VDPluginDescription *mpDesc;
};
union VDPluginConfigVariantData {
uint32 vu32;
sint32 vs32;
uint64 vu64;
sint64 vs64;
double vfd;
struct NarrowString {
char *s;
} vsa;
struct WideString {
wchar_t *s;
} vsw;
struct Block {
uint32 len;
char *s;
} vb;
};
class VDPluginConfigVariant {
public:
enum {
kTypeInvalid = 0,
kTypeU32 = 1,
kTypeS32,
kTypeU64,
kTypeS64,
kTypeDouble,
kTypeAStr,
kTypeWStr,
kTypeBlock
};
VDPluginConfigVariant() : mType(kTypeInvalid) {}
VDPluginConfigVariant(const VDPluginConfigVariant&);
~VDPluginConfigVariant();
VDPluginConfigVariant& operator=(const VDPluginConfigVariant&);
unsigned GetType() const { return mType; }
void Clear();
void SetU32(uint32 v) { Clear(); mType = kTypeU32; mData.vu32 = v; }
void SetS32(sint32 v) { Clear(); mType = kTypeS32; mData.vs32 = v; }
void SetU64(uint64 v) { Clear(); mType = kTypeU64; mData.vu64 = v; }
void SetS64(sint64 v) { Clear(); mType = kTypeS64; mData.vs64 = v; }
void SetDouble(double v) { Clear(); mType = kTypeDouble; mData.vfd = v; }
void SetAStr(const char *s);
void SetWStr(const wchar_t *s);
void SetBlock(const void *s, unsigned b);
const uint32& GetU32() const { return mData.vu32; }
const sint32& GetS32() const { return mData.vs32; }
const uint64& GetU64() const { return mData.vu64; }
const sint64& GetS64() const { return mData.vs64; }
const double& GetDouble() const { return mData.vfd; }
const char *GetAStr() const { return mData.vsa.s; }
const wchar_t *GetWStr() const { return mData.vsw.s; }
const void *GetBlockPtr() const { return mData.vb.s; }
const unsigned GetBlockLen() const { return mData.vb.len; }
protected:
unsigned mType;
VDPluginConfigVariantData mData;
};
typedef std::map<unsigned, VDPluginConfigVariant> VDPluginConfig;
#endif
|