libnx  v4.6.0
hwopus.h
Go to the documentation of this file.
1 /**
2  * @file hwopus.h
3  * @brief Hardware Opus audio service IPC wrapper.
4  * @author yellows8
5  * @copyright libnx Authors
6  */
7 #pragma once
8 
9 #include "../types.h"
10 #include "../sf/service.h"
11 #include "../kernel/tmem.h"
12 
13 typedef struct {
14  Service s;
15  TransferMemory tmem;
16  bool multistream;
18 
19 /// This structure is the start of opusin for \ref hwopusDecodeInterleaved, with the actual opus packet following this.
20 /// These fields are big-endian.
21 typedef struct {
22  u32 size; ///< Size of the packet following this header.
23  u32 final_range; ///< Indicates the final range of the codec encoder's entropy coder. This can be left at zero.
24 } HwopusHeader;
25 
26 /// Used internally.
27 typedef struct {
28  s32 SampleRate;
29  s32 ChannelCount;
30  s32 TotalStreamCount;
31  s32 StereoStreamCount;
32  u8 channel_mapping[256];
34 
35 Result hwopusDecoderInitialize(HwopusDecoder* decoder, s32 SampleRate, s32 ChannelCount);
36 void hwopusDecoderExit(HwopusDecoder* decoder);
37 
38 /// Only available on [3.0.0+].
39 /// See libopus multistream docs.
40 Result hwopusDecoderMultistreamInitialize(HwopusDecoder* decoder, s32 SampleRate, s32 ChannelCount, s32 TotalStreamCount, s32 StereoStreamCount, u8 *channel_mapping);
41 
42 /// Decodes opus data.
43 Result hwopusDecodeInterleaved(HwopusDecoder* decoder, s32 *DecodedDataSize, s32 *DecodedSampleCount, const void* opusin, size_t opusin_size, s16 *pcmbuf, size_t pcmbuf_size);
44 
Result hwopusDecodeInterleaved(HwopusDecoder *decoder, s32 *DecodedDataSize, s32 *DecodedSampleCount, const void *opusin, size_t opusin_size, s16 *pcmbuf, size_t pcmbuf_size)
Decodes opus data.
Result hwopusDecoderMultistreamInitialize(HwopusDecoder *decoder, s32 SampleRate, s32 ChannelCount, s32 TotalStreamCount, s32 StereoStreamCount, u8 *channel_mapping)
Only available on [3.0.0+].
Definition: hwopus.h:13
This structure is the start of opusin for hwopusDecodeInterleaved, with the actual opus packet follow...
Definition: hwopus.h:21
u32 final_range
Indicates the final range of the codec encoder's entropy coder. This can be left at zero.
Definition: hwopus.h:23
u32 size
Size of the packet following this header.
Definition: hwopus.h:22
Used internally.
Definition: hwopus.h:27
Service object structure.
Definition: service.h:14
Transfer memory information structure.
Definition: tmem.h:13
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
int16_t s16
16-bit signed integer.
Definition: types.h:26
u32 Result
Function error code result type.
Definition: types.h:44
int32_t s32
32-bit signed integer.
Definition: types.h:27
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21