diff options
| author | 2022-09-17 16:07:33 -0700 | |
|---|---|---|
| committer | 2022-09-17 16:07:33 -0700 | |
| commit | 3a5f9409c897f12e69cfc1d395e743b4850330ec (patch) | |
| tree | 785691226739f4d5369c4d6f4486de91cf73b42e /src | |
| parent | Merge pull request #8827 from german77/amiibo_release (diff) | |
| parent | core: implement HwOpus GetWorkBufferSizeForMultiStreamEx (diff) | |
| download | yuzu-3a5f9409c897f12e69cfc1d395e743b4850330ec.tar.gz yuzu-3a5f9409c897f12e69cfc1d395e743b4850330ec.tar.xz yuzu-3a5f9409c897f12e69cfc1d395e743b4850330ec.zip | |
Merge pull request #8915 from vonchenplus/opus_multi_stream
core: implement HwOpus GetWorkBufferSizeForMultiStreamEx
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/audio/hwopus.cpp | 28 | ||||
| -rw-r--r-- | src/core/hle/service/audio/hwopus.h | 11 |
2 files changed, 38 insertions, 1 deletions
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index 4f2ed2d52..8bafc3a98 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp | |||
| @@ -255,6 +255,32 @@ void HwOpus::GetWorkBufferSizeEx(Kernel::HLERequestContext& ctx) { | |||
| 255 | GetWorkBufferSize(ctx); | 255 | GetWorkBufferSize(ctx); |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | void HwOpus::GetWorkBufferSizeForMultiStreamEx(Kernel::HLERequestContext& ctx) { | ||
| 259 | OpusMultiStreamParametersEx param; | ||
| 260 | std::memcpy(¶m, ctx.ReadBuffer().data(), ctx.GetReadBufferSize()); | ||
| 261 | |||
| 262 | const auto sample_rate = param.sample_rate; | ||
| 263 | const auto channel_count = param.channel_count; | ||
| 264 | const auto number_streams = param.number_streams; | ||
| 265 | const auto number_stereo_streams = param.number_stereo_streams; | ||
| 266 | |||
| 267 | LOG_DEBUG( | ||
| 268 | Audio, | ||
| 269 | "called with sample_rate={}, channel_count={}, number_streams={}, number_stereo_streams={}", | ||
| 270 | sample_rate, channel_count, number_streams, number_stereo_streams); | ||
| 271 | |||
| 272 | ASSERT_MSG(sample_rate == 48000 || sample_rate == 24000 || sample_rate == 16000 || | ||
| 273 | sample_rate == 12000 || sample_rate == 8000, | ||
| 274 | "Invalid sample rate"); | ||
| 275 | |||
| 276 | const u32 worker_buffer_sz = | ||
| 277 | static_cast<u32>(opus_multistream_decoder_get_size(number_streams, number_stereo_streams)); | ||
| 278 | |||
| 279 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 280 | rb.Push(ResultSuccess); | ||
| 281 | rb.Push<u32>(worker_buffer_sz); | ||
| 282 | } | ||
| 283 | |||
| 258 | void HwOpus::OpenHardwareOpusDecoder(Kernel::HLERequestContext& ctx) { | 284 | void HwOpus::OpenHardwareOpusDecoder(Kernel::HLERequestContext& ctx) { |
| 259 | IPC::RequestParser rp{ctx}; | 285 | IPC::RequestParser rp{ctx}; |
| 260 | const auto sample_rate = rp.Pop<u32>(); | 286 | const auto sample_rate = rp.Pop<u32>(); |
| @@ -335,7 +361,7 @@ HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} { | |||
| 335 | {4, &HwOpus::OpenHardwareOpusDecoderEx, "OpenHardwareOpusDecoderEx"}, | 361 | {4, &HwOpus::OpenHardwareOpusDecoderEx, "OpenHardwareOpusDecoderEx"}, |
| 336 | {5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"}, | 362 | {5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"}, |
| 337 | {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"}, | 363 | {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"}, |
| 338 | {7, nullptr, "GetWorkBufferSizeForMultiStreamEx"}, | 364 | {7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"}, |
| 339 | }; | 365 | }; |
| 340 | RegisterHandlers(functions); | 366 | RegisterHandlers(functions); |
| 341 | } | 367 | } |
diff --git a/src/core/hle/service/audio/hwopus.h b/src/core/hle/service/audio/hwopus.h index 265dd0cc6..e6092e290 100644 --- a/src/core/hle/service/audio/hwopus.h +++ b/src/core/hle/service/audio/hwopus.h | |||
| @@ -11,6 +11,16 @@ class System; | |||
| 11 | 11 | ||
| 12 | namespace Service::Audio { | 12 | namespace Service::Audio { |
| 13 | 13 | ||
| 14 | struct OpusMultiStreamParametersEx { | ||
| 15 | u32 sample_rate; | ||
| 16 | u32 channel_count; | ||
| 17 | u32 number_streams; | ||
| 18 | u32 number_stereo_streams; | ||
| 19 | u32 use_large_frame_size; | ||
| 20 | u32 padding; | ||
| 21 | std::array<u32, 64> channel_mappings; | ||
| 22 | }; | ||
| 23 | |||
| 14 | class HwOpus final : public ServiceFramework<HwOpus> { | 24 | class HwOpus final : public ServiceFramework<HwOpus> { |
| 15 | public: | 25 | public: |
| 16 | explicit HwOpus(Core::System& system_); | 26 | explicit HwOpus(Core::System& system_); |
| @@ -21,6 +31,7 @@ private: | |||
| 21 | void OpenHardwareOpusDecoderEx(Kernel::HLERequestContext& ctx); | 31 | void OpenHardwareOpusDecoderEx(Kernel::HLERequestContext& ctx); |
| 22 | void GetWorkBufferSize(Kernel::HLERequestContext& ctx); | 32 | void GetWorkBufferSize(Kernel::HLERequestContext& ctx); |
| 23 | void GetWorkBufferSizeEx(Kernel::HLERequestContext& ctx); | 33 | void GetWorkBufferSizeEx(Kernel::HLERequestContext& ctx); |
| 34 | void GetWorkBufferSizeForMultiStreamEx(Kernel::HLERequestContext& ctx); | ||
| 24 | }; | 35 | }; |
| 25 | 36 | ||
| 26 | } // namespace Service::Audio | 37 | } // namespace Service::Audio |