From 6c3501dbcbd1095293d8a4d4b83311e94a7df9a8 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 8 Aug 2023 22:16:31 +1000 Subject: Flesh out opus decoder. it doesn't work! i hate opus. --- src/codecs/include/opus.hpp | 13 +++++++++---- src/codecs/include/types.hpp | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/codecs/include') diff --git a/src/codecs/include/opus.hpp b/src/codecs/include/opus.hpp index a5a7d78c..f824a7cb 100644 --- a/src/codecs/include/opus.hpp +++ b/src/codecs/include/opus.hpp @@ -14,6 +14,7 @@ #include #include "opus.h" +#include "sample.hpp" #include "span.hpp" #include "codec.hpp" @@ -36,14 +37,18 @@ class XiphOpusDecoder : public ICodec { * Writes samples for the current frame. */ auto ContinueStream(cpp::span input, - cpp::span output) + cpp::span output) -> Result override; auto SeekStream(cpp::span input, std::size_t target_sample) -> Result override; private: - OpusDecoder *opus_; - float *sample_buffer_; - std::size_t sample_buffer_len_; + OpusDecoder* opus_; + cpp::span sample_buffer_; + int32_t pos_in_buffer_; + int32_t samples_in_buffer_; + +}; + } // namespace codecs diff --git a/src/codecs/include/types.hpp b/src/codecs/include/types.hpp index 3dfc1da9..2f669448 100644 --- a/src/codecs/include/types.hpp +++ b/src/codecs/include/types.hpp @@ -13,8 +13,8 @@ namespace codecs { enum class StreamType { kMp3, kPcm, - kVorbis, kFlac, + kOpus, }; } // namespace codecs -- cgit v1.2.3