mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-11 05:57:05 +03:00
move to new cspot
This commit is contained in:
30
components/spotify/cspot/bell/main/audio-codec/BaseCodec.cpp
Normal file
30
components/spotify/cspot/bell/main/audio-codec/BaseCodec.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "BaseCodec.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace bell;
|
||||
|
||||
bool BaseCodec::setup(AudioContainer* container) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* BaseCodec::decode(AudioContainer* container, uint32_t& outLen) {
|
||||
auto* data = container->readSample(lastSampleLen);
|
||||
if (data == nullptr) {
|
||||
outLen = 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (lastSampleLen == 0) {
|
||||
outLen = 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
availableBytes = lastSampleLen;
|
||||
auto* result = decode((uint8_t*)data, availableBytes, outLen);
|
||||
if (result == nullptr) {
|
||||
container->consumeBytes(1);
|
||||
} else {
|
||||
container->consumeBytes(lastSampleLen - availableBytes);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user