Make sceMpegChangeGetAuMode() operate more sanely.

I'm pretty sure this is what the intention was before, but it still
doesn't do anything useful (since ignore* are... ignored.)
This commit is contained in:
Unknown W. Brackets 2015-03-01 09:26:53 -08:00
parent f312925374
commit d49010832c

View File

@ -1646,13 +1646,20 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode)
MpegContext *ctx = getMpegCtx(mpeg);
if (!ctx) {
WARN_LOG(ME, "sceMpegChangeGetAuMode(%08x, %i, %i): bad mpeg handle", mpeg, streamUid, mode);
return -1;
return ERROR_MPEG_INVALID_VALUE;
}
if (mode != MPEG_AU_MODE_DECODE && mode != MPEG_AU_MODE_SKIP) {
ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): bad mode", mpeg, streamUid, mode);
return ERROR_MPEG_INVALID_VALUE;
}
// NOTE: Where is the info supposed to come from?
StreamInfo info = {0};
info.sid = streamUid;
if (info.sid) {
auto stream = ctx->streamMap.find(streamUid);
if (stream == ctx->streamMap.end()) {
ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode);
return ERROR_MPEG_INVALID_VALUE;
} else {
StreamInfo &info = stream->second;
DEBUG_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): changing type=%d", mpeg, streamUid, mode, info.type);
switch (info.type) {
case MPEG_AVC_STREAM:
if (mode == MPEG_AU_MODE_DECODE) {
@ -1677,11 +1684,9 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode)
}
break;
default:
ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i): unknown streamID", mpeg, streamUid);
ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode);
break;
}
} else {
ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i): unknown streamID", mpeg, streamUid);
}
return 0;
}