Merge pull request #2280 from oioitff/mpeg-fix

Bug fix for scepsmf.
This commit is contained in:
Henrik Rydgård 2013-06-15 12:45:16 -07:00
commit 22a2a03a9d

View File

@ -246,13 +246,11 @@ Psmf::Psmf(u32 data) {
u32 currentStreamAddr = data + 0x82 + i * 16; u32 currentStreamAddr = data + 0x82 + i * 16;
int streamId = Memory::Read_U8(currentStreamAddr); int streamId = Memory::Read_U8(currentStreamAddr);
if ((streamId & PSMF_VIDEO_STREAM_ID) == PSMF_VIDEO_STREAM_ID) { if ((streamId & PSMF_VIDEO_STREAM_ID) == PSMF_VIDEO_STREAM_ID) {
stream = new PsmfStream(PSMF_AVC_STREAM, currentVideoStreamNum); stream = new PsmfStream(PSMF_AVC_STREAM, ++currentVideoStreamNum);
stream->readMPEGVideoStreamParams(currentStreamAddr, this); stream->readMPEGVideoStreamParams(currentStreamAddr, this);
currentVideoStreamNum++;
} else if ((streamId & PSMF_AUDIO_STREAM_ID) == PSMF_AUDIO_STREAM_ID) { } else if ((streamId & PSMF_AUDIO_STREAM_ID) == PSMF_AUDIO_STREAM_ID) {
stream = new PsmfStream(PSMF_ATRAC_STREAM, currentAudioStreamNum); stream = new PsmfStream(PSMF_ATRAC_STREAM, ++currentAudioStreamNum);
stream->readPrivateAudioStreamParams(currentStreamAddr, this); stream->readPrivateAudioStreamParams(currentStreamAddr, this);
currentAudioStreamNum++;
} }
if (stream) { if (stream) {
currentStreamNum++; currentStreamNum++;
@ -452,8 +450,9 @@ u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, u32 streamType)
} }
WARN_LOG(HLE, "scePsmfGetNumberOfSpecificStreams(%08x, %08x)", psmfStruct, streamType); WARN_LOG(HLE, "scePsmfGetNumberOfSpecificStreams(%08x, %08x)", psmfStruct, streamType);
int streamNum = 0; int streamNum = 0;
int type = (streamType == PSMF_AUDIO_STREAM ? PSMF_ATRAC_STREAM : streamType);
for (int i = psmf->streamMap.size() - 1; i >= 0; i--) { for (int i = psmf->streamMap.size() - 1; i >= 0; i--) {
if (psmf->streamMap[i]->type == streamType) if (psmf->streamMap[i]->type == type)
streamNum++; streamNum++;
} }
return streamNum; return streamNum;