Validate and support stream params in psmfplayer.

This commit is contained in:
Unknown W. Brackets 2014-05-11 11:32:24 -07:00
parent 66a480ba95
commit 3205964204

View File

@ -1213,11 +1213,32 @@ int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts)
return ERROR_PSMFPLAYER_INVALID_PARAM;
}
if (psmfplayer->totalAudioStreams > 0) {
if (playerData->audioCodec != 0x0F && playerData->audioCodec != 0x01) {
ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid audio codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->audioCodec);
return ERROR_PSMFPLAYER_INVALID_STREAM;
}
if (playerData->audioStreamNum >= psmfplayer->totalAudioStreams) {
ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change audio stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->audioStreamNum);
return ERROR_PSMFPLAYER_INVALID_CONFIG;
}
}
if (playerData->videoCodec != 0x0E && playerData->videoCodec != 0x00) {
ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid video codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->videoCodec);
return ERROR_PSMFPLAYER_INVALID_STREAM;
}
if (playerData->videoStreamNum < 0 || playerData->videoStreamNum >= psmfplayer->totalVideoStreams) {
ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change video stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->videoStreamNum);
return ERROR_PSMFPLAYER_INVALID_CONFIG;
}
WARN_LOG(ME, "scePsmfPlayerStart(%08x, %08x, %d)", psmfPlayer, psmfPlayerData, initPts);
psmfplayer->mediaengine->setVideoStream(playerData->videoStreamNum);
psmfplayer->videoCodec = playerData->videoCodec;
psmfplayer->videoStreamNum = playerData->videoStreamNum;
if (!psmfplayer->mediaengine->IsNoAudioData()) {
psmfplayer->mediaengine->setAudioStream(playerData->audioStreamNum);
psmfplayer->audioCodec = playerData->audioCodec;
psmfplayer->audioStreamNum = playerData->audioStreamNum;
}