summaryrefslogtreecommitdiffstats
path: root/src/audio_core/opus/decoder.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/opus/decoder.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 '')
-rw-r--r--src/audio_core/opus/decoder.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/audio_core/opus/decoder.h b/src/audio_core/opus/decoder.h
new file mode 100644
index 000000000..d08d8a4a4
--- /dev/null
+++ b/src/audio_core/opus/decoder.h
@@ -0,0 +1,53 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <span>
+
+#include "audio_core/opus/parameters.h"
+#include "common/common_types.h"
+#include "core/hle/kernel/k_transfer_memory.h"
+#include "core/hle/service/audio/errors.h"
+
+namespace Core {
+class System;
+}
+
+namespace AudioCore::OpusDecoder {
+class HardwareOpus;
+
+class OpusDecoder {
+public:
+ explicit OpusDecoder(Core::System& system, HardwareOpus& hardware_opus_);
+ ~OpusDecoder();
+
+ Result Initialize(OpusParametersEx& params, Kernel::KTransferMemory* transfer_memory,
+ u64 transfer_memory_size);
+ Result Initialize(OpusMultiStreamParametersEx& params, Kernel::KTransferMemory* transfer_memory,
+ u64 transfer_memory_size);
+ Result DecodeInterleaved(u32* out_data_size, u64* out_time_taken, u32* out_sample_count,
+ std::span<const u8> input_data, std::span<u8> output_data, bool reset);
+ Result SetContext([[maybe_unused]] std::span<const u8> context);
+ Result DecodeInterleavedForMultiStream(u32* out_data_size, u64* out_time_taken,
+ u32* out_sample_count, std::span<const u8> input_data,
+ std::span<u8> output_data, bool reset);
+
+private:
+ Core::System& system;
+ HardwareOpus& hardware_opus;
+ std::unique_ptr<u8[]> shared_buffer{};
+ u64 shared_buffer_size;
+ std::span<u8> in_data{};
+ std::span<u8> out_data{};
+ u64 buffer_size{};
+ s32 sample_rate{};
+ s32 channel_count{};
+ bool use_large_frame_size{false};
+ s32 total_stream_count{};
+ s32 stereo_stream_count{};
+ bool shared_memory_mapped{false};
+ bool decode_object_initialized{false};
+};
+
+} // namespace AudioCore::OpusDecoder