Clean up AsioStream reader code

This commit is contained in:
badaix 2019-12-01 11:38:55 +01:00
parent 3cb9902bbe
commit a47849a571
8 changed files with 35 additions and 137 deletions

View file

@ -80,7 +80,7 @@ void StreamServer::onStateChanged(const PcmStream* pcmStream, const ReaderState&
// clang-format off
// Notification: {"jsonrpc":"2.0","method":"Stream.OnUpdate","params":{"id":"stream 1","stream":{"id":"stream 1","status":"idle","uri":{"fragment":"","host":"","path":"/tmp/snapfifo","query":{"buffer_ms":"20","codec":"flac","name":"stream 1","sampleformat":"48000:16:2"},"raw":"pipe:///tmp/snapfifo?name=stream 1","scheme":"pipe"}}}}
// clang-format on
LOG(INFO) << "onStateChanged (" << pcmStream->getName() << "): " << state << "\n";
LOG(INFO) << "onStateChanged (" << pcmStream->getName() << "): " << static_cast<int>(state) << "\n";
// LOG(INFO) << pcmStream->toJson().dump(4);
json notification = jsonrpcpp::Notification("Stream.OnUpdate", jsonrpcpp::Parameter("id", pcmStream->getId(), "stream", pcmStream->toJson())).to_json();
controlServer_->send(notification.dump(), nullptr);