Bell catchup

This commit is contained in:
philippe44
2023-07-26 13:19:20 -07:00
parent 859efdb954
commit 232afb948b
467 changed files with 77538 additions and 37137 deletions

View File

@@ -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();
};

View File

@@ -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;
};

View File

@@ -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();
};