mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-31 23:29:21 +02:00
controller
git-svn-id: svn://elaine/murooma/trunk@242 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
e342a4108e
commit
00fac3eccb
15 changed files with 126 additions and 116 deletions
|
@ -17,6 +17,13 @@ public:
|
|||
};
|
||||
|
||||
|
||||
struct membuf : public std::basic_streambuf<char>
|
||||
{
|
||||
membuf(char* begin, char* end) {
|
||||
this->setg(begin, begin, end);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
enum message_type
|
||||
{
|
||||
|
@ -48,9 +55,18 @@ struct BaseMessage
|
|||
stream.read(reinterpret_cast<char*>(&size), sizeof(uint32_t));
|
||||
}
|
||||
|
||||
virtual void readVec(std::vector<char>& stream)
|
||||
void deserialize(char* payload)
|
||||
{
|
||||
vectorwrapbuf<char> databuf(stream);
|
||||
membuf databuf(payload, payload + sizeof(size));
|
||||
std::istream is(&databuf);
|
||||
read(is);
|
||||
}
|
||||
|
||||
void deserialize(const BaseMessage& baseMessage, char* payload)
|
||||
{
|
||||
type = baseMessage.type;
|
||||
size = baseMessage.size;
|
||||
membuf databuf(payload, payload + size);
|
||||
std::istream is(&databuf);
|
||||
read(is);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue