diff utilities/json-cli.cpp @ 12:828930f9a65d

Configuration request/response structs
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 17 May 2016 13:52:51 +0100
parents aa61cb5c5754
children 913fc1d3710a
line wrap: on
line diff
--- a/utilities/json-cli.cpp	Tue May 17 11:15:25 2016 +0100
+++ b/utilities/json-cli.cpp	Tue May 17 13:52:51 2016 +0100
@@ -73,7 +73,7 @@
     return response;
 }
     
-Vamp::Plugin::OutputList
+Vamp::HostExt::ConfigurationResponse
 configurePlugin(Vamp::Plugin *plugin, json11::Json j) {
     
     auto config = VampJson::toPluginConfiguration(j);
@@ -83,8 +83,10 @@
     if (outputs.empty()) {
 	throw VampJson::Failure("plugin initialisation failed (invalid channelCount, stepSize, blockSize?)");
     }
-    
-    return outputs;
+
+    Vamp::HostExt::ConfigurationResponse response;
+    response.outputs = outputs;
+    return response;
 }
 
 Json
@@ -139,21 +141,13 @@
     
     Json config = j["configuration"];
 
-    configurePlugin(plugin, config);
+    auto response = configurePlugin(plugin, config);
 
     mapper.markInitialised(handle);
 
     cerr << "Configured and initialised plugin " << handle << endl;
 
-    //!!! to VampJson:
-    Json::object jout;
-    Json::array outs;
-    Vamp::Plugin::OutputList vouts = plugin->getOutputDescriptors();
-    for (auto &o: vouts) {
-	outs.push_back(VampJson::fromOutputDescriptor(o));
-    }
-    jout["outputList"] = outs;
-    return Json(jout);
+    return VampJson::fromConfigurationResponse(response);
 }
 
 Json