comparison json/VampJson.h @ 68:a5ba837bca28

Update again to latest plugin-terminology-free schema
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 06 Oct 2016 14:32:58 +0100
parents db17657ac875
children 16acd7d24b1a
comparison
equal deleted inserted replaced
67:db17657ac875 68:a5ba837bca28
534 534
535 static json11::Json 535 static json11::Json
536 fromPluginStaticData(const Vamp::HostExt::PluginStaticData &d) { 536 fromPluginStaticData(const Vamp::HostExt::PluginStaticData &d) {
537 537
538 json11::Json::object jo; 538 json11::Json::object jo;
539 jo["pluginKey"] = d.pluginKey; 539 jo["key"] = d.pluginKey;
540 jo["basic"] = fromBasicDescriptor(d.basic); 540 jo["basic"] = fromBasicDescriptor(d.basic);
541 jo["maker"] = d.maker; 541 jo["maker"] = d.maker;
542 jo["copyright"] = d.copyright; 542 jo["copyright"] = d.copyright;
543 jo["pluginVersion"] = d.pluginVersion; 543 jo["version"] = d.pluginVersion;
544 544
545 json11::Json::array cat; 545 json11::Json::array cat;
546 for (const std::string &c: d.category) cat.push_back(c); 546 for (const std::string &c: d.category) cat.push_back(c);
547 jo["category"] = cat; 547 jo["category"] = cat;
548 548
571 571
572 static Vamp::HostExt::PluginStaticData 572 static Vamp::HostExt::PluginStaticData
573 toPluginStaticData(json11::Json j, std::string &err) { 573 toPluginStaticData(json11::Json j, std::string &err) {
574 574
575 if (!j.has_shape({ 575 if (!j.has_shape({
576 { "pluginKey", json11::Json::STRING }, 576 { "key", json11::Json::STRING },
577 { "pluginVersion", json11::Json::NUMBER }, 577 { "version", json11::Json::NUMBER },
578 { "minChannelCount", json11::Json::NUMBER }, 578 { "minChannelCount", json11::Json::NUMBER },
579 { "maxChannelCount", json11::Json::NUMBER }, 579 { "maxChannelCount", json11::Json::NUMBER },
580 { "inputDomain", json11::Json::STRING }}, err)) { 580 { "inputDomain", json11::Json::STRING }}, err)) {
581 581
582 err = "malformed plugin static data: " + err; 582 err = "malformed plugin static data: " + err;
621 621
622 } else { 622 } else {
623 623
624 Vamp::HostExt::PluginStaticData psd; 624 Vamp::HostExt::PluginStaticData psd;
625 625
626 psd.pluginKey = j["pluginKey"].string_value(); 626 psd.pluginKey = j["key"].string_value();
627 627
628 toBasicDescriptor(j["basic"], psd.basic, err); 628 toBasicDescriptor(j["basic"], psd.basic, err);
629 if (failed(err)) return {}; 629 if (failed(err)) return {};
630 630
631 psd.maker = j["maker"].string_value(); 631 psd.maker = j["maker"].string_value();
632 psd.copyright = j["copyright"].string_value(); 632 psd.copyright = j["copyright"].string_value();
633 psd.pluginVersion = j["pluginVersion"].int_value(); 633 psd.pluginVersion = j["version"].int_value();
634 634
635 for (const auto &c : j["category"].array_items()) { 635 for (const auto &c : j["category"].array_items()) {
636 if (!c.is_string()) { 636 if (!c.is_string()) {
637 err = "strings expected in category array"; 637 err = "strings expected in category array";
638 return {}; 638 return {};
800 800
801 static json11::Json 801 static json11::Json
802 fromLoadRequest(const Vamp::HostExt::LoadRequest &req) { 802 fromLoadRequest(const Vamp::HostExt::LoadRequest &req) {
803 803
804 json11::Json::object jo; 804 json11::Json::object jo;
805 jo["pluginKey"] = req.pluginKey; 805 jo["key"] = req.pluginKey;
806 jo["inputSampleRate"] = req.inputSampleRate; 806 jo["inputSampleRate"] = req.inputSampleRate;
807 jo["adapterFlags"] = fromAdapterFlags(req.adapterFlags); 807 jo["adapterFlags"] = fromAdapterFlags(req.adapterFlags);
808 return json11::Json(jo); 808 return json11::Json(jo);
809 } 809 }
810 810
811 static Vamp::HostExt::LoadRequest 811 static Vamp::HostExt::LoadRequest
812 toLoadRequest(json11::Json j, std::string &err) { 812 toLoadRequest(json11::Json j, std::string &err) {
813 813
814 if (!j.has_shape({ 814 if (!j.has_shape({
815 { "pluginKey", json11::Json::STRING }, 815 { "key", json11::Json::STRING },
816 { "inputSampleRate", json11::Json::NUMBER } }, err)) { 816 { "inputSampleRate", json11::Json::NUMBER } }, err)) {
817 err = "malformed load request: " + err; 817 err = "malformed load request: " + err;
818 return {}; 818 return {};
819 } 819 }
820 820
821 Vamp::HostExt::LoadRequest req; 821 Vamp::HostExt::LoadRequest req;
822 req.pluginKey = j["pluginKey"].string_value(); 822 req.pluginKey = j["key"].string_value();
823 req.inputSampleRate = j["inputSampleRate"].number_value(); 823 req.inputSampleRate = j["inputSampleRate"].number_value();
824 if (!j["adapterFlags"].is_null()) { 824 if (!j["adapterFlags"].is_null()) {
825 req.adapterFlags = toAdapterFlags(j["adapterFlags"], err); 825 req.adapterFlags = toAdapterFlags(j["adapterFlags"], err);
826 if (failed(err)) return {}; 826 if (failed(err)) return {};
827 } 827 }
831 static json11::Json 831 static json11::Json
832 fromLoadResponse(const Vamp::HostExt::LoadResponse &resp, 832 fromLoadResponse(const Vamp::HostExt::LoadResponse &resp,
833 const PluginHandleMapper &pmapper) { 833 const PluginHandleMapper &pmapper) {
834 834
835 json11::Json::object jo; 835 json11::Json::object jo;
836 jo["pluginHandle"] = double(pmapper.pluginToHandle(resp.plugin)); 836 jo["handle"] = double(pmapper.pluginToHandle(resp.plugin));
837 jo["staticData"] = fromPluginStaticData(resp.staticData); 837 jo["staticData"] = fromPluginStaticData(resp.staticData);
838 jo["defaultConfiguration"] = 838 jo["defaultConfiguration"] =
839 fromPluginConfiguration(resp.defaultConfiguration); 839 fromPluginConfiguration(resp.defaultConfiguration);
840 return json11::Json(jo); 840 return json11::Json(jo);
841 } 841 }
843 static Vamp::HostExt::LoadResponse 843 static Vamp::HostExt::LoadResponse
844 toLoadResponse(json11::Json j, 844 toLoadResponse(json11::Json j,
845 const PluginHandleMapper &pmapper, std::string &err) { 845 const PluginHandleMapper &pmapper, std::string &err) {
846 846
847 if (!j.has_shape({ 847 if (!j.has_shape({
848 { "pluginHandle", json11::Json::NUMBER }, 848 { "handle", json11::Json::NUMBER },
849 { "staticData", json11::Json::OBJECT }, 849 { "staticData", json11::Json::OBJECT },
850 { "defaultConfiguration", json11::Json::OBJECT } }, err)) { 850 { "defaultConfiguration", json11::Json::OBJECT } }, err)) {
851 err = "malformed load response: " + err; 851 err = "malformed load response: " + err;
852 return {}; 852 return {};
853 } 853 }
854 854
855 Vamp::HostExt::LoadResponse resp; 855 Vamp::HostExt::LoadResponse resp;
856 resp.plugin = pmapper.handleToPlugin(j["pluginHandle"].int_value()); 856 resp.plugin = pmapper.handleToPlugin(j["handle"].int_value());
857 resp.staticData = toPluginStaticData(j["staticData"], err); 857 resp.staticData = toPluginStaticData(j["staticData"], err);
858 if (failed(err)) return {}; 858 if (failed(err)) return {};
859 resp.defaultConfiguration = toPluginConfiguration(j["defaultConfiguration"], 859 resp.defaultConfiguration = toPluginConfiguration(j["defaultConfiguration"],
860 err); 860 err);
861 if (failed(err)) return {}; 861 if (failed(err)) return {};
866 fromConfigurationRequest(const Vamp::HostExt::ConfigurationRequest &cr, 866 fromConfigurationRequest(const Vamp::HostExt::ConfigurationRequest &cr,
867 const PluginHandleMapper &pmapper) { 867 const PluginHandleMapper &pmapper) {
868 868
869 json11::Json::object jo; 869 json11::Json::object jo;
870 870
871 jo["pluginHandle"] = pmapper.pluginToHandle(cr.plugin); 871 jo["handle"] = pmapper.pluginToHandle(cr.plugin);
872 jo["configuration"] = fromPluginConfiguration(cr.configuration); 872 jo["configuration"] = fromPluginConfiguration(cr.configuration);
873 873
874 return json11::Json(jo); 874 return json11::Json(jo);
875 } 875 }
876 876
877 static Vamp::HostExt::ConfigurationRequest 877 static Vamp::HostExt::ConfigurationRequest
878 toConfigurationRequest(json11::Json j, 878 toConfigurationRequest(json11::Json j,
879 const PluginHandleMapper &pmapper, std::string &err) { 879 const PluginHandleMapper &pmapper, std::string &err) {
880 880
881 if (!j.has_shape({ 881 if (!j.has_shape({
882 { "pluginHandle", json11::Json::NUMBER }, 882 { "handle", json11::Json::NUMBER },
883 { "configuration", json11::Json::OBJECT } }, err)) { 883 { "configuration", json11::Json::OBJECT } }, err)) {
884 err = "malformed configuration request: " + err; 884 err = "malformed configuration request: " + err;
885 return {}; 885 return {};
886 } 886 }
887 887
888 Vamp::HostExt::ConfigurationRequest cr; 888 Vamp::HostExt::ConfigurationRequest cr;
889 cr.plugin = pmapper.handleToPlugin(j["pluginHandle"].int_value()); 889 cr.plugin = pmapper.handleToPlugin(j["handle"].int_value());
890 cr.configuration = toPluginConfiguration(j["configuration"], err); 890 cr.configuration = toPluginConfiguration(j["configuration"], err);
891 if (failed(err)) return {}; 891 if (failed(err)) return {};
892 return cr; 892 return cr;
893 } 893 }
894 894
896 fromConfigurationResponse(const Vamp::HostExt::ConfigurationResponse &cr, 896 fromConfigurationResponse(const Vamp::HostExt::ConfigurationResponse &cr,
897 const PluginHandleMapper &pmapper) { 897 const PluginHandleMapper &pmapper) {
898 898
899 json11::Json::object jo; 899 json11::Json::object jo;
900 900
901 jo["pluginHandle"] = pmapper.pluginToHandle(cr.plugin); 901 jo["handle"] = pmapper.pluginToHandle(cr.plugin);
902 902
903 json11::Json::array outs; 903 json11::Json::array outs;
904 for (auto &d: cr.outputs) { 904 for (auto &d: cr.outputs) {
905 outs.push_back(fromOutputDescriptor(d)); 905 outs.push_back(fromOutputDescriptor(d));
906 } 906 }
913 toConfigurationResponse(json11::Json j, 913 toConfigurationResponse(json11::Json j,
914 const PluginHandleMapper &pmapper, std::string &err) { 914 const PluginHandleMapper &pmapper, std::string &err) {
915 915
916 Vamp::HostExt::ConfigurationResponse cr; 916 Vamp::HostExt::ConfigurationResponse cr;
917 917
918 cr.plugin = pmapper.handleToPlugin(j["pluginHandle"].int_value()); 918 cr.plugin = pmapper.handleToPlugin(j["handle"].int_value());
919 919
920 if (!j["outputList"].is_array()) { 920 if (!j["outputList"].is_array()) {
921 err = "array expected for output list"; 921 err = "array expected for output list";
922 return {}; 922 return {};
923 } 923 }
934 fromProcessRequest(const Vamp::HostExt::ProcessRequest &r, 934 fromProcessRequest(const Vamp::HostExt::ProcessRequest &r,
935 const PluginHandleMapper &pmapper, 935 const PluginHandleMapper &pmapper,
936 BufferSerialisation serialisation) { 936 BufferSerialisation serialisation) {
937 937
938 json11::Json::object jo; 938 json11::Json::object jo;
939 jo["pluginHandle"] = pmapper.pluginToHandle(r.plugin); 939 jo["handle"] = pmapper.pluginToHandle(r.plugin);
940 940
941 json11::Json::object io; 941 json11::Json::object io;
942 io["timestamp"] = fromRealTime(r.timestamp); 942 io["timestamp"] = fromRealTime(r.timestamp);
943 943
944 json11::Json::array chans; 944 json11::Json::array chans;
961 toProcessRequest(json11::Json j, 961 toProcessRequest(json11::Json j,
962 const PluginHandleMapper &pmapper, 962 const PluginHandleMapper &pmapper,
963 BufferSerialisation &serialisation, std::string &err) { 963 BufferSerialisation &serialisation, std::string &err) {
964 964
965 if (!j.has_shape({ 965 if (!j.has_shape({
966 { "pluginHandle", json11::Json::NUMBER }, 966 { "handle", json11::Json::NUMBER },
967 { "processInput", json11::Json::OBJECT } }, err)) { 967 { "processInput", json11::Json::OBJECT } }, err)) {
968 err = "malformed process request: " + err; 968 err = "malformed process request: " + err;
969 return {}; 969 return {};
970 } 970 }
971 971
977 err = "malformed process request: " + err; 977 err = "malformed process request: " + err;
978 return {}; 978 return {};
979 } 979 }
980 980
981 Vamp::HostExt::ProcessRequest r; 981 Vamp::HostExt::ProcessRequest r;
982 r.plugin = pmapper.handleToPlugin(j["pluginHandle"].int_value()); 982 r.plugin = pmapper.handleToPlugin(j["handle"].int_value());
983 983
984 r.timestamp = toRealTime(input["timestamp"], err); 984 r.timestamp = toRealTime(input["timestamp"], err);
985 if (failed(err)) return {}; 985 if (failed(err)) return {};
986 986
987 for (const auto &a: input["inputBuffers"].array_items()) { 987 for (const auto &a: input["inputBuffers"].array_items()) {
1039 } 1039 }
1040 1040
1041 public: 1041 public:
1042 1042
1043 static json11::Json 1043 static json11::Json
1044 fromVampRequest_List() { 1044 fromRpcRequest_List() {
1045 1045
1046 json11::Json::object jo; 1046 json11::Json::object jo;
1047 markRPC(jo); 1047 markRPC(jo);
1048 1048
1049 jo["method"] = "list"; 1049 jo["method"] = "list";
1050 return json11::Json(jo); 1050 return json11::Json(jo);
1051 } 1051 }
1052 1052
1053 static json11::Json 1053 static json11::Json
1054 fromVampResponse_List(const Vamp::HostExt::ListResponse &resp) { 1054 fromRpcResponse_List(const Vamp::HostExt::ListResponse &resp) {
1055 1055
1056 json11::Json::object jo; 1056 json11::Json::object jo;
1057 markRPC(jo); 1057 markRPC(jo);
1058 1058
1059 json11::Json::array arr; 1059 json11::Json::array arr;
1060 for (const auto &a: resp.plugins) { 1060 for (const auto &a: resp.plugins) {
1061 arr.push_back(fromPluginStaticData(a)); 1061 arr.push_back(fromPluginStaticData(a));
1062 } 1062 }
1063 json11::Json::object po; 1063 json11::Json::object po;
1064 po["plugins"] = arr; 1064 po["available"] = arr;
1065 1065
1066 jo["method"] = "list"; 1066 jo["method"] = "list";
1067 jo["result"] = po; 1067 jo["result"] = po;
1068 return json11::Json(jo); 1068 return json11::Json(jo);
1069 } 1069 }
1070 1070
1071 static json11::Json 1071 static json11::Json
1072 fromVampRequest_Load(const Vamp::HostExt::LoadRequest &req) { 1072 fromRpcRequest_Load(const Vamp::HostExt::LoadRequest &req) {
1073 1073
1074 json11::Json::object jo; 1074 json11::Json::object jo;
1075 markRPC(jo); 1075 markRPC(jo);
1076 1076
1077 jo["method"] = "load"; 1077 jo["method"] = "load";
1078 jo["params"] = fromLoadRequest(req); 1078 jo["params"] = fromLoadRequest(req);
1079 return json11::Json(jo); 1079 return json11::Json(jo);
1080 } 1080 }
1081 1081
1082 static json11::Json 1082 static json11::Json
1083 fromVampResponse_Load(const Vamp::HostExt::LoadResponse &resp, 1083 fromRpcResponse_Load(const Vamp::HostExt::LoadResponse &resp,
1084 const PluginHandleMapper &pmapper) { 1084 const PluginHandleMapper &pmapper) {
1085 1085
1086 if (resp.plugin) { 1086 if (resp.plugin) {
1087 1087
1088 json11::Json::object jo; 1088 json11::Json::object jo;
1096 return fromError("Failed to load plugin", RRType::Load); 1096 return fromError("Failed to load plugin", RRType::Load);
1097 } 1097 }
1098 } 1098 }
1099 1099
1100 static json11::Json 1100 static json11::Json
1101 fromVampRequest_Configure(const Vamp::HostExt::ConfigurationRequest &req, 1101 fromRpcRequest_Configure(const Vamp::HostExt::ConfigurationRequest &req,
1102 const PluginHandleMapper &pmapper) { 1102 const PluginHandleMapper &pmapper) {
1103 1103
1104 json11::Json::object jo; 1104 json11::Json::object jo;
1105 markRPC(jo); 1105 markRPC(jo);
1106 1106
1108 jo["params"] = fromConfigurationRequest(req, pmapper); 1108 jo["params"] = fromConfigurationRequest(req, pmapper);
1109 return json11::Json(jo); 1109 return json11::Json(jo);
1110 } 1110 }
1111 1111
1112 static json11::Json 1112 static json11::Json
1113 fromVampResponse_Configure(const Vamp::HostExt::ConfigurationResponse &resp, 1113 fromRpcResponse_Configure(const Vamp::HostExt::ConfigurationResponse &resp,
1114 const PluginHandleMapper &pmapper) { 1114 const PluginHandleMapper &pmapper) {
1115 1115
1116 if (!resp.outputs.empty()) { 1116 if (!resp.outputs.empty()) {
1117 1117
1118 json11::Json::object jo; 1118 json11::Json::object jo;
1126 return fromError("Failed to configure plugin", RRType::Configure); 1126 return fromError("Failed to configure plugin", RRType::Configure);
1127 } 1127 }
1128 } 1128 }
1129 1129
1130 static json11::Json 1130 static json11::Json
1131 fromVampRequest_Process(const Vamp::HostExt::ProcessRequest &req, 1131 fromRpcRequest_Process(const Vamp::HostExt::ProcessRequest &req,
1132 const PluginHandleMapper &pmapper, 1132 const PluginHandleMapper &pmapper,
1133 BufferSerialisation serialisation) { 1133 BufferSerialisation serialisation) {
1134 1134
1135 json11::Json::object jo; 1135 json11::Json::object jo;
1136 markRPC(jo); 1136 markRPC(jo);
1139 jo["params"] = fromProcessRequest(req, pmapper, serialisation); 1139 jo["params"] = fromProcessRequest(req, pmapper, serialisation);
1140 return json11::Json(jo); 1140 return json11::Json(jo);
1141 } 1141 }
1142 1142
1143 static json11::Json 1143 static json11::Json
1144 fromVampResponse_Process(const Vamp::HostExt::ProcessResponse &resp, 1144 fromRpcResponse_Process(const Vamp::HostExt::ProcessResponse &resp,
1145 const PluginHandleMapper &pmapper, 1145 const PluginHandleMapper &pmapper,
1146 BufferSerialisation serialisation) { 1146 BufferSerialisation serialisation) {
1147 1147
1148 json11::Json::object jo; 1148 json11::Json::object jo;
1149 markRPC(jo); 1149 markRPC(jo);
1150 1150
1151 json11::Json::object po; 1151 json11::Json::object po;
1152 po["pluginHandle"] = pmapper.pluginToHandle(resp.plugin); 1152 po["handle"] = pmapper.pluginToHandle(resp.plugin);
1153 po["features"] = fromFeatureSet(resp.features, 1153 po["features"] = fromFeatureSet(resp.features,
1154 *pmapper.pluginToOutputIdMapper(resp.plugin), 1154 *pmapper.pluginToOutputIdMapper(resp.plugin),
1155 serialisation); 1155 serialisation);
1156 jo["method"] = "process"; 1156 jo["method"] = "process";
1157 jo["result"] = po; 1157 jo["result"] = po;
1158 return json11::Json(jo); 1158 return json11::Json(jo);
1159 } 1159 }
1160 1160
1161 static json11::Json 1161 static json11::Json
1162 fromVampRequest_Finish(const Vamp::HostExt::FinishRequest &req, 1162 fromRpcRequest_Finish(const Vamp::HostExt::FinishRequest &req,
1163 const PluginHandleMapper &pmapper) { 1163 const PluginHandleMapper &pmapper) {
1164 1164
1165 json11::Json::object jo; 1165 json11::Json::object jo;
1166 markRPC(jo); 1166 markRPC(jo);
1167 1167
1168 json11::Json::object fo; 1168 json11::Json::object fo;
1169 fo["pluginHandle"] = pmapper.pluginToHandle(req.plugin); 1169 fo["handle"] = pmapper.pluginToHandle(req.plugin);
1170 1170
1171 jo["method"] = "finish"; 1171 jo["method"] = "finish";
1172 jo["params"] = fo; 1172 jo["params"] = fo;
1173 return json11::Json(jo); 1173 return json11::Json(jo);
1174 } 1174 }
1175 1175
1176 static json11::Json 1176 static json11::Json
1177 fromVampResponse_Finish(const Vamp::HostExt::ProcessResponse &resp, 1177 fromRpcResponse_Finish(const Vamp::HostExt::ProcessResponse &resp,
1178 const PluginHandleMapper &pmapper, 1178 const PluginHandleMapper &pmapper,
1179 BufferSerialisation serialisation) { 1179 BufferSerialisation serialisation) {
1180 1180
1181 json11::Json::object jo; 1181 json11::Json::object jo;
1182 markRPC(jo); 1182 markRPC(jo);
1183 1183
1184 json11::Json::object po; 1184 json11::Json::object po;
1185 po["pluginHandle"] = pmapper.pluginToHandle(resp.plugin); 1185 po["handle"] = pmapper.pluginToHandle(resp.plugin);
1186 po["features"] = fromFeatureSet(resp.features, 1186 po["features"] = fromFeatureSet(resp.features,
1187 *pmapper.pluginToOutputIdMapper(resp.plugin), 1187 *pmapper.pluginToOutputIdMapper(resp.plugin),
1188 serialisation); 1188 serialisation);
1189 jo["method"] = "finish"; 1189 jo["method"] = "finish";
1190 jo["result"] = po; 1190 jo["result"] = po;
1238 return RRType::NotValid; 1238 return RRType::NotValid;
1239 } 1239 }
1240 } 1240 }
1241 1241
1242 static void 1242 static void
1243 toVampRequest_List(json11::Json j, std::string &err) { 1243 toRpcRequest_List(json11::Json j, std::string &err) {
1244 checkTypeField(j, "list", err); 1244 checkTypeField(j, "list", err);
1245 } 1245 }
1246 1246
1247 static Vamp::HostExt::ListResponse 1247 static Vamp::HostExt::ListResponse
1248 toVampResponse_List(json11::Json j, std::string &err) { 1248 toRpcResponse_List(json11::Json j, std::string &err) {
1249 1249
1250 Vamp::HostExt::ListResponse resp; 1250 Vamp::HostExt::ListResponse resp;
1251 if (successful(j, err) && !failed(err)) { 1251 if (successful(j, err) && !failed(err)) {
1252 for (const auto &a: j["result"]["plugins"].array_items()) { 1252 for (const auto &a: j["result"]["available"].array_items()) {
1253 resp.plugins.push_back(toPluginStaticData(a, err)); 1253 resp.plugins.push_back(toPluginStaticData(a, err));
1254 if (failed(err)) return {}; 1254 if (failed(err)) return {};
1255 } 1255 }
1256 } 1256 }
1257 1257
1258 return resp; 1258 return resp;
1259 } 1259 }
1260 1260
1261 static Vamp::HostExt::LoadRequest 1261 static Vamp::HostExt::LoadRequest
1262 toVampRequest_Load(json11::Json j, std::string &err) { 1262 toRpcRequest_Load(json11::Json j, std::string &err) {
1263 1263
1264 checkTypeField(j, "load", err); 1264 checkTypeField(j, "load", err);
1265 if (failed(err)) return {}; 1265 if (failed(err)) return {};
1266 return toLoadRequest(j["params"], err); 1266 return toLoadRequest(j["params"], err);
1267 } 1267 }
1268 1268
1269 static Vamp::HostExt::LoadResponse 1269 static Vamp::HostExt::LoadResponse
1270 toVampResponse_Load(json11::Json j, 1270 toRpcResponse_Load(json11::Json j,
1271 const PluginHandleMapper &pmapper, 1271 const PluginHandleMapper &pmapper,
1272 std::string &err) { 1272 std::string &err) {
1273 1273
1274 Vamp::HostExt::LoadResponse resp; 1274 Vamp::HostExt::LoadResponse resp;
1275 if (successful(j, err) && !failed(err)) { 1275 if (successful(j, err) && !failed(err)) {
1277 } 1277 }
1278 return resp; 1278 return resp;
1279 } 1279 }
1280 1280
1281 static Vamp::HostExt::ConfigurationRequest 1281 static Vamp::HostExt::ConfigurationRequest
1282 toVampRequest_Configure(json11::Json j, 1282 toRpcRequest_Configure(json11::Json j,
1283 const PluginHandleMapper &pmapper, 1283 const PluginHandleMapper &pmapper,
1284 std::string &err) { 1284 std::string &err) {
1285 1285
1286 checkTypeField(j, "configure", err); 1286 checkTypeField(j, "configure", err);
1287 if (failed(err)) return {}; 1287 if (failed(err)) return {};
1288 return toConfigurationRequest(j["params"], pmapper, err); 1288 return toConfigurationRequest(j["params"], pmapper, err);
1289 } 1289 }
1290 1290
1291 static Vamp::HostExt::ConfigurationResponse 1291 static Vamp::HostExt::ConfigurationResponse
1292 toVampResponse_Configure(json11::Json j, 1292 toRpcResponse_Configure(json11::Json j,
1293 const PluginHandleMapper &pmapper, 1293 const PluginHandleMapper &pmapper,
1294 std::string &err) { 1294 std::string &err) {
1295 1295
1296 Vamp::HostExt::ConfigurationResponse resp; 1296 Vamp::HostExt::ConfigurationResponse resp;
1297 if (successful(j, err) && !failed(err)) { 1297 if (successful(j, err) && !failed(err)) {
1299 } 1299 }
1300 return resp; 1300 return resp;
1301 } 1301 }
1302 1302
1303 static Vamp::HostExt::ProcessRequest 1303 static Vamp::HostExt::ProcessRequest
1304 toVampRequest_Process(json11::Json j, const PluginHandleMapper &pmapper, 1304 toRpcRequest_Process(json11::Json j, const PluginHandleMapper &pmapper,
1305 BufferSerialisation &serialisation, std::string &err) { 1305 BufferSerialisation &serialisation, std::string &err) {
1306 1306
1307 checkTypeField(j, "process", err); 1307 checkTypeField(j, "process", err);
1308 if (failed(err)) return {}; 1308 if (failed(err)) return {};
1309 return toProcessRequest(j["params"], pmapper, serialisation, err); 1309 return toProcessRequest(j["params"], pmapper, serialisation, err);
1310 } 1310 }
1311 1311
1312 static Vamp::HostExt::ProcessResponse 1312 static Vamp::HostExt::ProcessResponse
1313 toVampResponse_Process(json11::Json j, 1313 toRpcResponse_Process(json11::Json j,
1314 const PluginHandleMapper &pmapper, 1314 const PluginHandleMapper &pmapper,
1315 BufferSerialisation &serialisation, std::string &err) { 1315 BufferSerialisation &serialisation, std::string &err) {
1316 1316
1317 Vamp::HostExt::ProcessResponse resp; 1317 Vamp::HostExt::ProcessResponse resp;
1318 if (successful(j, err) && !failed(err)) { 1318 if (successful(j, err) && !failed(err)) {
1319 auto jc = j["result"]; 1319 auto jc = j["result"];
1320 auto h = jc["pluginHandle"].int_value(); 1320 auto h = jc["handle"].int_value();
1321 resp.plugin = pmapper.handleToPlugin(h); 1321 resp.plugin = pmapper.handleToPlugin(h);
1322 resp.features = toFeatureSet(jc["features"], 1322 resp.features = toFeatureSet(jc["features"],
1323 *pmapper.handleToOutputIdMapper(h), 1323 *pmapper.handleToOutputIdMapper(h),
1324 serialisation, err); 1324 serialisation, err);
1325 } 1325 }
1326 return resp; 1326 return resp;
1327 } 1327 }
1328 1328
1329 static Vamp::HostExt::FinishRequest 1329 static Vamp::HostExt::FinishRequest
1330 toVampRequest_Finish(json11::Json j, const PluginHandleMapper &pmapper, 1330 toRpcRequest_Finish(json11::Json j, const PluginHandleMapper &pmapper,
1331 std::string &err) { 1331 std::string &err) {
1332 1332
1333 checkTypeField(j, "finish", err); 1333 checkTypeField(j, "finish", err);
1334 if (failed(err)) return {}; 1334 if (failed(err)) return {};
1335 Vamp::HostExt::FinishRequest req; 1335 Vamp::HostExt::FinishRequest req;
1336 req.plugin = pmapper.handleToPlugin 1336 req.plugin = pmapper.handleToPlugin
1337 (j["params"]["pluginHandle"].int_value()); 1337 (j["params"]["handle"].int_value());
1338 return req; 1338 return req;
1339 } 1339 }
1340 1340
1341 static Vamp::HostExt::ProcessResponse 1341 static Vamp::HostExt::ProcessResponse
1342 toVampResponse_Finish(json11::Json j, 1342 toRpcResponse_Finish(json11::Json j,
1343 const PluginHandleMapper &pmapper, 1343 const PluginHandleMapper &pmapper,
1344 BufferSerialisation &serialisation, std::string &err) { 1344 BufferSerialisation &serialisation, std::string &err) {
1345 1345
1346 Vamp::HostExt::ProcessResponse resp; 1346 Vamp::HostExt::ProcessResponse resp;
1347 if (successful(j, err) && !failed(err)) { 1347 if (successful(j, err) && !failed(err)) {
1348 auto jc = j["result"]; 1348 auto jc = j["result"];
1349 auto h = jc["pluginHandle"].int_value(); 1349 auto h = jc["handle"].int_value();
1350 resp.plugin = pmapper.handleToPlugin(h); 1350 resp.plugin = pmapper.handleToPlugin(h);
1351 resp.features = toFeatureSet(jc["features"], 1351 resp.features = toFeatureSet(jc["features"],
1352 *pmapper.handleToOutputIdMapper(h), 1352 *pmapper.handleToOutputIdMapper(h),
1353 serialisation, err); 1353 serialisation, err);
1354 } 1354 }