Revert "Merge pull request #5106 from shenweip/patch-1"

This reverts commit 91a355b642, reversing
changes made to 82395001ec.
This commit is contained in:
Henrik Rydgard 2014-01-14 19:31:09 +01:00
parent 91a355b642
commit ef56298ab6
3 changed files with 9 additions and 50 deletions

View file

@ -16,7 +16,7 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
// This code is part shamelessly "inspired" from JPCSP.
// This code is part shamelessly "inspired" from JPSCP.
#include <map>
#include <algorithm>
@ -203,7 +203,6 @@ static bool isCurrentMpegAnalyzed;
static int actionPostPut;
static std::map<u32, MpegContext *> mpegMap;
static u32 lastMpegHandle = 0;
static u32 RegisteredMpeg = -1;
MpegContext *getMpegCtx(u32 mpegAddr) {
u32 mpeg = Memory::Read_U32(mpegAddr);
@ -327,7 +326,6 @@ void __MpegInit() {
isCurrentMpegAnalyzed = false;
isMpegInit = false;
actionPostPut = __KernelRegisterActionType(PostPutAction::Create);
RegisteredMpeg = -1;
#ifdef USING_FFMPEG
avcodec_register_all();
@ -336,7 +334,7 @@ void __MpegInit() {
}
void __MpegDoState(PointerWrap &p) {
auto s = p.Section("sceMpeg", 1, 2);
auto s = p.Section("sceMpeg", 1);
if (!s)
return;
@ -345,8 +343,6 @@ void __MpegDoState(PointerWrap &p) {
p.Do(isCurrentMpegAnalyzed);
p.Do(isMpegInit);
p.Do(actionPostPut);
if (s >= 2)
p.Do(RegisteredMpeg);
__KernelRestoreActionType(actionPostPut, PostPutAction::Create);
p.Do(mpegMap);
@ -576,39 +572,6 @@ u32 sceMpegQueryStreamSize(u32 bufferAddr, u32 sizeAddr)
return 0;
}
void setRegisteredMpeg(u32 mpeg) {
RegisteredMpeg = mpeg;
}
u32 getRegisteredMpeg() {
return RegisteredMpeg;
}
void __MpegChangeVideoChannel(int channel) {
u32 mpeg = getRegisteredMpeg();
if (mpeg == (u32)-1)
return;
MpegContext *ctx = getMpegCtx(mpeg);
if (!ctx)
return;
if (ctx->mediaengine->setVideoStream(channel)) {
INFO_LOG(ME,"Change video channel to %d", channel);
} else {
WARN_LOG(ME,"Fail to change video channel to %d", channel);
}
}
void __MpegChangeAudioChannel(int channel) {
u32 mpeg = getRegisteredMpeg();
if (mpeg == (u32)-1)
return;
MpegContext *ctx = getMpegCtx(mpeg);
if (!ctx)
return;
ctx->mediaengine->setAudioStream(channel);
INFO_LOG(ME,"Change audio channel to %d", channel);
}
int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum)
{
MpegContext *ctx = getMpegCtx(mpeg);
@ -619,8 +582,6 @@ int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum)
INFO_LOG(ME, "sceMpegRegistStream(%08x, %i, %i)", mpeg, streamType, streamNum);
setRegisteredMpeg(mpeg);
switch (streamType) {
case MPEG_AVC_STREAM:
ctx->avcRegistered = true;
@ -811,7 +772,6 @@ u32 sceMpegUnRegistStream(u32 mpeg, int streamUid)
info.sid = -1 ;
info.needsReset = true;
ctx->isAnalyzed = false;
setRegisteredMpeg(-1);
return 0;
}
@ -1104,6 +1064,8 @@ int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
return -1;
}
ctx->mediaengine->setVideoStream(streamInfo->second.num);
if (streamInfo->second.needsReset) {
sceAu.pts = 0;
streamInfo->second.needsReset = false;
@ -1183,7 +1145,9 @@ int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
sceAu.pts = 0;
streamInfo->second.needsReset = false;
}
if (streamInfo == ctx->streamMap.end())
if (streamInfo != ctx->streamMap.end())
ctx->mediaengine->setAudioStream(streamInfo->second.num);
else
WARN_LOG_REPORT(ME, "sceMpegGetAtracAu: invalid audio stream %08x", streamId);
// The audio can end earlier than the video does.

View file

@ -97,7 +97,4 @@ void __MpegInit();
void __MpegDoState(PointerWrap &p);
void __MpegShutdown();
void __MpegChangeVideoChannel(int channel);
void __MpegChangeAudioChannel(int channel);
void Register_sceMpeg();

View file

@ -385,8 +385,7 @@ void Psmf::setStreamNum(int num) {
switch (type) {
case PSMF_AVC_STREAM:
if (currentVideoStreamNum != num) {
// Tell video mediaengine about channel.
__MpegChangeVideoChannel(channel);
// TODO: Tell video mediaengine or something about channel.
currentVideoStreamNum = num;
}
break;
@ -394,8 +393,7 @@ void Psmf::setStreamNum(int num) {
case PSMF_ATRAC_STREAM:
case PSMF_PCM_STREAM:
if (currentAudioStreamNum != num) {
// Tell audio mediaengine about channel.
__MpegChangeAudioChannel(channel);
// TODO: Tell audio mediaengine or something about channel.
currentAudioStreamNum = num;
}
break;