mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-13 06:57:07 +03:00
Bell catchup
This commit is contained in:
@@ -9,13 +9,15 @@
|
||||
#include "CodecType.h" // for AudioCodec, AudioCodec::AAC
|
||||
|
||||
namespace bell {
|
||||
class AACContainer : public AudioContainer {
|
||||
class ADTSContainer : public AudioContainer {
|
||||
public:
|
||||
~AACContainer(){};
|
||||
AACContainer(std::istream& istr);
|
||||
~ADTSContainer(){};
|
||||
ADTSContainer(std::istream& istr, const std::byte* headingBytes = nullptr);
|
||||
|
||||
std::byte* readSample(uint32_t& len) override;
|
||||
bool resyncADTS();
|
||||
void parseSetupData() override;
|
||||
void consumeBytes(uint32_t len) override;
|
||||
|
||||
bell::AudioCodec getCodec() override { return bell::AudioCodec::AAC; }
|
||||
|
||||
@@ -27,6 +29,7 @@ class AACContainer : public AudioContainer {
|
||||
|
||||
size_t bytesInBuffer = 0;
|
||||
size_t dataOffset = 0;
|
||||
bool protectionAbsent = false;
|
||||
|
||||
bool fillBuffer();
|
||||
};
|
||||
@@ -10,7 +10,6 @@ namespace bell {
|
||||
class AudioContainer {
|
||||
protected:
|
||||
std::istream& istr;
|
||||
uint32_t toConsume = 0;
|
||||
|
||||
public:
|
||||
bell::SampleRate sampleRate;
|
||||
@@ -20,7 +19,7 @@ class AudioContainer {
|
||||
AudioContainer(std::istream& istr) : istr(istr) {}
|
||||
|
||||
virtual std::byte* readSample(uint32_t& len) = 0;
|
||||
void consumeBytes(uint32_t bytes) { this->toConsume = bytes; }
|
||||
virtual void consumeBytes(uint32_t len) = 0;
|
||||
virtual void parseSetupData() = 0;
|
||||
virtual bell::AudioCodec getCodec() = 0;
|
||||
};
|
||||
|
||||
@@ -12,10 +12,12 @@ namespace bell {
|
||||
class MP3Container : public AudioContainer {
|
||||
public:
|
||||
~MP3Container(){};
|
||||
MP3Container(std::istream& istr);
|
||||
MP3Container(std::istream& istr, const std::byte* headingBytes = nullptr);
|
||||
|
||||
std::byte* readSample(uint32_t& len) override;
|
||||
void parseSetupData() override;
|
||||
void consumeBytes(uint32_t len) override;
|
||||
|
||||
bell::AudioCodec getCodec() override { return bell::AudioCodec::MP3; }
|
||||
|
||||
private:
|
||||
@@ -26,6 +28,7 @@ class MP3Container : public AudioContainer {
|
||||
|
||||
size_t bytesInBuffer = 0;
|
||||
size_t dataOffset = 0;
|
||||
size_t toConsume = 0;
|
||||
|
||||
bool fillBuffer();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user