Remove IsAudioEnd(), use IsNoAudioData() instead.

This commit is contained in:
oioitff 2013-07-02 17:20:46 +08:00
parent 925b3bc702
commit 97c6b96408
4 changed files with 13 additions and 10 deletions

View File

@ -1063,7 +1063,7 @@ int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
} }
// The audio can end earlier than the video does. // The audio can end earlier than the video does.
if (mpegRingbuffer.packetsFree == mpegRingbuffer.packets || (ctx->mediaengine->IsAudioEnd() && !ctx->mediaengine->IsVideoEnd())) { if (mpegRingbuffer.packetsFree == mpegRingbuffer.packets) {
DEBUG_LOG(HLE, "PSP_ERROR_MPEG_NO_DATA=sceMpegGetAtracAu(%08x, %08x, %08x, %08x)", mpeg, streamId, auAddr, attrAddr); DEBUG_LOG(HLE, "PSP_ERROR_MPEG_NO_DATA=sceMpegGetAtracAu(%08x, %08x, %08x, %08x)", mpeg, streamId, auAddr, attrAddr);
// TODO: Does this really delay? // TODO: Does this really delay?
return hleDelayResult(PSP_ERROR_MPEG_NO_DATA, "mpeg get atrac", mpegDecodeErrorDelayMs); return hleDelayResult(PSP_ERROR_MPEG_NO_DATA, "mpeg get atrac", mpegDecodeErrorDelayMs);

View File

@ -1016,7 +1016,7 @@ int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr)
s64 deltapts = psmfplayer->mediaengine->getVideoTimeStamp() - psmfplayer->mediaengine->getAudioTimeStamp(); s64 deltapts = psmfplayer->mediaengine->getVideoTimeStamp() - psmfplayer->mediaengine->getAudioTimeStamp();
int delaytime = 3000; int delaytime = 3000;
if (deltapts > 0 && !psmfplayer->mediaengine->IsAudioEnd()) if (deltapts > 0 && !psmfplayer->mediaengine->IsNoAudioData())
delaytime = deltapts * 1000000 / 90000; delaytime = deltapts * 1000000 / 90000;
if (!ret) if (!ret)
return hleDelayResult(ret, "psmfPlayer video decode", delaytime); return hleDelayResult(ret, "psmfPlayer video decode", delaytime);
@ -1037,7 +1037,7 @@ int scePsmfPlayerGetAudioData(u32 psmfPlayer, u32 audioDataAddr)
Memory::Memset(audioDataAddr, 0, audioSamplesBytes); Memory::Memset(audioDataAddr, 0, audioSamplesBytes);
psmfplayer->mediaengine->getAudioSamples(Memory::GetPointer(audioDataAddr)); psmfplayer->mediaengine->getAudioSamples(Memory::GetPointer(audioDataAddr));
} }
int ret = psmfplayer->mediaengine->IsAudioEnd() ? ERROR_PSMFPLAYER_NO_MORE_DATA : 0; int ret = psmfplayer->mediaengine->IsNoAudioData() ? ERROR_PSMFPLAYER_NO_MORE_DATA : 0;
return hleDelayResult(ret, "psmfPlayer audio decode", 3000); return hleDelayResult(ret, "psmfPlayer audio decode", 3000);
} }

View File

@ -94,7 +94,7 @@ MediaEngine::MediaEngine(): m_pdata(0) {
m_demux = 0; m_demux = 0;
m_audioContext = 0; m_audioContext = 0;
m_isVideoEnd = false; m_isVideoEnd = false;
m_isAudioEnd = false; m_noAudioData = false;
m_bufSize = 0x2000; m_bufSize = 0x2000;
m_mpegheaderReadPos = 0; m_mpegheaderReadPos = 0;
g_iNumVideos++; g_iNumVideos++;
@ -136,7 +136,7 @@ void MediaEngine::closeMedia() {
m_demux = 0; m_demux = 0;
Atrac3plus_Decoder::CloseContext(&m_audioContext); Atrac3plus_Decoder::CloseContext(&m_audioContext);
m_isVideoEnd = false; m_isVideoEnd = false;
m_isAudioEnd = false; m_noAudioData = false;
} }
void MediaEngine::DoState(PointerWrap &p){ void MediaEngine::DoState(PointerWrap &p){
@ -164,7 +164,7 @@ void MediaEngine::DoState(PointerWrap &p){
p.Do(m_audiopts); p.Do(m_audiopts);
p.Do(m_isVideoEnd); p.Do(m_isVideoEnd);
p.Do(m_isAudioEnd); p.Do(m_noAudioData);
p.DoMarker("MediaEngine"); p.DoMarker("MediaEngine");
} }
@ -249,7 +249,7 @@ bool MediaEngine::openContext() {
setVideoDim(); setVideoDim();
m_audioContext = Atrac3plus_Decoder::OpenContext(); m_audioContext = Atrac3plus_Decoder::OpenContext();
m_isVideoEnd = false; m_isVideoEnd = false;
m_isAudioEnd = false; m_noAudioData = false;
m_mpegheaderReadPos++; m_mpegheaderReadPos++;
av_seek_frame(m_pFormatCtx, m_videoStream, 0, 0); av_seek_frame(m_pFormatCtx, m_videoStream, 0, 0);
#endif // USE_FFMPEG #endif // USE_FFMPEG
@ -584,8 +584,10 @@ int MediaEngine::getAudioSamples(u8* buffer) {
u8 *audioFrame = 0; u8 *audioFrame = 0;
int headerCode1, headerCode2; int headerCode1, headerCode2;
int frameSize = m_demux->getNextaudioFrame(&audioFrame, &headerCode1, &headerCode2); int frameSize = m_demux->getNextaudioFrame(&audioFrame, &headerCode1, &headerCode2);
if (frameSize == 0) if (frameSize == 0) {
m_noAudioData = true;
return 0; return 0;
}
int outbytes = 0; int outbytes = 0;
Atrac3plus_Decoder::Decode(m_audioContext, audioFrame, frameSize, &outbytes, buffer); Atrac3plus_Decoder::Decode(m_audioContext, audioFrame, frameSize, &outbytes, buffer);
if (headerCode1 == 0x24) { if (headerCode1 == 0x24) {
@ -599,6 +601,7 @@ int MediaEngine::getAudioSamples(u8* buffer) {
} }
} }
m_audiopts += 4180; m_audiopts += 4180;
m_noAudioData = false;
return 0x2000; return 0x2000;
} }

View File

@ -71,7 +71,7 @@ public:
s64 getLastTimeStamp(); s64 getLastTimeStamp();
bool IsVideoEnd() { return m_isVideoEnd; } bool IsVideoEnd() { return m_isVideoEnd; }
bool IsAudioEnd() { return m_isAudioEnd; } bool IsNoAudioData() { return m_noAudioData; }
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
@ -106,7 +106,7 @@ public:
s64 m_lastTimeStamp; s64 m_lastTimeStamp;
bool m_isVideoEnd; bool m_isVideoEnd;
bool m_isAudioEnd; bool m_noAudioData;
int m_ringbuffersize; int m_ringbuffersize;
u8 m_mpegheader[0x10000]; u8 m_mpegheader[0x10000];