summaryrefslogtreecommitdiffstats
path: root/src/audio_core/adsp/apps/opus/opus_decode_object.h
diff options
context:
space:
mode:
authorKelebek1 <eeeedddccc@hotmail.co.uk>2023-08-31 16:09:15 +0200
committerLiam <byteslice@airmail.cc>2023-09-16 17:56:25 +0200
commit67e2d5c28b8423c4f3f1d5b00f87325684158a6f (patch)
treee419a2bb6c064ddc69a49046705b6187772fee48 /src/audio_core/adsp/apps/opus/opus_decode_object.h
parentMerge pull request #11519 from german77/system-policy (diff)
downloadyuzu-67e2d5c28b8423c4f3f1d5b00f87325684158a6f.tar
yuzu-67e2d5c28b8423c4f3f1d5b00f87325684158a6f.tar.gz
yuzu-67e2d5c28b8423c4f3f1d5b00f87325684158a6f.tar.bz2
yuzu-67e2d5c28b8423c4f3f1d5b00f87325684158a6f.tar.lz
yuzu-67e2d5c28b8423c4f3f1d5b00f87325684158a6f.tar.xz
yuzu-67e2d5c28b8423c4f3f1d5b00f87325684158a6f.tar.zst
yuzu-67e2d5c28b8423c4f3f1d5b00f87325684158a6f.zip
Diffstat (limited to 'src/audio_core/adsp/apps/opus/opus_decode_object.h')
-rw-r--r--src/audio_core/adsp/apps/opus/opus_decode_object.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/audio_core/adsp/apps/opus/opus_decode_object.h b/src/audio_core/adsp/apps/opus/opus_decode_object.h
new file mode 100644
index 000000000..6425f987c
--- /dev/null
+++ b/src/audio_core/adsp/apps/opus/opus_decode_object.h
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <opus.h>
+
+#include "common/common_types.h"
+
+namespace AudioCore::ADSP::OpusDecoder {
+using LibOpusDecoder = ::OpusDecoder;
+static constexpr u32 DecodeObjectMagic = 0xDEADBEEF;
+
+class OpusDecodeObject {
+public:
+ static u32 GetWorkBufferSize(u32 channel_count);
+ static OpusDecodeObject& Initialize(u64 buffer, u64 buffer2);
+
+ s32 InitializeDecoder(u32 sample_rate, u32 channel_count);
+ s32 Shutdown();
+ s32 ResetDecoder();
+ s32 Decode(u32& out_sample_count, u64 output_data, u64 output_data_size, u64 input_data,
+ u64 input_data_size);
+ u32 GetFinalRange() const noexcept {
+ return final_range;
+ }
+
+private:
+ u32 magic;
+ bool initialized;
+ bool state_valid;
+ OpusDecodeObject* self;
+ u32 final_range;
+ LibOpusDecoder* decoder;
+};
+static_assert(std::is_trivially_constructible_v<OpusDecodeObject>);
+
+} // namespace AudioCore::ADSP::OpusDecoder