AudioContainer.h 579 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <cstddef>
  3. #include <cstring>
  4. #include <istream>
  5. #include "CodecType.h"
  6. #include "StreamInfo.h"
  7. namespace bell {
  8. class AudioContainer {
  9. protected:
  10. std::istream& istr;
  11. uint32_t toConsume = 0;
  12. public:
  13. bell::SampleRate sampleRate;
  14. bell::BitWidth bitWidth;
  15. int channels;
  16. AudioContainer(std::istream& istr) : istr(istr) {}
  17. virtual std::byte* readSample(uint32_t& len) = 0;
  18. void consumeBytes(uint32_t bytes) { this->toConsume = bytes; }
  19. virtual void parseSetupData() = 0;
  20. virtual bell::AudioCodec getCodec() = 0;
  21. };
  22. } // namespace bell