summaryrefslogtreecommitdiff
path: root/libs/ardour/vst_info_file.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-03-13 16:50:44 +0100
committerRobin Gareus <robin@gareus.org>2014-03-13 16:58:07 +0100
commit543099afbafe83a0bb334f2a016c0d849fe2ca47 (patch)
tree21798ed902efe449dd329c556280fb5247a9be91 /libs/ardour/vst_info_file.cc
parentf48b5568883468e70a751ec1aa934e5a55bb7705 (diff)
rework SystemExec - use vfork wrapper (and lots of related stuff)
Diffstat (limited to 'libs/ardour/vst_info_file.cc')
-rw-r--r--libs/ardour/vst_info_file.cc40
1 files changed, 23 insertions, 17 deletions
diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc
index fe434909f3..a0426edad1 100644
--- a/libs/ardour/vst_info_file.cc
+++ b/libs/ardour/vst_info_file.cc
@@ -40,12 +40,18 @@
#include <glib/gstdio.h>
#include <glibmm.h>
-#include "pbd/error.h"
-#ifndef VST_SCANNER_APP
-#include "pbd/system_exec.h"
+#ifdef VST_SCANNER_APP
+#define errormsg cerr
+#define warningmsg cerr
+#define endmsg endl
+#else
#include "ardour/plugin_manager.h" // scanner_bin_path
#include "ardour/rc_configuration.h"
+#include "ardour/system_exec.h"
+#include "pbd/error.h"
+#define errormsg PBD::error
+#define warningmsg PBD::warning
#endif
#include "ardour/filesystem_paths.h"
@@ -324,7 +330,7 @@ vstfx_write_info_file (FILE* fp, vector<VSTInfo *> *infos)
} else if (infos->size() == 1) {
vstfx_write_info_block(fp, infos->front());
} else {
- PBD::error << "Zero plugins in VST." << endmsg; // XXX here? rather make this impossible before if it ain't already.
+ errormsg << "Zero plugins in VST." << endmsg; // XXX here? rather make this impossible before if it ain't already.
}
}
@@ -508,7 +514,7 @@ vstfx_get_info_from_file(const char* dllpath, vector<VSTInfo*> *infos)
rv = vstfx_load_info_file(infofile, infos);
fclose (infofile);
if (!rv) {
- PBD::warning << "Cannot get VST information form " << dllpath << ": info file load failed." << endmsg;
+ warningmsg << "Cannot get VST information form " << dllpath << ": info file load failed." << endmsg;
}
}
return rv;
@@ -774,7 +780,7 @@ vstfx_instantiate_and_get_info_lx (
VSTHandle* h;
VSTState* vstfx;
if (!(h = vstfx_load(dllpath))) {
- PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": load failed." << endmsg;
+ warningmsg << "Cannot get LinuxVST information from " << dllpath << ": load failed." << endmsg;
return false;
}
@@ -782,7 +788,7 @@ vstfx_instantiate_and_get_info_lx (
if (!(vstfx = vstfx_instantiate(h, simple_master_callback, 0))) {
vstfx_unload(h);
- PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": instantiation failed." << endmsg;
+ warningmsg << "Cannot get LinuxVST information from " << dllpath << ": instantiation failed." << endmsg;
return false;
}
@@ -803,7 +809,7 @@ vstfx_instantiate_and_get_info_fst (
VSTHandle* h;
VSTState* vstfx;
if(!(h = fst_load(dllpath))) {
- PBD::warning << "Cannot get Windows VST information from " << dllpath << ": load failed." << endmsg;
+ warningmsg << "Cannot get Windows VST information from " << dllpath << ": load failed." << endmsg;
return false;
}
@@ -812,7 +818,7 @@ vstfx_instantiate_and_get_info_fst (
if(!(vstfx = fst_instantiate(h, simple_master_callback, 0))) {
fst_unload(&h);
vstfx_current_loading_id = 0;
- PBD::warning << "Cannot get Windows VST information from " << dllpath << ": instantiation failed." << endmsg;
+ warningmsg << "Cannot get Windows VST information from " << dllpath << ": instantiation failed." << endmsg;
return false;
}
vstfx_current_loading_id = 0;
@@ -834,14 +840,14 @@ static char * _errorlog_dll = 0;
static void parse_scanner_output (std::string msg, size_t /*len*/)
{
if (!_errorlog_fd && !_errorlog_dll) {
- PBD::error << "VST scanner: " << msg;
+ errormsg << "VST scanner: " << msg;
return;
}
if (!_errorlog_fd) {
if (!(_errorlog_fd = fopen(vstfx_errorfile_path(_errorlog_dll, 0).c_str(), "w"))) {
if (!(_errorlog_fd = fopen(vstfx_errorfile_path(_errorlog_dll, 1).c_str(), "w"))) {
- PBD::error << "Cannot create plugin error-log for plugin " << _errorlog_dll;
+ errormsg << "Cannot create plugin error-log for plugin " << _errorlog_dll;
free(_errorlog_dll);
_errorlog_dll = NULL;
}
@@ -851,7 +857,7 @@ static void parse_scanner_output (std::string msg, size_t /*len*/)
if (_errorlog_fd) {
fprintf (_errorlog_fd, "%s\n", msg.c_str());
} else {
- PBD::error << "VST scanner: " << msg;
+ errormsg << "VST scanner: " << msg;
}
}
@@ -907,11 +913,11 @@ vstfx_get_info (const char* dllpath, enum ARDOUR::PluginType type, enum VSTScanM
argp[2] = 0;
set_error_log(dllpath);
- PBD::SystemExec scanner (scanner_bin_path, argp);
+ ARDOUR::SystemExec scanner (scanner_bin_path, argp);
PBD::ScopedConnectionList cons;
scanner.ReadStdout.connect_same_thread (cons, boost::bind (&parse_scanner_output, _1 ,_2));
if (scanner.start (2 /* send stderr&stdout via signal */)) {
- PBD::error << "Cannot launch VST scanner app '" << scanner_bin_path << "': "<< strerror(errno) << endmsg;
+ errormsg << "Cannot launch VST scanner app '" << scanner_bin_path << "': "<< strerror(errno) << endmsg;
close_error_log();
return infos;
} else {
@@ -977,7 +983,7 @@ vstfx_get_info (const char* dllpath, enum ARDOUR::PluginType type, enum VSTScanM
/* crate cache/whitelist */
infofile = vstfx_infofile_for_write (dllpath);
if (!infofile) {
- PBD::warning << "Cannot cache VST information for " << dllpath << ": cannot create new FST info file." << endmsg;
+ warningmsg << "Cannot cache VST information for " << dllpath << ": cannot create new FST info file." << endmsg;
return infos;
} else {
vstfx_write_info_file (infofile, infos);
@@ -1005,7 +1011,7 @@ get_personal_vst_blacklist_dir() {
/* if the directory doesn't exist, try to create it */
if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
if (g_mkdir (dir.c_str (), 0700)) {
- PBD::error << "Cannot create VST blacklist folder '" << dir << "'" << endmsg;
+ errormsg << "Cannot create VST blacklist folder '" << dir << "'" << endmsg;
//exit(1);
}
}
@@ -1018,7 +1024,7 @@ get_personal_vst_info_cache_dir() {
/* if the directory doesn't exist, try to create it */
if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
if (g_mkdir (dir.c_str (), 0700)) {
- PBD::error << "Cannot create VST info folder '" << dir << "'" << endmsg;
+ errormsg << "Cannot create VST info folder '" << dir << "'" << endmsg;
//exit(1);
}
}