mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-10 14:51:41 +02:00
Tidy up
This commit is contained in:
parent
1aa8831416
commit
f5d4fcaf43
34 changed files with 274 additions and 273 deletions
|
@ -1,19 +1,20 @@
|
|||
/***
|
||||
This file is part of snapcast
|
||||
Copyright (C) 2015 Hannes Ellinger
|
||||
This file is part of snapcast
|
||||
Copyright (C) 2015 Hannes Ellinger
|
||||
Copyright (C) 2016-2021 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "opus_decoder.hpp"
|
||||
|
@ -51,7 +52,7 @@ bool OpusDecoder::decode(msg::PcmChunk* chunk)
|
|||
{
|
||||
int decoded_frames = 0;
|
||||
|
||||
while ((decoded_frames = opus_decode(dec_, (unsigned char*)chunk->payload, chunk->payloadSize, pcm_.data(),
|
||||
while ((decoded_frames = opus_decode(dec_, reinterpret_cast<unsigned char*>(chunk->payload), chunk->payloadSize, pcm_.data(),
|
||||
static_cast<int>(pcm_.size()) / sample_format_.channels(), 0)) == OPUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
if (pcm_.size() < const_max_frame_size * sample_format_.channels())
|
||||
|
@ -76,8 +77,8 @@ bool OpusDecoder::decode(msg::PcmChunk* chunk)
|
|||
|
||||
// copy encoded data to chunk
|
||||
chunk->payloadSize = decoded_frames * sample_format_.frameSize(); // decoded_frames * sample_format_.channels() * sizeof(opus_int16);
|
||||
chunk->payload = (char*)realloc(chunk->payload, chunk->payloadSize);
|
||||
memcpy(chunk->payload, (char*)pcm_.data(), chunk->payloadSize);
|
||||
chunk->payload = static_cast<char*>(realloc(chunk->payload, chunk->payloadSize));
|
||||
memcpy(chunk->payload, reinterpret_cast<char*>(pcm_.data()), chunk->payloadSize);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue