summaryrefslogtreecommitdiffstats
path: root/src/audio_core/opus/decoder_manager.h
blob: 466e1967b84cecccf77c11c9a25084343ef56607 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "audio_core/opus/hardware_opus.h"
#include "audio_core/opus/parameters.h"
#include "common/common_types.h"
#include "core/hle/service/audio/errors.h"

namespace Core {
class System;
}

namespace AudioCore::OpusDecoder {

class OpusDecoderManager {
public:
    OpusDecoderManager(Core::System& system);

    HardwareOpus& GetHardwareOpus() {
        return hardware_opus;
    }

    Result GetWorkBufferSize(OpusParameters& params, u64& out_size);
    Result GetWorkBufferSizeEx(OpusParametersEx& params, u64& out_size);
    Result GetWorkBufferSizeExEx(OpusParametersEx& params, u64& out_size);
    Result GetWorkBufferSizeForMultiStream(OpusMultiStreamParameters& params, u64& out_size);
    Result GetWorkBufferSizeForMultiStreamEx(OpusMultiStreamParametersEx& params, u64& out_size);
    Result GetWorkBufferSizeForMultiStreamExEx(OpusMultiStreamParametersEx& params, u64& out_size);

private:
    Core::System& system;
    HardwareOpus hardware_opus;
    std::array<u64, MaxChannels> required_workbuffer_sizes{};
};

} // namespace AudioCore::OpusDecoder