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/opus.hpp | |
| parent | 67caeb6e3cda44205ba8fe783274b20dc7ea216e (diff) | |
| download | tangara-fw-d8fc77101dcf80a3643a00b3446dca1e390ce997.tar.gz | |
Give codecs complete control of their input files
Diffstat (limited to 'src/codecs/include/opus.hpp')
| -rw-r--r-- | src/codecs/include/opus.hpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/codecs/include/opus.hpp b/src/codecs/include/opus.hpp index 051cd0b9..45b1b07a 100644 --- a/src/codecs/include/opus.hpp +++ b/src/codecs/include/opus.hpp @@ -26,30 +26,21 @@ class XiphOpusDecoder : public ICodec { XiphOpusDecoder(); ~XiphOpusDecoder(); - /* - * 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; + + XiphOpusDecoder(const XiphOpusDecoder&) = delete; + XiphOpusDecoder& operator=(const XiphOpusDecoder&) = delete; private: + std::shared_ptr<IStream> input_; OggOpusFile* opus_; - cpp::span<const std::byte> input_; - size_t pos_in_input_; + uint8_t num_channels_; }; } // namespace codecs |
