annotate VamPipePluginLibrary.h @ 94:a97aae321809

Introduce ListResponse type as well
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 19 Sep 2016 14:10:19 +0100
parents 6c4b43298968
children 821407e7552f
rev   line source
c@69 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@69 2
c@69 3 /*
c@69 4 VamPipe
c@69 5
c@69 6 Centre for Digital Music, Queen Mary, University of London.
c@69 7 Copyright 2015-2016 QMUL.
c@69 8
c@69 9 Permission is hereby granted, free of charge, to any person
c@69 10 obtaining a copy of this software and associated documentation
c@69 11 files (the "Software"), to deal in the Software without
c@69 12 restriction, including without limitation the rights to use, copy,
c@69 13 modify, merge, publish, distribute, sublicense, and/or sell copies
c@69 14 of the Software, and to permit persons to whom the Software is
c@69 15 furnished to do so, subject to the following conditions:
c@69 16
c@69 17 The above copyright notice and this permission notice shall be
c@69 18 included in all copies or substantial portions of the Software.
c@69 19
c@69 20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
c@69 21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
c@69 22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
c@69 23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
c@69 24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
c@69 25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
c@69 26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
c@69 27
c@69 28 Except as contained in this notice, the names of the Centre for
c@69 29 Digital Music; Queen Mary, University of London; and Chris Cannam
c@69 30 shall not be used in advertising or otherwise to promote the sale,
c@69 31 use or other dealings in this Software without prior written
c@69 32 authorization.
c@69 33 */
c@69 34
c@69 35 #ifndef VAMPIPE_PLUGIN_LIBRARY_H
c@69 36 #define VAMPIPE_PLUGIN_LIBRARY_H
c@69 37
c@69 38 #include "bits/CountingPluginHandleMapper.h"
c@69 39 #include "bits/RequestOrResponse.h"
c@69 40
c@69 41 #include <vamp-hostsdk/PluginStaticData.h>
c@69 42 #include <vamp-hostsdk/RequestResponse.h>
c@69 43
c@69 44 #include <vector>
c@69 45 #include <string>
c@69 46 #include <cstring>
c@69 47
c@69 48 namespace vampipe {
c@69 49
c@88 50 class VamPipeAdapterInterface;
c@69 51
c@69 52 class VamPipePluginLibrary
c@69 53 {
c@69 54 public:
c@88 55 VamPipePluginLibrary(std::vector<VamPipeAdapterInterface *> pp);
c@69 56
c@69 57 const char *requestJson(const char *request) {
c@69 58 return strdup(requestJsonImpl(request).c_str());
c@69 59 }
c@69 60
c@83 61 const char *processRaw(int handle, const float *const *inputBuffers,
c@83 62 int sec, int nsec) {
c@83 63 return strdup(processRawImpl(handle, inputBuffers, sec, nsec).c_str());
c@82 64 }
c@82 65
c@69 66 void freeJson(const char *json) {
c@69 67 free(const_cast<char *>(json));
c@69 68 }
c@69 69
c@69 70 private:
c@69 71 std::string requestJsonImpl(std::string req);
c@83 72 std::string processRawImpl(int, const float *const *, int, int);
c@69 73
c@81 74 RequestOrResponse readRequest(std::string req);
c@69 75 std::string writeResponse(const RequestOrResponse &resp) const;
c@69 76
c@94 77 Vamp::HostExt::ListResponse listPluginData() const;
c@69 78 Vamp::HostExt::LoadResponse loadPlugin(Vamp::HostExt::LoadRequest r) const;
c@69 79 Vamp::HostExt::ConfigurationResponse configurePlugin(Vamp::HostExt::
c@94 80 ConfigurationRequest r)
c@94 81 const;
c@69 82
c@94 83 // map from pluginKey -> adapter
c@94 84 std::map<std::string, VamPipeAdapterInterface *> m_adapters;
c@69 85 CountingPluginHandleMapper m_mapper;
c@81 86 bool m_useBase64;
c@69 87 };
c@69 88
c@69 89 }
c@69 90
c@69 91 #endif