[CommandHipc(2)] // 3.0.0+ // InitializeForMultiStream(u32, handle<copy>, buffer<unknown<0x110>, 0x19>) -> object<nn::codec::detail::IHardwareOpusDecoder> public ResultCode InitializeForMultiStream(ServiceCtx context) { ulong parametersAddress = context.Request.PtrBuff[0].Position; OpusMultiStreamParameters parameters = context.Memory.Read <OpusMultiStreamParameters>(parametersAddress); MakeObject(context, new IHardwareOpusDecoder(parameters.SampleRate, parameters.ChannelsCount, OpusDecoderFlags.None)); // Close transfer memory immediately as we don't use it. context.Device.System.KernelContext.Syscall.CloseHandle(context.Request.HandleDesc.ToCopy[0]); return(ResultCode.Success); }
[CommandHipc(3)] // 3.0.0+ // GetWorkBufferSizeForMultiStream(buffer<unknown<0x110>, 0x19>) -> u32 public ResultCode GetWorkBufferSizeForMultiStream(ServiceCtx context) { ulong parametersAddress = context.Request.PtrBuff[0].Position; OpusMultiStreamParameters parameters = context.Memory.Read <OpusMultiStreamParameters>(parametersAddress); int opusDecoderSize = GetOpusMultistreamDecoderSize(parameters.NumberOfStreams, parameters.NumberOfStereoStreams); int streamSize = BitUtils.AlignUp(parameters.NumberOfStreams * 1500, 64); int frameSize = BitUtils.AlignUp(parameters.ChannelsCount * 1920 / (48000 / parameters.SampleRate), 64); int totalSize = opusDecoderSize + streamSize + frameSize; context.ResponseData.Write(totalSize); return(ResultCode.Success); }