summaryrefslogtreecommitdiff
path: root/src/codecs/include/opus.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-08-09 12:00:02 +1000
committerjacqueline <me@jacqueline.id.au>2023-08-09 12:00:02 +1000
commit67caeb6e3cda44205ba8fe783274b20dc7ea216e (patch)
treea2504d177c60e69808073236af8303517cf8fb66 /src/codecs/include/opus.hpp
parent578c3737f8c07e543b90f964da0e89db1c18bb9a (diff)
downloadtangara-fw-67caeb6e3cda44205ba8fe783274b20dc7ea216e.tar.gz
Use opusfile instead of working directly with ogg and opus
Diffstat (limited to 'src/codecs/include/opus.hpp')
-rw-r--r--src/codecs/include/opus.hpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/codecs/include/opus.hpp b/src/codecs/include/opus.hpp
index 50717b73..051cd0b9 100644
--- a/src/codecs/include/opus.hpp
+++ b/src/codecs/include/opus.hpp
@@ -13,9 +13,7 @@
#include <string>
#include <utility>
-#include "ogg.hpp"
-#include "ogg/ogg.h"
-#include "opus.h"
+#include "opusfile.h"
#include "sample.hpp"
#include "span.hpp"
@@ -45,13 +43,13 @@ class XiphOpusDecoder : public ICodec {
auto SeekStream(cpp::span<const std::byte> input, std::size_t target_sample)
-> Result<void> override;
- private:
- OggContainer ogg_;
- OpusDecoder* opus_;
- cpp::span<int16_t> sample_buffer_;
- int32_t pos_in_buffer_;
- int32_t samples_in_buffer_;
+ auto ReadCallback() -> cpp::span<const std::byte>;
+ auto AfterReadCallback(size_t bytes_read) -> void;
+ private:
+ OggOpusFile* opus_;
+ cpp::span<const std::byte> input_;
+ size_t pos_in_input_;
};
} // namespace codecs