mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 15:30:35 +00:00
Bug fix for mpeg.
This commit is contained in:
parent
7bde93d534
commit
b1cc94b9bf
@ -307,6 +307,8 @@ int MediaEngine::addStreamData(u8* buffer, int addSize) {
|
||||
#ifdef USE_FFMPEG
|
||||
if (!m_pFormatCtx) {
|
||||
m_pdata->get_front(m_mpegheader, sizeof(m_mpegheader));
|
||||
int mpegoffset = bswap32(*(int*)(m_mpegheader + 8));
|
||||
m_pdata->pop_front(0, mpegoffset);
|
||||
openContext();
|
||||
}
|
||||
#endif // USE_FFMPEG
|
||||
|
@ -238,7 +238,7 @@ int MpegDemux::getNextaudioFrame(u8** buf, int *headerCode1, int *headerCode2)
|
||||
audioPos = nextHeader;
|
||||
} else
|
||||
audioPos = gotsize;
|
||||
m_audioStream.pop_front(m_audioFrame, audioPos);
|
||||
m_audioStream.pop_front(0, audioPos);
|
||||
*buf = m_audioFrame + 8;
|
||||
if (headerCode1) *headerCode1 = Code1;
|
||||
if (headerCode2) *headerCode2 = Code2;
|
||||
|
@ -18,7 +18,6 @@ public:
|
||||
|
||||
// return its framesize
|
||||
int getNextaudioFrame(u8** buf, int *headerCode1, int *headerCode2);
|
||||
int getFilePosition() { return m_index; }
|
||||
private:
|
||||
struct PesHeader {
|
||||
long pts;
|
||||
@ -53,7 +52,7 @@ private:
|
||||
}
|
||||
int readPesHeader(PesHeader &pesHeader, int length, int startCode);
|
||||
int demuxStream(bool bdemux, int startCode, int channel);
|
||||
|
||||
public:
|
||||
void DoState(PointerWrap &p) {
|
||||
p.Do(m_index);
|
||||
p.Do(m_len);
|
||||
|
@ -77,12 +77,14 @@ namespace Atrac3plus_Decoder {
|
||||
int bytesgot = getQueueSize();
|
||||
if (wantedsize < bytesgot)
|
||||
bytesgot = wantedsize;
|
||||
if (start + bytesgot <= bufQueueSize) {
|
||||
memcpy(buf, bufQueue + start, bytesgot);
|
||||
} else {
|
||||
int size = bufQueueSize - start;
|
||||
memcpy(buf, bufQueue + start, size);
|
||||
memcpy(buf + size, bufQueue, bytesgot - size);
|
||||
if (buf) {
|
||||
if (start + bytesgot <= bufQueueSize) {
|
||||
memcpy(buf, bufQueue + start, bytesgot);
|
||||
} else {
|
||||
int size = bufQueueSize - start;
|
||||
memcpy(buf, bufQueue + start, size);
|
||||
memcpy(buf + size, bufQueue, bytesgot - size);
|
||||
}
|
||||
}
|
||||
start = (start + bytesgot) % bufQueueSize;
|
||||
return bytesgot;
|
||||
|
Loading…
Reference in New Issue
Block a user