mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-21 13:06:15 +02:00
Code cleanup
This commit is contained in:
parent
a75e4857e6
commit
cd9f785425
7 changed files with 9 additions and 34 deletions
|
@ -153,11 +153,9 @@ FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder* /*decoder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder* decoder, const FLAC__Frame* frame, const FLAC__int32* const buffer[],
|
FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder* /*decoder*/, const FLAC__Frame* frame, const FLAC__int32* const buffer[],
|
||||||
void* client_data)
|
void* client_data)
|
||||||
{
|
{
|
||||||
(void)decoder;
|
|
||||||
|
|
||||||
if (pcmChunk != nullptr)
|
if (pcmChunk != nullptr)
|
||||||
{
|
{
|
||||||
size_t bytes = frame->header.blocksize * sampleFormat.frameSize;
|
size_t bytes = frame->header.blocksize * sampleFormat.frameSize;
|
||||||
|
@ -202,9 +200,8 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder* decoder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void metadata_callback(const FLAC__StreamDecoder* decoder, const FLAC__StreamMetadata* metadata, void* client_data)
|
void metadata_callback(const FLAC__StreamDecoder* /*decoder*/, const FLAC__StreamMetadata* metadata, void* client_data)
|
||||||
{
|
{
|
||||||
(void)decoder;
|
|
||||||
/* print some stats */
|
/* print some stats */
|
||||||
if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO)
|
if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO)
|
||||||
{
|
{
|
||||||
|
@ -214,9 +211,8 @@ void metadata_callback(const FLAC__StreamDecoder* decoder, const FLAC__StreamMet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void error_callback(const FLAC__StreamDecoder* decoder, FLAC__StreamDecoderErrorStatus status, void* client_data)
|
void error_callback(const FLAC__StreamDecoder* /*decoder*/, FLAC__StreamDecoderErrorStatus status, void* client_data)
|
||||||
{
|
{
|
||||||
(void)decoder, (void)client_data;
|
|
||||||
SLOG(ERROR) << "Got error callback: " << FLAC__StreamDecoderErrorStatusString[status] << "\n";
|
SLOG(ERROR) << "Got error callback: " << FLAC__StreamDecoderErrorStatusString[status] << "\n";
|
||||||
static_cast<FlacDecoder*>(client_data)->lastError_ = std::unique_ptr<FLAC__StreamDecoderErrorStatus>(new FLAC__StreamDecoderErrorStatus(status));
|
static_cast<FlacDecoder*>(client_data)->lastError_ = std::unique_ptr<FLAC__StreamDecoderErrorStatus>(new FLAC__StreamDecoderErrorStatus(status));
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PcmChunk(const PcmChunk& pcmChunk) : WireChunk(pcmChunk), format(pcmChunk.format), idx_(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
PcmChunk() : WireChunk(), idx_(0)
|
PcmChunk() : WireChunk(), idx_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,31 +26,22 @@
|
||||||
// text_exception uses a dynamically-allocated internal c-string for what():
|
// text_exception uses a dynamically-allocated internal c-string for what():
|
||||||
class SnapException : public std::exception
|
class SnapException : public std::exception
|
||||||
{
|
{
|
||||||
char* text_;
|
std::string text_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SnapException(const char* text)
|
SnapException(const char* text) : text_(text)
|
||||||
{
|
{
|
||||||
text_ = new char[std::strlen(text) + 1];
|
|
||||||
std::strcpy(text_, text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SnapException(const std::string& text) : SnapException(text.c_str())
|
SnapException(const std::string& text) : SnapException(text.c_str())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SnapException(const SnapException& e) : SnapException(e.what())
|
~SnapException() throw() override = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~SnapException() throw() override
|
|
||||||
{
|
|
||||||
delete[] text_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* what() const noexcept override
|
const char* what() const noexcept override
|
||||||
{
|
{
|
||||||
return text_;
|
return text_.c_str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,11 +58,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncSnapException(const AsyncSnapException& e) : SnapException(e.what())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
~AsyncSnapException() throw() override = default;
|
~AsyncSnapException() throw() override = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ def doRequest( j, requestId ):
|
||||||
if jResponse['id'] == requestId:
|
if jResponse['id'] == requestId:
|
||||||
print("recv: " + response)
|
print("recv: " + response)
|
||||||
return jResponse;
|
return jResponse;
|
||||||
return;
|
|
||||||
|
|
||||||
def setVolume(client, volume):
|
def setVolume(client, volume):
|
||||||
global requestId
|
global requestId
|
||||||
|
|
|
@ -16,7 +16,6 @@ def doRequest( j, requestId ):
|
||||||
if jResponse['id'] == requestId:
|
if jResponse['id'] == requestId:
|
||||||
# print("recv: " + response)
|
# print("recv: " + response)
|
||||||
return jResponse;
|
return jResponse;
|
||||||
return;
|
|
||||||
|
|
||||||
def setVolume(client, volume):
|
def setVolume(client, volume):
|
||||||
global requestId
|
global requestId
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
_( )/ ___) / \ ( ( \( _ \( _ \ / __)( ) ( )
|
_( )/ ___) / \ ( ( \( _ \( _ \ / __)( ) ( )
|
||||||
/ \) \\___ \( O )/ / ) / ) __/( (__(_ _)(_ _)
|
/ \) \\___ \( O )/ / ) / ) __/( (__(_ _)(_ _)
|
||||||
\____/(____/ \__/ \_)__)(__\_)(__) \___)(_) (_)
|
\____/(____/ \__/ \_)__)(__\_)(__) \___)(_) (_)
|
||||||
version 1.3.0
|
version 1.3.1
|
||||||
https://github.com/badaix/jsonrpcpp
|
https://github.com/badaix/jsonrpcpp
|
||||||
|
|
||||||
This file is part of jsonrpc++
|
This file is part of jsonrpc++
|
||||||
|
@ -336,7 +336,6 @@ class RequestException : public RpcEntityException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RequestException(const Error& error, const Id& requestId = Id());
|
RequestException(const Error& error, const Id& requestId = Id());
|
||||||
RequestException(const RequestException& e) = default;
|
|
||||||
Json to_json() const override;
|
Json to_json() const override;
|
||||||
|
|
||||||
const Id& id() const
|
const Id& id() const
|
||||||
|
|
|
@ -266,7 +266,7 @@ int main(int argc, char* argv[])
|
||||||
settings.stream.bufferMs = 400;
|
settings.stream.bufferMs = 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<StreamServer> streamServer(new StreamServer(io_context, settings));
|
auto streamServer = std::make_unique<StreamServer>(io_context, settings);
|
||||||
streamServer->start();
|
streamServer->start();
|
||||||
|
|
||||||
if (num_threads < 0)
|
if (num_threads < 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue