changeset 66:85768d48e6ce

Add get-version utility
author Chris Cannam
date Wed, 12 Feb 2020 14:41:09 +0000
parents bf0fc15c3e21
children 38cd115c91d4
files .hgignore get-version.cpp get-version.pro installer.cpp vamp-plugin-pack.pro
diffstat 5 files changed, 175 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue Feb 11 10:45:54 2020 +0000
+++ b/.hgignore	Wed Feb 12 14:41:09 2020 +0000
@@ -48,3 +48,4 @@
 installer.qrc
 Dockerfile.gen
 plugins.zip
+get-version
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/get-version.cpp	Wed Feb 12 14:41:09 2020 +0000
@@ -0,0 +1,106 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
+/*
+    Copyright (c) 2020 Queen Mary, University of London
+
+    Permission is hereby granted, free of charge, to any person
+    obtaining a copy of this software and associated documentation
+    files (the "Software"), to deal in the Software without
+    restriction, including without limitation the rights to use, copy,
+    modify, merge, publish, distribute, sublicense, and/or sell copies
+    of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice shall be
+    included in all copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+    CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+    Except as contained in this notice, the names of the Centre for
+    Digital Music and Queen Mary, University of London shall not be
+    used in advertising or otherwise to promote the sale, use or other
+    dealings in this Software without prior written authorization.
+*/
+
+#include <vamp-hostsdk/PluginHostAdapter.h>
+
+// Undocumented internal API
+#include <vamp-hostsdk/../src/vamp-hostsdk/Files.h>
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+void usage(const char *me)
+{
+    cerr << endl;
+    cerr << "Usage: " << me << " <soname>" << endl;
+    cerr << endl;
+    cerr << "Loads the Vamp plugin library found in <soname> and lists\n"
+         << "the plugin versions found therein. Plugins are listed one per\n"
+         << "line, with the plugin id and version number separated by a colon."
+         << endl;
+    cerr << endl;
+    cerr << "Note that <soname> must be the path to a plugin library, not\n"
+         << "merely the name of the library. That is, no search path is used.\n"
+         << "The file path should be UTF-8 encoded (on all platforms)."
+         << endl;
+    cerr << endl;
+    cerr << "The return code is 0 if the plugin library was successfully\n"
+         << "loaded, otherwise 1. An error message may be printed to stderr\n"
+         << "in the latter case." << endl;
+    cerr << endl;
+    exit(2);
+}
+
+int main(int argc, char **argv)
+{
+    char *scooter = argv[0];
+    char *name = 0;
+    while (scooter && *scooter) {
+        if (*scooter == '/' || *scooter == '\\') name = ++scooter;
+        else ++scooter;
+    }
+    if (!name || !*name) name = argv[0];
+    
+    if (argc != 2) usage(name);
+    if (string(argv[1]) == string("-?")) usage(name);
+
+    string libraryPath(argv[1]);
+    
+    void *handle = Files::loadLibrary(libraryPath);
+    if (!handle) {
+        cerr << "Unable to load library " << libraryPath << endl;
+        return 1;
+    }
+
+    VampGetPluginDescriptorFunction fn =
+        (VampGetPluginDescriptorFunction)Files::lookupInLibrary
+        (handle, "vampGetPluginDescriptor");
+
+    if (!fn) {
+        cerr << "No vampGetPluginDescriptor function found in library \""
+             << libraryPath << "\"" << endl;
+        Files::unloadLibrary(handle);
+        return 1;
+    }
+
+    int index = 0;
+    const VampPluginDescriptor *descriptor = 0;
+
+    while ((descriptor = fn(VAMP_API_VERSION, index))) {
+        cout << descriptor->identifier << ":"
+             << descriptor->pluginVersion << endl;
+        ++index;
+    }
+
+    Files::unloadLibrary(handle);
+    
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/get-version.pro	Wed Feb 12 14:41:09 2020 +0000
@@ -0,0 +1,38 @@
+
+TEMPLATE = app
+
+exists(config.pri) {
+    include(config.pri)
+}
+
+!exists(config.pri) {
+    include(noconfig.pri)
+}
+
+CONFIG += release warn_on c++14
+
+QT += gui widgets svg
+
+TARGET=get-version
+
+OBJECTS_DIR = o
+MOC_DIR = o
+RCC_DIR = o
+
+SOURCES += \
+        get-version.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/Files.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/host-c.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/PluginBufferingAdapter.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/PluginChannelAdapter.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/PluginHostAdapter.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/PluginInputDomainAdapter.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/PluginLoader.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/PluginSummarisingAdapter.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/PluginWrapper.cpp \
+        vamp-plugin-sdk/src/vamp-hostsdk/RealTime.cpp
+
+linux* {
+    LIBS += -ldl
+}
+
--- a/installer.cpp	Tue Feb 11 10:45:54 2020 +0000
+++ b/installer.cpp	Wed Feb 12 14:41:09 2020 +0000
@@ -1,3 +1,31 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
+/*
+    Copyright (c) 2020 Queen Mary, University of London
+
+    Permission is hereby granted, free of charge, to any person
+    obtaining a copy of this software and associated documentation
+    files (the "Software"), to deal in the Software without
+    restriction, including without limitation the rights to use, copy,
+    modify, merge, publish, distribute, sublicense, and/or sell copies
+    of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice shall be
+    included in all copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+    CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+    Except as contained in this notice, the names of the Centre for
+    Digital Music and Queen Mary, University of London shall not be
+    used in advertising or otherwise to promote the sale, use or other
+    dealings in this Software without prior written authorization.
+*/
 
 #include <QApplication>
 #include <QString>
--- a/vamp-plugin-pack.pro	Tue Feb 11 10:45:54 2020 +0000
+++ b/vamp-plugin-pack.pro	Wed Feb 12 14:41:09 2020 +0000
@@ -3,9 +3,11 @@
 
 SUBDIRS += \
         sub_plugins \
+        sub_get_version \
         sub_installer
 
 sub_plugins.file = plugins.pro
+sub_get_version.file = get-version.pro
 sub_installer.file = installer.pro
 
 repoint.target = $$PWD/.repoint.point