Add support for initPts in scePsmfPlayerStart().

It won't be super speedy though, could more ideally do it on the calls to
Update()...
This commit is contained in:
Unknown W. Brackets committed 2014-05-11 14:23:13 -07:00
1 parent 5a04fc23a3
commit 9c0bc32f52
4 files changed
+46 -9

No files matched your search

+33 -7
View File
@@ -359,6 +359,28 @@ int MediaEngine::addStreamData(u8* buffer, int addSize) {
return size;
}
bool MediaEngine::seekTo(s64 timestamp, int videoPixelMode) {
if (timestamp <= 0) {
return true;
}
// Just doing it the not so great way to be sure audio is in sync.
int timeout = 1000;
while (getVideoTimeStamp() < timestamp - 3003) {
if (getAudioTimeStamp() < getVideoTimeStamp()) {
getNextAudioFrame(NULL, NULL, NULL);
}
if (!stepVideo(videoPixelMode)) {
return false;
}
if (--timeout <= 0) {
return true;
}
}
return true;
}
bool MediaEngine::setVideoStream(int streamNum, bool force) {
if (m_videoStream == streamNum && !force) {
// Yay, nothing to do.
@@ -733,6 +755,16 @@ int MediaEngine::getAudioRemainSize() {
return m_demux->getRemainSize();
}
int MediaEngine::getNextAudioFrame(u8 **buf, int *headerCode1, int *headerCode2) {
// When getting a frame, increment pts
m_audiopts += 4180;
// Demux now (rather than on add data) so that we select the right stream.
m_demux->demux(m_audioStream);
return m_demux->getNextAudioFrame(buf, headerCode1, headerCode2);
}
int MediaEngine::getAudioSamples(u32 bufferPtr) {
if (!Memory::IsValidAddress(bufferPtr)) {
ERROR_LOG_REPORT(ME, "Ignoring bad audio decode address %08x during video playback", bufferPtr);
@@ -743,15 +775,9 @@ int MediaEngine::getAudioSamples(u32 bufferPtr) {
return 0;
}
// When getting a frame, increment pts
m_audiopts += 4180;
// Demux now (rather than on add data) so that we select the right stream.
m_demux->demux(m_audioStream);
u8 *audioFrame = 0;
int headerCode1, headerCode2;
int frameSize = m_demux->getNextAudioFrame(&audioFrame, &headerCode1, &headerCode2);
int frameSize = getNextAudioFrame(&audioFrame, &headerCode1, &headerCode2);
if (frameSize == 0) {
return 0;
}