diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-10 15:33:00 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-10 15:33:00 +1000 |
| commit | d8fc77101dcf80a3643a00b3446dca1e390ce997 (patch) | |
| tree | 9e03881f3857c7b4c6a0b6e3a062947daecc69d1 /src/codecs/include/vorbis.hpp | |
| parent | 67caeb6e3cda44205ba8fe783274b20dc7ea216e (diff) | |
| download | tangara-fw-d8fc77101dcf80a3643a00b3446dca1e390ce997.tar.gz | |
Give codecs complete control of their input files
Diffstat (limited to 'src/codecs/include/vorbis.hpp')
| -rw-r--r-- | src/codecs/include/vorbis.hpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/src/codecs/include/vorbis.hpp b/src/codecs/include/vorbis.hpp index ab15af19..2f93c37e 100644 --- a/src/codecs/include/vorbis.hpp +++ b/src/codecs/include/vorbis.hpp @@ -28,30 +28,20 @@ class TremorVorbisDecoder : public ICodec { TremorVorbisDecoder(); ~TremorVorbisDecoder(); - /* - * Returns the output format for the next frame in the stream. MP3 streams - * may represent multiple distinct tracks, with different bitrates, and so we - * handle the stream only on a frame-by-frame basis. - */ - auto BeginStream(cpp::span<const std::byte>) -> Result<OutputFormat> override; - - /* - * Writes samples for the current frame. - */ - auto ContinueStream(cpp::span<const std::byte> input, - cpp::span<sample::Sample> output) - -> Result<OutputInfo> override; - - auto SeekStream(cpp::span<const std::byte> input, std::size_t target_sample) - -> Result<void> override; - - auto ReadCallback() -> cpp::span<const std::byte>; - auto AfterReadCallback(size_t bytes_read) -> void; + auto OpenStream(std::shared_ptr<IStream> input) + -> cpp::result<OutputFormat, Error> override; + + auto DecodeTo(cpp::span<sample::Sample> destination) + -> cpp::result<OutputInfo, Error> override; + + auto SeekTo(std::size_t target_sample) -> cpp::result<void, Error> override; + + TremorVorbisDecoder(const TremorVorbisDecoder&) = delete; + TremorVorbisDecoder& operator=(const TremorVorbisDecoder&) = delete; private: + std::shared_ptr<IStream> input_; OggVorbis_File vorbis_; - cpp::span<const std::byte> input_; - size_t pos_in_input_; }; } // namespace codecs |
