PSP2SDK
dirty-f9e4f2d
The free SDK for PSP2
|
00001 00012 #ifndef _PSP2_AUDIOENC_H_ 00013 #define _PSP2_AUDIOENC_H_ 00014 00015 #include <psp2/types.h> 00016 #include <stdint.h> 00017 00018 #ifdef __cplusplus 00019 extern "C" { 00020 #endif 00021 00022 enum { 00023 SCE_AUDIOENC_ERROR_API_FAIL = 0x80860000, 00024 SCE_AUDIOENC_ERROR_INVALID_TYPE = 0x80860001, 00025 SCE_AUDIOENC_ERROR_INVALID_INIT_PARAM = 0x80860002, 00026 SCE_AUDIOENC_ERROR_ALREADY_INITIALIZED = 0x80860003, 00027 SCE_AUDIOENC_ERROR_OUT_OF_MEMORY = 0x80860004, 00028 SCE_AUDIOENC_ERROR_NOT_INITIALIZED = 0x80860005, 00029 SCE_AUDIOENC_ERROR_A_HANDLE_IN_USE = 0x80860006, 00030 SCE_AUDIOENC_ERROR_ALL_HANDLES_IN_USE = 0x80860007, 00031 SCE_AUDIOENC_ERROR_INVALID_PTR = 0x80860008, 00032 SCE_AUDIOENC_ERROR_INVALID_HANDLE = 0x80860009, 00033 SCE_AUDIOENC_ERROR_NOT_HANDLE_IN_USE = 0x8086000A, 00034 SCE_AUDIOENC_ERROR_CH_SHORTAGE = 0x8086000B, 00035 SCE_AUDIOENC_ERROR_INVALID_WORD_LENGTH = 0x8086000C, 00036 SCE_AUDIOENC_ERROR_INVALID_SIZE = 0x8086000D, 00037 SCE_AUDIOENC_ERROR_INVALID_ALIGNMENT = 0x8086000E 00038 }; 00039 00040 enum { 00041 SCE_AUDIOENC_CELP_ERROR_INVALID_CONFIG = 0x80861001, 00042 }; 00043 00044 #define PSP2_AUDIOENC_WORD_LENGTH_16BITS 16 //!< Definition of wordlength 00045 00046 #define PSP2_AUDIOENC_TYPE_CELP 0x2006U //!< Audio encoder type 00047 00048 #define PSP2_AUDIOENC_CELP_MAX_STREAMS 1 //!< Max number of streams 00049 #define PSP2_AUDIOENC_CELP_MAX_SAMPLES 320 //!< Max number of samples 00050 #define PSP2_AUDIOENC_CELP_MAX_ES_SIZE 24 //!< Max elementary stream size 00051 00052 #define PSP2_AUDIOENC_CELP_MPE (0) //!< CELP encoder default excitation mode 00053 00054 #define PSP2_AUDIOENC_CELP_SAMPLING_RATE_8KHZ (8000) //!< CELP encoder default sampling rate 00055 00056 enum { 00057 PSP2_AUDIOENC_CELP_BIT_RATE_3850BPS = 3850, 00058 PSP2_AUDIOENC_CELP_BIT_RATE_4650BPS = 4650, 00059 PSP2_AUDIOENC_CELP_BIT_RATE_5700BPS = 5700, 00060 PSP2_AUDIOENC_CELP_BIT_RATE_7300BPS = 7300 00061 }; 00062 00064 typedef struct SceAudioencInitStreamParam { 00065 SceSize size; 00066 unsigned int totalStreams; 00067 } SceAudioencInitStreamParam; 00068 00070 typedef struct SceAudioencInfoCelp { 00071 SceSize size; 00072 unsigned int excitationMode; 00073 unsigned int samplingRate; 00074 unsigned int bitRate; 00075 } SceAudioencInfoCelp; 00076 00078 typedef struct SceAudioencOptInfoCelp { 00079 SceSize size; 00080 uint8_t header[32]; 00081 SceSize headerSize; 00082 unsigned int encoderVersion; 00083 } SceAudioencOptInfoCelp; 00084 00086 typedef union SceAudioencInitParam { 00087 SceSize size; 00088 SceAudioencInitStreamParam celp; 00089 } SceAudioencInitParam; 00090 00092 typedef union SceAudioencInfo { 00093 SceSize size; 00094 SceAudioencInfoCelp celp; 00095 } SceAudioencInfo; 00096 00098 typedef union SceAudioencOptInfo { 00099 SceSize size; 00100 SceAudioencOptInfoCelp celp; 00101 } SceAudioencOptInfo; 00102 00103 typedef struct SceAudioencCtrl { 00104 SceSize size; 00105 int handle; 00106 void *pInputPcm; 00107 SceSize inputPcmSize; 00108 SceSize maxPcmSize; 00109 void *pOutputEs; 00110 SceSize outputEsSize; 00111 SceSize maxEsSize; 00112 SceSize wordLength; 00113 SceAudioencInfo *pInfo; 00114 SceAudioencOptInfo *pOptInfo; 00115 } SceAudioencCtrl; 00116 00117 int sceAudioencInitLibrary(int codecType, SceAudioencInitParam *pInitParam); 00118 int sceAudioencTermLibrary(unsigned int codecType); 00119 int sceAudioencCreateEncoder(SceAudioencCtrl *pCtrl, int codecType); 00120 int sceAudioencDeleteEncoder(SceAudioencCtrl *pCtrl); 00121 int sceAudioencEncode(SceAudioencCtrl *pCtrl); 00122 int sceAudioencClearContext(SceAudioencCtrl *pCtrl); 00123 int sceAudioencGetOptInfo(SceAudioencCtrl *pCtrl); 00124 int sceAudioencGetInternalError(SceAudioencCtrl *pCtrl, int *pInternalError); 00125 00126 #ifdef __cplusplus 00127 } 00128 #endif 00129 00130 #endif /* _PSP2_AUDIOENC_H_ */