Mercurial > hg > piper-cpp
comparison utilities/json-to-capnp.cpp @ 44:a98ef4c2616b
Make base64/text selectable when serialising process and feature blocks; add base64 version as an output format for vampipe-convert; make VamPipePluginLibrary switch to returning base64 encoding as soon as it is fed any as input
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 08 Sep 2016 15:27:48 +0100 |
parents | 55d69b26d4db |
children | f4244a2d55ac |
comparison
equal
deleted
inserted
replaced
43:62c17e143aba | 44:a98ef4c2616b |
---|---|
43 string err; | 43 string err; |
44 | 44 |
45 Json j = json_input(input); | 45 Json j = json_input(input); |
46 string type = j["type"].string_value(); | 46 string type = j["type"].string_value(); |
47 Json payload = j["payload"]; | 47 Json payload = j["payload"]; |
48 VampJson::BufferSerialisation serialisation; | |
48 | 49 |
49 if (type == "configurationrequest") { | 50 if (type == "configurationrequest") { |
50 auto req = message.initRoot<ConfigurationRequest>(); | 51 auto req = message.initRoot<ConfigurationRequest>(); |
51 PreservingPluginHandleMapper mapper; | 52 PreservingPluginHandleMapper mapper; |
52 VampnProto::buildConfigurationRequest | 53 VampnProto::buildConfigurationRequest |
58 (resp, VampJson::toConfigurationResponse(payload)); | 59 (resp, VampJson::toConfigurationResponse(payload)); |
59 | 60 |
60 } else if (type == "feature") { | 61 } else if (type == "feature") { |
61 auto f = message.initRoot<Feature>(); | 62 auto f = message.initRoot<Feature>(); |
62 VampnProto::buildFeature | 63 VampnProto::buildFeature |
63 (f, VampJson::toFeature(payload)); | 64 (f, VampJson::toFeature(payload, serialisation)); |
64 | 65 |
65 } else if (type == "featureset") { | 66 } else if (type == "featureset") { |
66 auto fs = message.initRoot<FeatureSet>(); | 67 auto fs = message.initRoot<FeatureSet>(); |
67 VampnProto::buildFeatureSet | 68 VampnProto::buildFeatureSet |
68 (fs, VampJson::toFeatureSet(payload)); | 69 (fs, VampJson::toFeatureSet(payload, serialisation)); |
69 | 70 |
70 } else if (type == "loadrequest") { | 71 } else if (type == "loadrequest") { |
71 auto req = message.initRoot<LoadRequest>(); | 72 auto req = message.initRoot<LoadRequest>(); |
72 VampnProto::buildLoadRequest | 73 VampnProto::buildLoadRequest |
73 (req, VampJson::toLoadRequest(payload)); | 74 (req, VampJson::toLoadRequest(payload)); |
100 | 101 |
101 } else if (type == "processrequest") { | 102 } else if (type == "processrequest") { |
102 auto p = message.initRoot<ProcessRequest>(); | 103 auto p = message.initRoot<ProcessRequest>(); |
103 PreservingPluginHandleMapper mapper; | 104 PreservingPluginHandleMapper mapper; |
104 VampnProto::buildProcessRequest | 105 VampnProto::buildProcessRequest |
105 (p, VampJson::toProcessRequest(payload, mapper), mapper); | 106 (p, VampJson::toProcessRequest(payload, mapper, serialisation), mapper); |
106 | 107 |
107 } else if (type == "realtime") { | 108 } else if (type == "realtime") { |
108 auto b = message.initRoot<RealTime>(); | 109 auto b = message.initRoot<RealTime>(); |
109 VampnProto::buildRealTime | 110 VampnProto::buildRealTime |
110 (b, VampJson::toRealTime(payload)); | 111 (b, VampJson::toRealTime(payload)); |