Remove StreamTags message

This commit is contained in:
badaix 2023-01-31 09:27:47 +01:00
parent 97e84f31f6
commit a3cd985e22
6 changed files with 3 additions and 115 deletions

View file

@ -259,14 +259,6 @@ void Controller::getNextMessage()
player_->setVolume(serverSettings_->getVolume() / 100., serverSettings_->isMuted());
// }
}
// else if (response->type == message_type::kStreamTags)
// {
// if (meta_)
// {
// auto stream_tags = msg::message_cast<msg::StreamTags>(std::move(response));
// meta_->push(stream_tags->msg);
// }
// }
else
{
LOG(WARNING, LOG_TAG) << "Unexpected message received, type: " << response->type << "\n";

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2022 Johannes Pohl
Copyright (C) 2014-2023 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -75,8 +75,6 @@ static std::unique_ptr<BaseMessage> createMessage(const BaseMessage& base_messag
return createMessage<Hello>(base_message, buffer);
case message_type::kServerSettings:
return createMessage<ServerSettings>(base_message, buffer);
// case message_type::kStreamTags:
// return createMessage<StreamTags>(base_message, buffer);
case message_type::kTime:
return createMessage<Time>(base_message, buffer);
case message_type::kWireChunk:

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2022 Johannes Pohl
Copyright (C) 2014-2023 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -63,7 +63,7 @@ enum class message_type : uint16_t
kServerSettings = 3,
kTime = 4,
kHello = 5,
kStreamTags = 6,
// kStreamTags = 6,
kClientInfo = 7,
kFirst = kBase,
@ -92,9 +92,6 @@ static std::ostream& operator<<(std::ostream& os, const message_type& msg_type)
case message_type::kHello:
os << "Hello";
break;
case message_type::kStreamTags:
os << "StreamTags";
break;
case message_type::kClientInfo:
os << "ClientInfo";
break;

View file

@ -1,80 +0,0 @@
/***
This file is part of snapcast
Copyright (C) 2014-2022 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef MESSAGE_STREAM_TAGS_HPP
#define MESSAGE_STREAM_TAGS_HPP
// local headers
#include "json_message.hpp"
/*
* Due to the PCM pipe implementation of snapcast input we cannot know track start/end
* it's all a long stream (although we detect idle situations)
*
* So, we cannot push metadata on start of track as we don't know when that is.
*
* I.E. we push metadata as we get an update, as we don't know when an update
* is complete (different meta supported in different stream interfaces)
* it is the streamreaders responsibility to update metadata and
* trigger a client notification.
*
* I.E. we need to suppply the client notification mechanism.
*/
namespace msg
{
class StreamTags : public JsonMessage
{
public:
/*
Usage:
json jtag = {
{"artist", "Pink Floyd"},
{"album", "Dark Side of the Moon"},
{"track", "Money"},
{"spotifyid", "akjhasi7wehke7698"},
{"musicbrainzid", "akjhasi7wehke7698"},
};
this->meta_.reset(new msg::StreamTags(jtag));
Stream input can decide on tags, IDK... but smart
to use some common naming scheme
*/
StreamTags(json j) : JsonMessage(message_type::kStreamTags)
{
msg = j;
}
StreamTags() : JsonMessage(message_type::kStreamTags)
{
}
// StreamTags(const Metatags& tags) : JsonMessage(message_type::kStreamTags)
// {
// if (tags.album.has_value())
// msg['album'] = *tags.album;
// }
~StreamTags() override = default;
};
} // namespace msg
#endif

View file

@ -13,7 +13,6 @@ When a client joins a server, the following exchanges happen
1. Client opens a TCP socket to the server (default port is 1704)
1. Client sends a [Hello](#hello) message
1. Server sends a [Server Settings](#server-settings) message
1. Server sends a [Stream Tags](#stream-tags) message
1. Server sends a [Codec Header](#codec-header) message
1. Until the server sends this, the client shouldn't play any [Wire Chunk](#wire-chunk) messages
1. The server will now send [Wire Chunk](#wire-chunk) messages, which can be fed to the audio decoder.
@ -123,20 +122,3 @@ Sample JSON payload (whitespace added for readability):
"Version": "0.17.1"
}
```
### Stream Tags
| Field | Type | Description |
|---------|--------|----------------------------------------------------------------|
| size | uint32 | Size of the following JSON string |
| payload | char[] | JSON string containing the message (not null terminated) |
Sample JSON payload (whitespace added for readability):
```json
{
"STREAM": "default"
}
```
[According to the source](https://github.com/badaix/snapcast/blob/master/common/message/stream_tags.hpp#L55-L56), these tags can vary based on the stream.

View file

@ -70,7 +70,6 @@ public:
// void send(const msg::BaseMessage* message);
void addSession(std::shared_ptr<StreamSession> session);
// void onMetadataChanged(const PcmStream* pcmStream, std::shared_ptr<msg::StreamTags> meta);
void onChunkEncoded(const PcmStream* pcmStream, bool isDefaultStream, std::shared_ptr<msg::PcmChunk> chunk, double duration);
session_ptr getStreamSession(const std::string& clientId) const;