Implement sceMp3GetSumDecodedSample()

This commit is contained in:
raven02 2013-09-25 11:50:38 +08:00
parent 4cba4efbba
commit 368e4d93f9

View File

@ -59,6 +59,7 @@ struct Mp3Context {
p.Do(mp3PcmBuf);
p.Do(mp3PcmBufSize);
p.Do(mp3DecodedBytes);
p.Do(mp3SumDecodedSamples);
p.Do(mp3LoopNum);
p.Do(mp3MaxSamples);
p.Do(mp3Bitrate);
@ -84,6 +85,7 @@ struct Mp3Context {
int mp3DecodedBytes;
int mp3LoopNum;
int mp3MaxSamples;
int mp3SumDecodedSamples;
MediaEngine *mediaengine;
int mp3Channels;
@ -206,6 +208,8 @@ int sceMp3Decode(u32 mp3, u32 outPcmPtr) {
fclose(file);
}
#endif
// 2 bytes per channel and we always two channels per mp3 so it is 2 * 2
ctx->mp3SumDecodedSamples += bytesdecoded / 2 * 2;
return bytesdecoded;
}
@ -430,7 +434,14 @@ int sceMp3GetMaxOutputSample(u32 mp3)
int sceMp3GetSumDecodedSample(u32 mp3) {
ERROR_LOG_REPORT(ME, "UNIMPL sceMp3GetSumDecodedSample(%08X)", mp3);
return 0;
Mp3Context *ctx = getMp3Ctx(mp3);
if (!ctx) {
ERROR_LOG(ME, "%s: bad mp3 handle %08x", __FUNCTION__, mp3);
return -1;
}
return ctx->mp3SumDecodedSamples;
}
int sceMp3SetLoopNum(u32 mp3, int loop) {