aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/libraries/vapoursynth/0001-Call-weak-function-to-allow-adding-preloaded-plugins.patch
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/libraries/vapoursynth/0001-Call-weak-function-to-allow-adding-preloaded-plugins.patch')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/libraries/vapoursynth/0001-Call-weak-function-to-allow-adding-preloaded-plugins.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/libraries/vapoursynth/0001-Call-weak-function-to-allow-adding-preloaded-plugins.patch b/infra/libkookie/nixpkgs/pkgs/development/libraries/vapoursynth/0001-Call-weak-function-to-allow-adding-preloaded-plugins.patch
new file mode 100644
index 000000000000..0937ac6e3084
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/libraries/vapoursynth/0001-Call-weak-function-to-allow-adding-preloaded-plugins.patch
@@ -0,0 +1,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
+