mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-22 19:07:38 +02:00
callback based encoding
This commit is contained in:
parent
b936bffeff
commit
c0057d2575
9 changed files with 193 additions and 75 deletions
|
@ -16,17 +16,19 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <memory>
|
||||
#include "pcmEncoder.h"
|
||||
|
||||
PcmEncoder::PcmEncoder() : Encoder()
|
||||
PcmEncoder::PcmEncoder(const std::string& codecOptions) : Encoder(codecOptions)
|
||||
{
|
||||
headerChunk_ = new msg::Header("pcm");
|
||||
}
|
||||
|
||||
|
||||
double PcmEncoder::encode(msg::PcmChunk* chunk)
|
||||
void PcmEncoder::encode(const msg::PcmChunk* chunk)
|
||||
{
|
||||
return chunk->duration<chronos::msec>().count();
|
||||
msg::PcmChunk* pcmChunk = new msg::PcmChunk(*chunk);
|
||||
listener_->onChunkEncoded(this, pcmChunk, pcmChunk->duration<chronos::msec>().count());
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,3 +37,9 @@ void PcmEncoder::initEncoder()
|
|||
}
|
||||
|
||||
|
||||
std::string PcmEncoder::name() const
|
||||
{
|
||||
return "pcm";
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue