AACContainer.h 849 B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include <stdint.h> // for uint32_t
  3. #include <cstddef> // for byte, size_t
  4. #include <istream> // for istream
  5. #include <vector> // for vector
  6. #include "AudioContainer.h" // for AudioContainer
  7. #include "CodecType.h" // for AudioCodec, AudioCodec::AAC
  8. namespace bell {
  9. class AACContainer : public AudioContainer {
  10. public:
  11. ~AACContainer(){};
  12. AACContainer(std::istream& istr);
  13. std::byte* readSample(uint32_t& len) override;
  14. void parseSetupData() override;
  15. bell::AudioCodec getCodec() override { return bell::AudioCodec::AAC; }
  16. private:
  17. static constexpr auto AAC_MAX_FRAME_SIZE = 2100;
  18. static constexpr auto BUFFER_SIZE = 1024 * 10;
  19. std::vector<std::byte> buffer = std::vector<std::byte>(BUFFER_SIZE);
  20. size_t bytesInBuffer = 0;
  21. size_t dataOffset = 0;
  22. bool fillBuffer();
  23. };
  24. } // namespace bell