nixpkgs/pkgs/development/libraries/mediastreamer/plugins.patch

50 lines
1.1 KiB
Diff
Raw Normal View History

diff --git a/src/mscommon.c b/src/mscommon.c
index 1a12b2f..2399444 100644
--- a/src/mscommon.c
+++ b/src/mscommon.c
@@ -428,6 +428,7 @@ static MSSndCardDesc * ms_snd_card_descs[]={
void ms_init(){
int i;
MSSndCardManager *cm;
+ char *ms_plugin_path;
#ifdef __APPLE__
NSApplicationLoad();
@@ -451,7 +452,35 @@ void ms_init(){
}
ms_message("Loading plugins");
- ms_load_plugins(PACKAGE_PLUGINS_DIR);
+ ms_plugin_path = getenv("MS_PLUGIN_PATH");
+ do
+ {
+ if (!ms_plugin_path)
+ {
+ ms_load_plugins(PACKAGE_PLUGINS_DIR);
+ break;
+ }
+ char *dup_plugins_path = strdup (ms_plugin_path);
+ char *cur_plugins_dir = dup_plugins_path;
+ if (!dup_plugins_path)
+ {
+ ms_message("Failed to duplicate plugins path, not loading plugins");
+ break;
+ }
+ while (1)
+ {
+ char *next_delimiter = strchr(cur_plugins_dir, ":");
+ if (next_delimiter)
+ next_delimiter[0] = '\0';
+ ms_load_plugins(cur_plugins_dir);
+ if (!next_delimiter)
+ break;
+ cur_plugins_dir = next_delimiter + 1;
+ }
+ free(dup_plugins_path);
+ }
+ while (0);
+
ms_message("ms_init() done");
}