vitasdk
Documentation of the vitasdk
atrac.h
Go to the documentation of this file.
1 
7 #ifndef _PSP2_ATRAC_H_
8 #define _PSP2_ATRAC_H_
9 
10 #include <vitasdk/build_utils.h>
11 #include <psp2/types.h>
12 #include <psp2/audiodec.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 typedef enum SceAtracErrorCode {
46 
47 /* Memory alignment size */
48 #define SCE_ATRAC_ALIGNMENT_SIZE (SCE_AUDIODEC_ALIGNMENT_SIZE)
49 
50 /* The macro of rounding up the memory size */
51 #define SCE_ATRAC_ROUND_UP(size) ((size + SCE_ATRAC_ALIGNMENT_SIZE - 1) & ~(SCE_ATRAC_ALIGNMENT_SIZE - 1))
52 
53 /* The definition of ATRAC(TM) type */
54 #define SCE_ATRAC_TYPE_AT9 (0x2003U)
55 
56 /* Maximum number of total total channels */
57 #define SCE_ATRAC_AT9_MAX_TOTAL_CH (SCE_AUDIODEC_AT9_MAX_CH_IN_LIBRARY)
58 
59 /* The definition of wordLength */
60 #define SCE_ATRAC_WORD_LENGTH_16BITS (SCE_AUDIODEC_WORD_LENGTH_16BITS)
61 
62 /* Maximum number of channels per stream */
63 #define SCE_ATRAC_AT9_MAX_CH_IN_DECODER (SCE_AUDIODEC_AT9_MAX_CH_IN_DECODER)
64 
65 /* Maximum number of samples */
66 #define SCE_ATRAC_AT9_MAX_FRAME_SAMPLES (SCE_AUDIODEC_AT9_MAX_SAMPLES)
67 
68 /* Maximum number of output samples */
69 #define SCE_ATRAC_MAX_OUTPUT_SAMPLES (2048)
70 
71 /* Maximum number of output frames */
72 #define SCE_ATRAC_AT9_MAX_OUTPUT_FRAMES (8)
73 
74 /* Minimum number of loop samples */
75 #define SCE_ATRAC_AT9_MIN_LOOP_SAMPLES (3072)
76 
77 /* The definition of ATRAC infinite loop */
78 #define SCE_ATRAC_INFINITE_LOOP_NUM (-1)
79 
80 /* The definition of ATRAC infinite samples */
81 #define SCE_ATRAC_INFINITE_SAMPLES (-1)
82 
83 /* The definition of ATRAC decoder status */
84 typedef enum SceAtracDecoderStatus {
90 
91 /* The definition of loop status */
92 typedef enum SceAtracLoopStatus {
96 
97 /* The structure for decoder group */
98 typedef struct {
104 
105 /* Content information structure */
106 typedef struct {
122 
123 /* Stream information structure */
124 typedef struct {
131 
133 
134 int sceAtracCreateDecoderGroup(SceUInt32 atracType, const SceAtracDecoderGroup *pDecoderGroup, void *pvWorkMem, int initAudiodecFlag);
135 
136 int sceAtracDeleteDecoderGroup(SceUInt32 atracType, int termAudiodecFlag);
137 
138 int sceAtracGetDecoderGroupInfo(SceUInt32 atracType, SceAtracDecoderGroup *pCreatedDecoder, SceAtracDecoderGroup *pAvailableDecoder);
139 
140 int sceAtracSetDataAndAcquireHandle(SceUChar8 *pucBuffer, SceUInt32 uiReadSize, SceUInt32 uiBufferSize);
141 
142 int sceAtracReleaseHandle(int atracHandle);
143 
144 int sceAtracDecode(int atracHandle, void *pOutputBuffer, SceUInt32 *pOutputSamples, SceUInt32 *pDecoderStatus);
145 
146 int sceAtracGetStreamInfo(int atracHandle, SceAtracStreamInfo *pStreamInfo);
147 
148 int sceAtracAddStreamData(int atracHandle, SceUInt32 addSize);
149 
150 int sceAtracIsSubBufferNeeded(int atracHandle);
151 
152 int sceAtracGetSubBufferInfo(int atracHandle, SceUInt32 *pReadPosition, SceUInt32 *pMinSubBufferSize, SceUInt32 *pDataSize);
153 
154 int sceAtracSetSubBuffer(int atracHandle, SceUChar8 *pSubBuffer, SceUInt32 subBufferSize);
155 
156 int sceAtracSetLoopNum(int atracHandle, int loopNum);
157 
158 int sceAtracSetOutputSamples(int atracHandle, SceUInt32 outputSamples);
159 
160 int sceAtracResetNextOutputPosition(int atracHandle, SceUInt32 resetSample);
161 
162 int sceAtracGetContentInfo(int atracHandle, SceAtracContentInfo *pContentInfo);
163 
164 int sceAtracGetLoopInfo(int atracHandle, int *pLoopNum, SceUInt32 *pLoopStatus);
165 
166 int sceAtracGetOutputSamples(int atracHandle, SceUInt32 *pOutputSamples);
167 
168 int sceAtracGetNextOutputPosition(int atracHandle, SceUInt32 *pNextOutputSample);
169 
170 int sceAtracGetRemainSamples(int atracHandle, SceLong64 *pRemainSamples);
171 
172 int sceAtracGetOutputableSamples(int atracHandle, SceLong64 *pOutputableSamples);
173 
174 int sceAtracGetDecoderStatus(int atracHandle, SceUInt32 *pDecoderStatus);
175 
176 int sceAtracGetVacantSize(int atracHandle, SceUInt32 *pVacantSize);
177 
178 int sceAtracGetInternalError(int atracHandle, int *pInternalError);
179 
180 #ifdef __cplusplus
181 }
182 #endif
183 
184 #endif /* _PSP2_ATRAC_H_ */
185 
SceUInt32 channel
Definition: atrac.h:109
int sceAtracReleaseHandle(int atracHandle)
int sceAtracCreateDecoderGroup(SceUInt32 atracType, const SceAtracDecoderGroup *pDecoderGroup, void *pvWorkMem, int initAudiodecFlag)
SceUInt32 wordLength
Definition: atrac.h:100
int sceAtracGetDecoderStatus(int atracHandle, SceUInt32 *pDecoderStatus)
SceUInt32 fixedEncBlockSample
Definition: atrac.h:116
int sceAtracSetDataAndAcquireHandle(SceUChar8 *pucBuffer, SceUInt32 uiReadSize, SceUInt32 uiBufferSize)
int sceAtracSetLoopNum(int atracHandle, int loopNum)
int sceAtracGetRemainSamples(int atracHandle, SceLong64 *pRemainSamples)
int sceAtracGetStreamInfo(int atracHandle, SceAtracStreamInfo *pStreamInfo)
SceUInt32 size
Definition: atrac.h:99
SceUInt32 loopBlockOffset
Definition: atrac.h:118
int sceAtracSetOutputSamples(int atracHandle, SceUInt32 outputSamples)
SceUChar8 * pWritePosition
Definition: atrac.h:126
SceUInt32 fixedEncBlockSize
Definition: atrac.h:115
SceUInt32 frameSample
Definition: atrac.h:117
int sceAtracGetLoopInfo(int atracHandle, int *pLoopNum, SceUInt32 *pLoopStatus)
SceUInt32 bitRate
Definition: atrac.h:114
int sceAtracGetNextOutputPosition(int atracHandle, SceUInt32 *pNextOutputSample)
SceUInt32 size
Definition: atrac.h:125
SceInt32 loopStartSample
Definition: atrac.h:112
int sceAtracQueryDecoderGroupMemSize(SceUInt32 atracType, const SceAtracDecoderGroup *pDecoderGroup)
SceInt32 loopEndSample
Definition: atrac.h:113
int sceAtracGetContentInfo(int atracHandle, SceAtracContentInfo *pContentInfo)
SceAtracLoopStatus
Definition: atrac.h:92
int sceAtracDeleteDecoderGroup(SceUInt32 atracType, int termAudiodecFlag)
SceInt32 endSample
Definition: atrac.h:111
int sceAtracResetNextOutputPosition(int atracHandle, SceUInt32 resetSample)
SceUInt32 totalCh
Definition: atrac.h:101
int sceAtracGetOutputSamples(int atracHandle, SceUInt32 *pOutputSamples)
int sceAtracGetDecoderGroupInfo(SceUInt32 atracType, SceAtracDecoderGroup *pCreatedDecoder, SceAtracDecoderGroup *pAvailableDecoder)
VITASDK_BUILD_ASSERT_EQ(0xC, SceAtracDecoderGroup)
int sceAtracGetOutputableSamples(int atracHandle, SceLong64 *pOutputableSamples)
SceUInt32 readPosition
Definition: atrac.h:127
SceUInt32 loopBlockSize
Definition: atrac.h:119
SceUInt32 samplingRate
Definition: atrac.h:110
SceUInt32 writableSize
Definition: atrac.h:128
int sceAtracAddStreamData(int atracHandle, SceUInt32 addSize)
int sceAtracGetVacantSize(int atracHandle, SceUInt32 *pVacantSize)
int sceAtracGetInternalError(int atracHandle, int *pInternalError)
int sceAtracGetSubBufferInfo(int atracHandle, SceUInt32 *pReadPosition, SceUInt32 *pMinSubBufferSize, SceUInt32 *pDataSize)
int sceAtracDecode(int atracHandle, void *pOutputBuffer, SceUInt32 *pOutputSamples, SceUInt32 *pDecoderStatus)
SceUInt32 atracType
Definition: atrac.h:108
SceUInt32 size
Definition: atrac.h:107
int sceAtracSetSubBuffer(int atracHandle, SceUChar8 *pSubBuffer, SceUInt32 subBufferSize)
int sceAtracIsSubBufferNeeded(int atracHandle)
SceAtracErrorCode
Definition: atrac.h:18
SceAtracDecoderStatus
Definition: atrac.h:84
@ SCE_ATRAC_LOOP_STATUS_RESETABLE_PART
Definition: atrac.h:94
@ SCE_ATRAC_LOOP_STATUS_NON_RESETABLE_PART
Definition: atrac.h:93
@ SCE_ATRAC_ERROR_INVALID_LOOP_STATUS
Definition: atrac.h:42
@ SCE_ATRAC_ERROR_SHORTAGE_OF_CH
Definition: atrac.h:27
@ SCE_ATRAC_ERROR_READ_SIZE_IS_TOO_SMALL
Definition: atrac.h:30
@ SCE_ATRAC_ERROR_ALL_DATA_WAS_DECODED
Definition: atrac.h:36
@ SCE_ATRAC_ERROR_ADDED_DATA_IS_TOO_BIG
Definition: atrac.h:38
@ SCE_ATRAC_ERROR_INVALID_DATA
Definition: atrac.h:29
@ SCE_ATRAC_ERROR_INVALID_LOOP_NUM
Definition: atrac.h:44
@ SCE_ATRAC_ERROR_INVALID_WORD_LENGTH
Definition: atrac.h:21
@ SCE_ATRAC_ERROR_NOT_CREATED
Definition: atrac.h:26
@ SCE_ATRAC_ERROR_NO_NEED_SUB_BUFFER
Definition: atrac.h:41
@ SCE_ATRAC_ERROR_INVALID_HANDLE
Definition: atrac.h:31
@ SCE_ATRAC_ERROR_UNSUPPORTED_DATA
Definition: atrac.h:28
@ SCE_ATRAC_ERROR_INVALID_SIZE
Definition: atrac.h:20
@ SCE_ATRAC_ERROR_INVALID_MAX_OUTPUT_SAMPLES
Definition: atrac.h:37
@ SCE_ATRAC_ERROR_READ_SIZE_OVER_BUFFER
Definition: atrac.h:32
@ SCE_ATRAC_ERROR_INVALID_POINTER
Definition: atrac.h:19
@ SCE_ATRAC_ERROR_INVALID_ALIGNMENT
Definition: atrac.h:24
@ SCE_ATRAC_ERROR_DATA_SHORTAGE_IN_BUFFER
Definition: atrac.h:35
@ SCE_ATRAC_ERROR_ALREADY_CREATED
Definition: atrac.h:25
@ SCE_ATRAC_ERROR_MAIN_BUFFER_SIZE_IS_TOO_SMALL
Definition: atrac.h:33
@ SCE_ATRAC_ERROR_INVALID_SAMPLE
Definition: atrac.h:40
@ SCE_ATRAC_ERROR_INVALID_TOTAL_CH
Definition: atrac.h:23
@ SCE_ATRAC_ERROR_REMAIN_VALID_HANDLE
Definition: atrac.h:43
@ SCE_ATRAC_ERROR_SUB_BUFFER_SIZE_IS_TOO_SMALL
Definition: atrac.h:34
@ SCE_ATRAC_ERROR_NEED_SUB_BUFFER
Definition: atrac.h:39
@ SCE_ATRAC_ERROR_INVALID_TYPE
Definition: atrac.h:22
@ SCE_ATRAC_DECODER_STATUS_NONLOOP_PART_IS_ON_MEMORY
Definition: atrac.h:87
@ SCE_ATRAC_DECODER_STATUS_LOOP_PART_IS_ON_MEMORY
Definition: atrac.h:88
@ SCE_ATRAC_DECODER_STATUS_ALL_DATA_WAS_DECODED
Definition: atrac.h:85
@ SCE_ATRAC_DECODER_STATUS_ALL_DATA_IS_ON_MEMORY
Definition: atrac.h:86
Definition: atrac.h:106
Definition: atrac.h:98
Definition: atrac.h:124
int32_t SceInt32
Definition: types.h:44
int64_t SceLong64
Definition: types.h:53
uint32_t SceUInt32
Definition: types.h:45
uint8_t SceUChar8
Definition: types.h:33