diff --git a/src/mp3/Makefile.am b/src/mp3/Makefile.am index 55c3e85d..1f94a30b 100644 --- a/src/mp3/Makefile.am +++ b/src/mp3/Makefile.am @@ -10,7 +10,10 @@ CPPFLAGS = -I$(top_srcdir)/src/base -I$(top_srcdir)/src/kernel CFLAGS = @PSPSDK_CFLAGS@ CCASFLAGS = $(CFLAGS) -MP3_OBJS = sceMp3_0000.o sceMp3_0001.o sceMp3_0002.o sceMp3_0003.o sceMp3_0004.o sceMp3_0005.o sceMp3_0006.o sceMp3_0007.o sceMp3_0008.o sceMp3_0009.o sceMp3_0010.o sceMp3_0011.o sceMp3_0012.o sceMp3_0013.o sceMp3_0014.o sceMp3_0015.o sceMp3_0016.o sceMp3_0017.o sceMp3_0018.o sceMp3_0019.o +MP3_OBJS = sceMp3_0000.o sceMp3_0001.o sceMp3_0002.o sceMp3_0003.o sceMp3_0004.o sceMp3_0005.o sceMp3_0006.o \ + sceMp3_0007.o sceMp3_0008.o sceMp3_0009.o sceMp3_0010.o sceMp3_0011.o sceMp3_0012.o sceMp3_0013.o \ + sceMp3_0014.o sceMp3_0015.o sceMp3_0016.o sceMp3_0017.o sceMp3_0018.o sceMp3_0019.o sceMp3_0020.o \ + sceMp3_0021.o sceMp3_0022.o sceMp3_0023.o sceMp3_0024.o libpspmp3includedir = @PSPSDK_INCLUDEDIR@ libpspmp3include_HEADERS = pspmp3.h diff --git a/src/mp3/pspmp3.h b/src/mp3/pspmp3.h index 20a87edd..37a9a457 100644 --- a/src/mp3/pspmp3.h +++ b/src/mp3/pspmp3.h @@ -21,19 +21,15 @@ extern "C" { typedef struct SceMp3InitArg { /** Stream start position */ - SceUInt32 mp3StreamStart; - /** Unknown - set to 0 */ - SceUInt32 unk1; + SceOff mp3StreamStart; /** Stream end position */ - SceUInt32 mp3StreamEnd; - /** Unknown - set to 0 */ - SceUInt32 unk2; + SceOff mp3StreamEnd; /** Pointer to a buffer to contain raw mp3 stream data (+1472 bytes workspace) */ - SceVoid* mp3Buf; + SceUChar8* mp3Buf; /** Size of mp3Buf buffer (must be >= 8192) */ SceInt32 mp3BufSize; /** Pointer to decoded pcm samples buffer */ - SceVoid* pcmBuf; + SceUChar8* pcmBuf; /** Size of pcmBuf buffer (must be >= 9216) */ SceInt32 pcmBufSize; } SceMp3InitArg; @@ -135,7 +131,7 @@ SceInt32 sceMp3SetLoopNum(SceInt32 handle, SceInt32 loop); * * @param handle - sceMp3 handle * - * @return Number of loops + * @return Number of loops, < 0 on error. */ SceInt32 sceMp3GetLoopNum(SceInt32 handle); @@ -144,7 +140,7 @@ SceInt32 sceMp3GetLoopNum(SceInt32 handle); * * @param handle - sceMp3 handle * - * @return Number of decoded samples + * @return Number of decoded samples, < 0 on error. */ SceInt32 sceMp3GetSumDecodedSample(SceInt32 handle); @@ -153,7 +149,7 @@ SceInt32 sceMp3GetSumDecodedSample(SceInt32 handle); * * @param handle - sceMp3 handle * - * @return Number of max samples to output + * @return Number of max samples to output, < 0 on error. */ SceInt32 sceMp3GetMaxOutputSample(SceInt32 handle); @@ -162,7 +158,7 @@ SceInt32 sceMp3GetMaxOutputSample(SceInt32 handle); * * @param handle - sceMp3 handle * - * @return Sampling rate of the mp3 + * @return Sampling rate of the mp3, < 0 on error. */ SceInt32 sceMp3GetSamplingRate(SceInt32 handle); @@ -171,7 +167,7 @@ SceInt32 sceMp3GetSamplingRate(SceInt32 handle); * * @param handle - sceMp3 handle * - * @return Bitrate of the mp3 + * @return Bitrate of the mp3, < 0 on error. */ SceInt32 sceMp3GetBitRate(SceInt32 handle); @@ -180,7 +176,7 @@ SceInt32 sceMp3GetBitRate(SceInt32 handle); * * @param handle - sceMp3 handle * - * @return Number of channels of the mp3 + * @return Number of channels of the mp3, < 0 on error. */ SceInt32 sceMp3GetMp3ChannelNum(SceInt32 handle); @@ -189,9 +185,60 @@ SceInt32 sceMp3GetMp3ChannelNum(SceInt32 handle); * * @param handle - sceMp3 handle * - * @return < 0 on error + * @return 0 if success, < 0 on error. */ -SceInt32 sceMp3ResetPlayPosition(SceInt32 handle); +SceInt32 sceMp3ResetPlayPosition(SceInt32 handle); + +/** + * sceMp3GetFrameNum + * + * @param handle - sceMp3 handle + * + * @return Number of audio frames, < 0 on error + */ +SceInt32 sceMp3GetFrameNum(SceInt32 handle); + +/** + * sceMp3ResetPlayPositionByFrame + * + * @param handle - sceMp3 handle + * @param frame - frame + * + * @return 0 if success, < 0 on error. + */ +SceInt32 sceMp3ResetPlayPositionByFrame(SceInt32 handle, SceUInt32 frame); + +/** + * sceMp3GetMPEGVersion + * + * @param handle - sceMp3 handle + * + * @return MPEG Version, < 0 on error + */ +SceInt32 sceMp3GetMPEGVersion(SceInt32 handle); + +/** + * sceMp3LowLevelInit + * + * @param handle - sceMp3 handle + * @param src - Pointer to a buffer to contain raw mp3 stream data + * + * @return 0 if success, < 0 on error. + */ +SceInt32 sceMp3LowLevelInit(SceInt32 handle, SceUChar8* src); + +/** + * sceMp3LowLevelDecode + * + * @param handle - sceMp3 handle + * @param mp3src - Pointer to a buffer to contain raw mp3 stream data + * @param mp3srcused - mp3 data size consumed by decoding + * @param pcmdst - Pointer to destination pcm samples buffer + * @param pcmdstoutsz - Size of pcm data output by decoding + * + * @return 0 if success, < 0 on error. + */ +SceInt32 sceMp3LowLevelDecode(SceInt32 handle, SceUChar8* mp3src, SceUInt32* mp3srcused, SceShort16* pcmdst, SceUInt32* pcmdstoutsz); #ifdef __cplusplus diff --git a/src/mp3/sceMp3.S b/src/mp3/sceMp3.S index 72419781..76561cb7 100644 --- a/src/mp3/sceMp3.S +++ b/src/mp3/sceMp3.S @@ -65,3 +65,18 @@ #ifdef F_sceMp3_0019 IMPORT_FUNC "sceMp3",0xF5478233,sceMp3ReleaseMp3Handle #endif +#ifdef F_sceMp3_0020 + IMPORT_FUNC "sceMp3",0xAE6D2027,sceMp3GetMPEGVersion +#endif +#ifdef F_sceMp3_0021 + IMPORT_FUNC "sceMp3",0x3548AEC8,sceMp3GetFrameNum +#endif +#ifdef F_sceMp3_0022 + IMPORT_FUNC "sceMp3",0x0840E808,sceMp3ResetPlayPositionByFrame +#endif +#ifdef F_sceMp3_0023 + IMPORT_FUNC "sceMp3",0x1B839B83,sceMp3LowLevelInit +#endif +#ifdef F_sceMp3_0024 + IMPORT_FUNC "sceMp3",0xE3EE2C81,sceMp3LowLevelDecode +#endif diff --git a/src/samples/mp3/main.c b/src/samples/mp3/main.c index 028776b9..7801b632 100644 --- a/src/samples/mp3/main.c +++ b/src/samples/mp3/main.c @@ -172,8 +172,6 @@ int main(int argc, char *argv[]) SceMp3InitArg mp3Init; mp3Init.mp3StreamStart = 0; mp3Init.mp3StreamEnd = sceIoLseek32( fd, 0, SEEK_END ); - mp3Init.unk1 = 0; - mp3Init.unk2 = 0; mp3Init.mp3Buf = mp3Buf; mp3Init.mp3BufSize = sizeof(mp3Buf); mp3Init.pcmBuf = pcmBuf;