mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-20 12:36:17 +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)decoder;
|
||||
|
||||
if (pcmChunk != nullptr)
|
||||
{
|
||||
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 */
|
||||
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";
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -26,31 +26,22 @@
|
|||
// text_exception uses a dynamically-allocated internal c-string for what():
|
||||
class SnapException : public std::exception
|
||||
{
|
||||
char* text_;
|
||||
std::string text_;
|
||||
|
||||
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 SnapException& e) : SnapException(e.what())
|
||||
{
|
||||
}
|
||||
|
||||
~SnapException() throw() override
|
||||
{
|
||||
delete[] text_;
|
||||
}
|
||||
~SnapException() throw() override = default;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ def doRequest( j, requestId ):
|
|||
if jResponse['id'] == requestId:
|
||||
print("recv: " + response)
|
||||
return jResponse;
|
||||
return;
|
||||
|
||||
def setVolume(client, volume):
|
||||
global requestId
|
||||
|
|
|
@ -16,7 +16,6 @@ def doRequest( j, requestId ):
|
|||
if jResponse['id'] == requestId:
|
||||
# print("recv: " + response)
|
||||
return jResponse;
|
||||
return;
|
||||
|
||||
def setVolume(client, volume):
|
||||
global requestId
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
_( )/ ___) / \ ( ( \( _ \( _ \ / __)( ) ( )
|
||||
/ \) \\___ \( O )/ / ) / ) __/( (__(_ _)(_ _)
|
||||
\____/(____/ \__/ \_)__)(__\_)(__) \___)(_) (_)
|
||||
version 1.3.0
|
||||
version 1.3.1
|
||||
https://github.com/badaix/jsonrpcpp
|
||||
|
||||
This file is part of jsonrpc++
|
||||
|
@ -336,7 +336,6 @@ class RequestException : public RpcEntityException
|
|||
{
|
||||
public:
|
||||
RequestException(const Error& error, const Id& requestId = Id());
|
||||
RequestException(const RequestException& e) = default;
|
||||
Json to_json() const override;
|
||||
|
||||
const Id& id() const
|
||||
|
|
|
@ -266,7 +266,7 @@ int main(int argc, char* argv[])
|
|||
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();
|
||||
|
||||
if (num_threads < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue