replaced MapMessage with JsonMessage

This commit is contained in:
badaix 2016-04-05 22:39:39 +02:00
parent 8a69a9c971
commit efb592d495
31 changed files with 200 additions and 244 deletions

View file

@ -11,7 +11,7 @@ endif
CXXFLAGS += $(ADD_CFLAGS) -std=c++0x -Wall -Wno-unused-function -O3 -pthread -DASIO_STANDALONE -DVERSION=\"$(VERSION)\" -I. -I.. -I../externals/asio/asio/include -I../externals/popl/include
OBJ = snapClient.o stream.o clientConnection.o timeProvider.o player/player.o decoder/pcmDecoder.o decoder/flacDecoder.o controller.o ../message/pcmChunk.o ../common/log.o ../message/sampleFormat.o
OBJ = snapClient.o stream.o clientConnection.o timeProvider.o player/player.o decoder/pcmDecoder.o decoder/flacDecoder.o controller.o ../message/pcmChunk.o ../common/log.o ../common/sampleFormat.o
ifeq ($(TARGET), ANDROID)
# Android NDK setup: (http://developer.android.com/ndk/guides/standalone_toolchain.html)

View file

@ -78,17 +78,17 @@ void Controller::onMessageReceived(ClientConnection* connection, const msg::Base
{
serverSettings_.reset(new msg::ServerSettings());
serverSettings_->deserialize(baseMessage, buffer);
logO << "ServerSettings - buffer: " << serverSettings_->bufferMs << ", latency: " << serverSettings_->latency << ", volume: " << serverSettings_->volume << ", muted: " << serverSettings_->muted << "\n";
logO << "ServerSettings - buffer: " << serverSettings_->getBufferMs() << ", latency: " << serverSettings_->getLatency() << ", volume: " << serverSettings_->getVolume() << ", muted: " << serverSettings_->isMuted() << "\n";
if (stream_ && player_)
{
player_->setVolume(serverSettings_->volume / 100.);
player_->setMute(serverSettings_->muted);
stream_->setBufferLen(serverSettings_->bufferMs - serverSettings_->latency);
player_->setVolume(serverSettings_->getVolume() / 100.);
player_->setMute(serverSettings_->isMuted());
stream_->setBufferLen(serverSettings_->getBufferMs() - serverSettings_->getLatency());
}
}
else if (baseMessage.type == message_type::kHeader)
else if (baseMessage.type == message_type::kCodecHeader)
{
headerChunk_.reset(new msg::Header());
headerChunk_.reset(new msg::CodecHeader());
headerChunk_->deserialize(baseMessage, buffer);
logO << "Codec: " << headerChunk_->codec << "\n";
@ -111,7 +111,7 @@ void Controller::onMessageReceived(ClientConnection* connection, const msg::Base
logState << "sampleformat: " << sampleFormat_.rate << ":" << sampleFormat_.bits << ":" << sampleFormat_.channels << "\n";
stream_.reset(new Stream(sampleFormat_));
stream_->setBufferLen(serverSettings_->bufferMs - latency_);
stream_->setBufferLen(serverSettings_->getBufferMs() - latency_);
#ifdef HAS_ALSA
player_.reset(new AlsaPlayer(pcmDevice_, stream_.get()));
@ -120,8 +120,8 @@ void Controller::onMessageReceived(ClientConnection* connection, const msg::Base
#else
throw SnapException("No ALSA or OPENSL support");
#endif
player_->setVolume(serverSettings_->volume / 100.);
player_->setMute(serverSettings_->muted);
player_->setVolume(serverSettings_->getVolume() / 100.);
player_->setMute(serverSettings_->isMuted());
player_->start();
}

View file

@ -68,7 +68,7 @@ private:
std::unique_ptr<Decoder> decoder_;
std::unique_ptr<Player> player_;
std::shared_ptr<msg::ServerSettings> serverSettings_;
std::shared_ptr<msg::Header> headerChunk_;
std::shared_ptr<msg::CodecHeader> headerChunk_;
std::mutex receiveMutex_;
std::string exception_;

View file

@ -20,8 +20,8 @@
#define DECODER_H
#include <mutex>
#include "message/pcmChunk.h"
#include "message/header.h"
#include "message/sampleFormat.h"
#include "message/codecHeader.h"
#include "common/sampleFormat.h"
class Decoder
@ -30,7 +30,7 @@ public:
Decoder() {};
virtual ~Decoder() {};
virtual bool decode(msg::PcmChunk* chunk) = 0;
virtual SampleFormat setHeader(msg::Header* chunk) = 0;
virtual SampleFormat setHeader(msg::CodecHeader* chunk) = 0;
protected:
std::mutex mutex_;

View file

@ -35,7 +35,7 @@ static void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__St
static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
static msg::Header* flacHeader = NULL;
static msg::CodecHeader* flacHeader = NULL;
static msg::PcmChunk* flacChunk = NULL;
static msg::PcmChunk* pcmChunk = NULL;
static SampleFormat sampleFormat;
@ -84,7 +84,7 @@ bool FlacDecoder::decode(msg::PcmChunk* chunk)
}
SampleFormat FlacDecoder::setHeader(msg::Header* chunk)
SampleFormat FlacDecoder::setHeader(msg::CodecHeader* chunk)
{
flacHeader = chunk;
FLAC__StreamDecoderInitStatus init_status;

View file

@ -47,7 +47,7 @@ public:
FlacDecoder();
virtual ~FlacDecoder();
virtual bool decode(msg::PcmChunk* chunk);
virtual SampleFormat setHeader(msg::Header* chunk);
virtual SampleFormat setHeader(msg::CodecHeader* chunk);
CacheInfo cacheInfo_;
};

View file

@ -145,7 +145,7 @@ bool OggDecoder::decode(msg::PcmChunk* chunk)
}
SampleFormat OggDecoder::setHeader(msg::Header* chunk)
SampleFormat OggDecoder::setHeader(msg::CodecHeader* chunk)
{
bytes = chunk->payloadSize;
buffer=ogg_sync_buffer(&oy, bytes);

View file

@ -28,7 +28,7 @@ public:
OggDecoder();
virtual ~OggDecoder();
virtual bool decode(msg::PcmChunk* chunk);
virtual SampleFormat setHeader(msg::Header* chunk);
virtual SampleFormat setHeader(msg::CodecHeader* chunk);
private:
bool decodePayload(msg::PcmChunk* chunk);

View file

@ -76,7 +76,7 @@ bool PcmDecoder::decode(msg::PcmChunk* chunk)
}
SampleFormat PcmDecoder::setHeader(msg::Header* chunk)
SampleFormat PcmDecoder::setHeader(msg::CodecHeader* chunk)
{
if (chunk->payloadSize < 44)
throw SnapException("PCM header too small");

View file

@ -26,7 +26,7 @@ class PcmDecoder : public Decoder
public:
PcmDecoder();
virtual bool decode(msg::PcmChunk* chunk);
virtual SampleFormat setHeader(msg::Header* chunk);
virtual SampleFormat setHeader(msg::CodecHeader* chunk);
};

View file

@ -30,7 +30,7 @@
#include "doubleBuffer.h"
#include "message/message.h"
#include "message/pcmChunk.h"
#include "message/sampleFormat.h"
#include "common/sampleFormat.h"
#include "common/queue.h"

View file

@ -16,8 +16,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef HEADER_MESSAGE_H
#define HEADER_MESSAGE_H
#ifndef CODEC_HEADER_MESSAGE_H
#define CODEC_HEADER_MESSAGE_H
#include "message.h"
@ -27,15 +27,15 @@ namespace msg
/**
* Codec dependend header of encoded data stream
*/
class Header : public BaseMessage
class CodecHeader : public BaseMessage
{
public:
Header(const std::string& codecName = "", size_t size = 0) : BaseMessage(message_type::kHeader), payloadSize(size), codec(codecName)
CodecHeader(const std::string& codecName = "", size_t size = 0) : BaseMessage(message_type::kCodecHeader), payloadSize(size), codec(codecName)
{
payload = (char*)malloc(size);
}
virtual ~Header()
virtual ~CodecHeader()
{
free(payload);
}

View file

@ -19,7 +19,7 @@
#ifndef HELLO_MSG_H
#define HELLO_MSG_H
#include "mapMessage.h"
#include "jsonMessage.h"
#include "common/utils.h"
#include <string>
@ -27,22 +27,22 @@
namespace msg
{
class Hello : public MapMessage
class Hello : public JsonMessage
{
public:
Hello() : MapMessage(message_type::kHello)
Hello() : JsonMessage(message_type::kHello)
{
}
Hello(const std::string& macAddress) : MapMessage(message_type::kHello)
Hello(const std::string& macAddress) : JsonMessage(message_type::kHello)
{
add("MAC", macAddress);
add("HostName", ::getHostName());
add("Version", VERSION);
add("ClientName", "Snapclient");
add("OS", ::getOS());
add("Arch", ::getArch());
add("SnapStreamProtocolVersion", "1");
msg["MAC"] = macAddress;
msg["HostName"] = ::getHostName();
msg["Version"] = VERSION;
msg["ClientName"] = "Snapclient";
msg["OS"] = ::getOS();
msg["Arch"] = ::getArch();
msg["SnapStreamProtocolVersion"] = 1;
}
virtual ~Hello()
@ -51,32 +51,32 @@ public:
std::string getMacAddress()
{
return get("MAC");
return msg["MAC"];
}
std::string getHostName()
{
return get("HostName");
return msg["HostName"];
}
std::string getVersion()
{
return get("Version");
return msg["Version"];
}
std::string getClientName()
{
return get("ClientName");
return msg["ClientName"];
}
std::string getOS()
{
return get("OS");
return msg["OS"];
}
std::string getArch()
{
return get("Arch");
return msg["Arch"];
}
int getProtocolVersion()

83
message/jsonMessage.h Normal file
View file

@ -0,0 +1,83 @@
/***
This file is part of snapcast
Copyright (C) 2014-2016 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 JSON_MESSAGE_H
#define JSON_MESSAGE_H
#include "message.h"
#include "externals/json.hpp"
using json = nlohmann::json;
namespace msg
{
class JsonMessage : public BaseMessage
{
public:
JsonMessage(message_type msgType) : BaseMessage(msgType)
{
}
virtual ~JsonMessage()
{
}
virtual void read(std::istream& stream)
{
std::string s;
readVal(stream, s);
msg = json::parse(s);
}
virtual uint32_t getSize() const
{
return sizeof(uint32_t) + msg.dump().size();
}
json msg;
protected:
virtual void doserialize(std::ostream& stream) const
{
writeVal(stream, msg.dump());
}
template<typename T>
T get(const std::string& what, const T& def)
{
try
{
return msg[what].get<T>();
}
catch(...)
{
return def;
}
}
};
}
#endif

View file

@ -1,124 +0,0 @@
/***
This file is part of snapcast
Copyright (C) 2014-2016 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 MAP_MESSAGE_H
#define MAP_MESSAGE_H
#include "message.h"
#include <string>
#include <map>
#include <sstream>
#include "common/log.h"
namespace msg
{
class MapMessage : public BaseMessage
{
public:
MapMessage(message_type msgType) : BaseMessage(msgType)
{
}
virtual ~MapMessage()
{
}
virtual void read(std::istream& stream)
{
strMap.clear();
uint16_t mapSize;
readVal(stream, mapSize);
for (size_t n=0; n<mapSize; ++n)
{
std::string key;
std::string value;
readVal(stream, key);
readVal(stream, value);
strMap[key] = value;
}
}
virtual uint32_t getSize() const
{
uint32_t size = sizeof(uint16_t); /// count elements
for (auto iter = strMap.begin(); iter != strMap.end(); ++iter)
size += (sizeof(uint32_t) + iter->first.size()) + (sizeof(uint32_t) + iter->second.size());
return size;
}
std::map<std::string, std::string> strMap;
MapMessage& add(const std::string& key, const std::string& value)
{
strMap[key] = value;
return *this;
}
std::string get(const std::string& key, const std::string& def = "")
{
if (strMap.find(key) == strMap.end())
return def;
return strMap[key];
}
template<class T>
T get(const std::string& key, const T& def)
{
T result;
std::stringstream defaultValue;
defaultValue << def;
std::string value = get(key, defaultValue.str());
std::istringstream is(value);
while (is.good())
{
if (is.peek() != EOF)
is >> result;
else
break;
}
return result;
}
protected:
virtual void doserialize(std::ostream& stream) const
{
uint16_t size = strMap.size();
writeVal(stream, size);
for (auto iter = strMap.begin(); iter != strMap.end(); ++iter)
{
writeVal(stream, iter->first);
writeVal(stream, iter->second);
}
}
};
}
#endif

View file

@ -51,17 +51,12 @@ struct membuf : public std::basic_streambuf<char>
enum message_type
{
kBase = 0,
kHeader = 1,
kCodecHeader = 1,
kWireChunk = 2,
// kSampleFormat = 3,
kServerSettings = 4,
kTime = 5,
kRequest = 6,
// kAck = 7,
// kCommand = 8,
kHello = 9,
kMap = 10
// kString = 11
kServerSettings = 3,
kTime = 4,
kRequest = 5,
kHello = 6
};
@ -135,9 +130,6 @@ struct BaseMessage
readVal(stream, received.sec);
readVal(stream, received.usec);
readVal(stream, size);
//std::cout << type << ", " << id << ", " << refersTo << ", " << sent.sec << ":" << sent.usec << ", " << received.sec << ":" << received.usec << ", " << size << "\n";
//std::cout << __builtin_bswap32(type) << ", " << __builtin_bswap16(id) << ", " << __builtin_bswap16(refersTo) << ", " << __builtin_bswap32(sent.sec) << ":" << __builtin_bswap32(sent.usec) << ", " << __builtin_bswap32(received.sec) << ":" << __builtin_bswap32(received.usec) << ", " << __builtin_bswap32(size) << "\n";
//std::cout << SWAP_32(type) << ", " << SWAP_16(id) << ", " << SWAP_16(refersTo) << ", " << SWAP_32(sent.sec) << ":" << SWAP_32(sent.usec) << ", " << SWAP_32(received.sec) << ":" << SWAP_32(received.usec) << ", " << SWAP_32(size) << "\n";
}
void deserialize(char* payload)
@ -171,17 +163,15 @@ struct BaseMessage
writeVal(stream, received.usec);
size = getSize();
writeVal(stream, size);
//std::cout << type << ", " << id << ", " << refersTo << ", " << sent.sec << ":" << sent.usec << ", " << received.sec << ":" << received.usec << ", " << size << "\n";
//std::cout << SWAP_32(type) << ", " << SWAP_16(id) << ", " << SWAP_16(refersTo) << ", " << SWAP_32(sent.sec) << ":" << SWAP_32(sent.usec) << ", " << SWAP_32(received.sec) << ":" << SWAP_32(received.usec) << ", " << SWAP_32(size) << "\n";
doserialize(stream);
}
virtual uint32_t getSize() const
{
return 2*sizeof(uint16_t) + 2*sizeof(tv) + 2*sizeof(uint32_t);
return 3*sizeof(uint16_t) + 2*sizeof(tv) + sizeof(uint32_t);
};
uint32_t type;
uint16_t type;
mutable uint16_t id;
uint16_t refersTo;
tv received;
@ -224,12 +214,6 @@ protected:
stream.write(reinterpret_cast<const char*>(&v), sizeof(int32_t));
}
void writeVal(std::ostream& stream, const double& val) const
{
uint64_t v = SWAP_64(*(int64_t*)&val);
stream.write(reinterpret_cast<const char*>(&v), sizeof(int64_t));
}
void writeVal(std::ostream& stream, const char* payload, const uint32_t& size) const
{
writeVal(stream, size);
@ -280,12 +264,6 @@ protected:
val = SWAP_32(val);
}
void readVal(std::istream& stream, double& val) const
{
stream.read(reinterpret_cast<char*>(&val), sizeof(int64_t));
val = SWAP_64(val);
}
void readVal(std::istream& stream, char** payload, uint32_t& size) const
{
readVal(stream, size);

View file

@ -22,7 +22,7 @@
#include <chrono>
#include "message.h"
#include "wireChunk.h"
#include "sampleFormat.h"
#include "common/sampleFormat.h"
namespace msg

View file

@ -19,48 +19,67 @@
#ifndef SERVER_SETTINGS_H
#define SERVER_SETTINGS_H
#include "message/message.h"
#include "jsonMessage.h"
namespace msg
{
class ServerSettings : public BaseMessage
class ServerSettings : public JsonMessage
{
public:
ServerSettings() : BaseMessage(message_type::kServerSettings), bufferMs(0), latency(0), volume(100), muted(false)
ServerSettings() : JsonMessage(message_type::kServerSettings)
{
setBufferMs(0);
setLatency(0);
setVolume(100);
setMuted(false);
}
virtual ~ServerSettings()
{
}
virtual void read(std::istream& stream)
int32_t getBufferMs()
{
readVal(stream, bufferMs);
readVal(stream, latency);
readVal(stream, volume);
readVal(stream, muted);
return get("bufferMs", 0);
}
virtual uint32_t getSize() const
int32_t getLatency()
{
return sizeof(int32_t) + sizeof(int32_t) + sizeof(uint16_t) + sizeof(unsigned char);
return get("latency", 0);
}
int32_t bufferMs;
int32_t latency;
uint16_t volume;
bool muted;
protected:
virtual void doserialize(std::ostream& stream) const
uint16_t getVolume()
{
writeVal(stream, bufferMs);
writeVal(stream, latency);
writeVal(stream, volume);
writeVal(stream, muted);
return get("volume", 100);
}
bool isMuted()
{
return get("muted", false);
}
void setBufferMs(int32_t bufferMs)
{
msg["bufferMs"] = bufferMs;
}
void setLatency(int32_t latency)
{
msg["latency"] = latency;
}
void setVolume(uint16_t volume)
{
msg["volume"] = volume;
}
void setMuted(bool muted)
{
msg["muted"] = muted;
}
};

View file

@ -27,7 +27,7 @@ LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common
endif
OBJ = snapServer.o config.o controlServer.o controlSession.o streamServer.o streamSession.o json/jsonrpc.o streamreader/streamUri.o streamreader/streamManager.o streamreader/pcmStream.o streamreader/pipeStream.o streamreader/fileStream.o encoder/encoderFactory.o encoder/flacEncoder.o encoder/pcmEncoder.o encoder/oggEncoder.o publishAvahi.o ../common/log.o ../message/pcmChunk.o ../message/sampleFormat.o
OBJ = snapServer.o config.o controlServer.o controlSession.o streamServer.o streamSession.o json/jsonrpc.o streamreader/streamUri.o streamreader/streamManager.o streamreader/pcmStream.o streamreader/pipeStream.o streamreader/fileStream.o encoder/encoderFactory.o encoder/flacEncoder.o encoder/pcmEncoder.o encoder/oggEncoder.o publishAvahi.o ../common/log.o ../common/sampleFormat.o ../message/pcmChunk.o
BIN = snapserver
all: $(TARGET)

View file

@ -29,9 +29,9 @@
#include "controlSession.h"
#include "common/queue.h"
#include "common/sampleFormat.h"
#include "message/message.h"
#include "message/header.h"
#include "message/sampleFormat.h"
#include "message/codecHeader.h"
#include "message/serverSettings.h"

View file

@ -23,8 +23,8 @@
#include <memory>
#include "message/pcmChunk.h"
#include "message/header.h"
#include "message/sampleFormat.h"
#include "message/codecHeader.h"
#include "common/sampleFormat.h"
class Encoder;
@ -84,7 +84,7 @@ public:
}
/// Header information needed to decode the data
virtual std::shared_ptr<msg::Header> getHeader() const
virtual std::shared_ptr<msg::CodecHeader> getHeader() const
{
return headerChunk_;
}
@ -93,7 +93,7 @@ protected:
virtual void initEncoder() = 0;
SampleFormat sampleFormat_;
std::shared_ptr<msg::Header> headerChunk_;
std::shared_ptr<msg::CodecHeader> headerChunk_;
EncoderListener* listener_;
std::string codecOptions_;
};

View file

@ -29,7 +29,7 @@ using namespace std;
FlacEncoder::FlacEncoder(const std::string& codecOptions) : Encoder(codecOptions), encoder_(NULL), pcmBufferSize_(0), encodedSamples_(0)
{
flacChunk_ = new msg::PcmChunk();
headerChunk_.reset(new msg::Header("flac"));
headerChunk_.reset(new msg::CodecHeader("flac"));
pcmBuffer_ = (FLAC__int32*)malloc(pcmBufferSize_ * sizeof(FLAC__int32));
}

View file

@ -224,7 +224,7 @@ void OggEncoder::initEncoder()
* audio data will start on a new page, as per spec
*/
size_t pos(0);
headerChunk_.reset(new msg::Header("ogg"));
headerChunk_.reset(new msg::CodecHeader("ogg"));
while (true)
{
int result = ogg_stream_flush(&os,&og);

View file

@ -29,7 +29,7 @@
PcmEncoder::PcmEncoder(const std::string& codecOptions) : Encoder(codecOptions)
{
headerChunk_.reset(new msg::Header("pcm"));
headerChunk_.reset(new msg::CodecHeader("pcm"));
}

View file

@ -25,7 +25,7 @@
#include "common/timeDefs.h"
#include "common/signalHandler.h"
#include "common/snapException.h"
#include "message/sampleFormat.h"
#include "common/sampleFormat.h"
#include "message/message.h"
#include "encoder/encoderFactory.h"
#include "streamServer.h"

View file

@ -123,7 +123,7 @@ void StreamServer::onMessageReceived(ControlSession* controlSession, const std::
json response;
ClientInfoPtr clientInfo = nullptr;
msg::ServerSettings serverSettings;
serverSettings.bufferMs = settings_.bufferMs;
serverSettings.setBufferMs(settings_.bufferMs);
if (request.method.find("Client.Set") == 0)
{
@ -211,9 +211,9 @@ void StreamServer::onMessageReceived(ControlSession* controlSession, const std::
if (clientInfo != nullptr)
{
serverSettings.volume = clientInfo->config.volume.percent;
serverSettings.muted = clientInfo->config.volume.muted;
serverSettings.latency = clientInfo->config.latency;
serverSettings.setVolume(clientInfo->config.volume.percent);
serverSettings.setMuted(clientInfo->config.volume.muted);
serverSettings.setLatency(clientInfo->config.latency);
StreamSession* session = getStreamSession(request.getParam("client").get<string>());
if (session != NULL)
@ -283,11 +283,11 @@ void StreamServer::onMessageReceived(StreamSession* connection, const msg::BaseM
{
logD << "request kServerSettings\n";
msg::ServerSettings serverSettings;
serverSettings.volume = clientInfo->config.volume.percent;
serverSettings.muted = clientInfo->config.volume.muted;
serverSettings.latency = clientInfo->config.latency;
serverSettings.setVolume(clientInfo->config.volume.percent);
serverSettings.setMuted(clientInfo->config.volume.muted);
serverSettings.setLatency(clientInfo->config.latency);
serverSettings.setBufferMs(settings_.bufferMs);
serverSettings.refersTo = helloMsg.id;
serverSettings.bufferMs = settings_.bufferMs;
connection->send(&serverSettings);
}

View file

@ -30,9 +30,9 @@
#include "streamSession.h"
#include "streamreader/streamManager.h"
#include "common/queue.h"
#include "common/sampleFormat.h"
#include "message/message.h"
#include "message/header.h"
#include "message/sampleFormat.h"
#include "message/codecHeader.h"
#include "message/serverSettings.h"
#include "controlServer.h"

View file

@ -59,7 +59,7 @@ PcmStream::~PcmStream()
}
std::shared_ptr<msg::Header> PcmStream::getHeader()
std::shared_ptr<msg::CodecHeader> PcmStream::getHeader()
{
return encoder_->getHeader();
}

View file

@ -26,8 +26,8 @@
#include "streamUri.h"
#include "encoder/encoder.h"
#include "externals/json.hpp"
#include "message/sampleFormat.h"
#include "message/header.h"
#include "common/sampleFormat.h"
#include "message/codecHeader.h"
class PcmStream;
@ -72,7 +72,7 @@ public:
/// Implementation of EncoderListener::onChunkEncoded
virtual void onChunkEncoded(const Encoder* encoder, msg::PcmChunk* chunk, double duration);
virtual std::shared_ptr<msg::Header> getHeader();
virtual std::shared_ptr<msg::CodecHeader> getHeader();
virtual const StreamUri& getUri() const;
virtual const std::string& getName() const;