summaryrefslogtreecommitdiff
path: root/src/audio/include/audio_decoder.hpp
blob: 98ebdc7156ee4689f89e89763dec3249da3e7dfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include <cstddef>

#include "ff.h"

#include "audio_element.hpp"
#include "codec.hpp"

namespace audio {

/*
 * An audio element that accepts various kinds of encoded audio streams as
 * input, and converts them to uncompressed PCM output.
 */
class AudioDecoder : public IAudioElement {
 public:
  AudioDecoder();
  ~AudioDecoder();

  auto SetInputBuffer(StreamBufferHandle_t*) -> void;
  auto SetOutputBuffer(StreamBufferHandle_t*) -> void;

  AudioDecoder(const AudioDecoder&) = delete;
  AudioDecoder& operator=(const AudioDecoder&) = delete;

 private:
  std::unique_ptr<codecs::ICodec> current_codec_;
  std::optional<StreamInfo> stream_info_;

  uint8_t* chunk_buffer_;
};

}  // namespace audio