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
|
From 9b05a6f331506afa5aca8865677af83403d2a32d Mon Sep 17 00:00:00 2001
From: Tadeo Kondrak <me@tadeo.ca>
Date: Mon, 25 Jan 2021 11:17:44 -0700
Subject: [PATCH] Call weak function to allow adding preloaded plugins after
compile
---
src/core/vscore.cpp | 19 +++++++++++++++++++
src/core/vscore.h | 5 +++++
2 files changed, 24 insertions(+)
diff --git a/src/core/vscore.cpp b/src/core/vscore.cpp
index 2d29844d..35c509ed 100644
--- a/src/core/vscore.cpp
+++ b/src/core/vscore.cpp
@@ -1229,6 +1229,20 @@ void VSCore::destroyFilterInstance(VSNode *node) {
freeDepth--;
}
+extern "C" {
+void __attribute__((weak)) VSLoadPluginsNix(void (*load)(void *data, const char *path), void *data);
+
+struct VSLoadPluginsNixCallbackData {
+ VSCore *core;
+ const char *filter;
+};
+
+static void VSLoadPluginsNixCallback(void *data, const char *path) {
+ auto callbackData = static_cast<VSLoadPluginsNixCallbackData *>(data);
+ callbackData->core->loadAllPluginsInPath(path, callbackData->filter);
+}
+}
+
VSCore::VSCore(int threads) :
coreFreed(false),
numFilterInstances(1),
@@ -1351,6 +1365,11 @@ VSCore::VSCore(int threads) :
} // If neither exists, an empty string will do.
#endif
+ if (VSLoadPluginsNix != nullptr) {
+ VSLoadPluginsNixCallbackData data{this, filter.c_str()};
+ VSLoadPluginsNix(VSLoadPluginsNixCallback, &data);
+ }
+
VSMap *settings = readSettings(configFile);
const char *error = vs_internal_vsapi.getError(settings);
if (error) {
diff --git a/src/core/vscore.h b/src/core/vscore.h
index 74df8a84..3efac811 100644
--- a/src/core/vscore.h
+++ b/src/core/vscore.h
@@ -582,6 +582,9 @@ public:
VSFunction() : functionData(nullptr), func(nullptr) {}
};
+extern "C" {
+static void VSLoadPluginsNixCallback(void *data, const char *path);
+}
struct VSPlugin {
private:
@@ -683,6 +686,8 @@ public:
explicit VSCore(int threads);
void freeCore();
+
+ friend void VSLoadPluginsNixCallback(void *data, const char *path);
};
#endif // VSCORE_H
--
2.30.0
|