Can't just do that, might get the vtbl. Arg.

This commit is contained in:
Unknown W. Brackets 2012-12-29 03:19:13 -08:00
parent 7509a2b83a
commit cb0538c4db
3 changed files with 76 additions and 23 deletions

View file

@ -86,8 +86,39 @@ struct StreamInfo
int num;
};
typedef std::map<u32, StreamInfo> StreamInfoMap;
// Internal structure
struct MpegContextSimple {
struct MpegContext {
void DoState(PointerWrap &p) {
p.Do(defaultFrameWidth);
p.Do(videoFrameCount);
p.Do(audioFrameCount);
p.Do(endOfAudioReached);
p.Do(endOfVideoReached);
p.Do(videoPixelMode);
p.Do(mpegMagic);
p.Do(mpegVersion);
p.Do(mpegRawVersion);
p.Do(mpegOffset);
p.Do(mpegStreamSize);
p.Do(mpegFirstTimestamp);
p.Do(mpegLastTimestamp);
p.Do(mpegFirstDate);
p.Do(mpegLastDate);
p.Do(mpegRingbufferAddr);
p.Do(mpegStreamAddr);
p.DoArray(esBuffers, NUM_ES_BUFFERS);
p.Do(avc);
p.Do(avcRegistered);
p.Do(atracRegistered);
p.Do(pcmRegistered);
p.Do(isAnalyzed);
p.Do<StreamInfo>(streamMap);
mediaengine->DoState(p);
p.DoMarker("MpegContext");
}
u32 defaultFrameWidth;
int videoFrameCount;
int audioFrameCount;
@ -113,17 +144,6 @@ struct MpegContextSimple {
bool pcmRegistered;
bool isAnalyzed;
};
typedef std::map<u32, StreamInfo> StreamInfoMap;
struct MpegContext : public MpegContextSimple {
void DoState(PointerWrap &p) {
p.Do<MpegContextSimple>(*this);
p.Do<StreamInfo>(streamMap);
// Media engine has nothing exotic.
p.Do<MediaEngine>(*mediaengine);
p.DoMarker("MpegContext");
}
StreamInfoMap streamMap;
MediaEngine *mediaengine;

View file

@ -56,7 +56,14 @@ class PsmfStream;
// we read it manually.
// TODO: Change to work directly with the data in RAM instead of this
// JPSCP-esque class.
struct PsmfSimple {
typedef std::map<int, PsmfStream *> PsmfStreamMap;
class Psmf {
public:
Psmf(u32 data);
~Psmf();
u32 getNumStreams() { return 2; }
void DoState(PointerWrap &p);
u32 magic;
u32 version;
u32 streamOffset;
@ -82,14 +89,6 @@ struct PsmfSimple {
int videoHeight;
int audioChannels;
int audioFrequency;
};
typedef std::map<int, PsmfStream *> PsmfStreamMap;
class Psmf : public PsmfSimple {
public:
Psmf(u32 data);
~Psmf();
u32 getNumStreams() { return 2; }
void DoState(PointerWrap &p);
PsmfStreamMap streamMap;
};
@ -125,7 +124,8 @@ public:
}
void DoState(PointerWrap &p) {
p.Do<PsmfStream>(*this);
p.Do(type);
p.Do(channel);
}
int type;
@ -178,7 +178,28 @@ Psmf::~Psmf() {
}
void Psmf::DoState(PointerWrap &p) {
p.Do<PsmfSimple>(*this);
p.Do(magic);
p.Do(version);
p.Do(streamOffset);
p.Do(streamSize);
p.Do(headerOffset);
p.Do(streamDataTotalSize);
p.Do(presentationStartTime);
p.Do(presentationEndTime);
p.Do(streamDataNextBlockSize);
p.Do(streamDataNextInnerBlockSize);
p.Do(numStreams);
p.Do(currentStreamNum);
p.Do(currentAudioStreamNum);
p.Do(currentVideoStreamNum);
p.Do(EPMapOffset);
p.Do(EPMapEntriesNum);
p.Do(videoWidth);
p.Do(videoHeight);
p.Do(audioChannels);
p.Do(audioFrequency);
int n = (int) streamMap.size();
p.Do(n);

View file

@ -72,6 +72,18 @@ public:
int readLength() { return readLength_; }
void setReadLength(int len) { readLength_ = len; }
void DoState(PointerWrap &p) {
p.Do(fakeMode_);
p.Do(bufferAddr_);
p.Do(mpegStreamSize_);
p.Do(mpegOffset_);
p.Do(readLength_);
p.Do(videoWidth_);
p.Do(videoHeight_);
p.Do(fakeFrameCounter_);
p.DoMarker("MediaEngine");
}
private:
bool fakeMode_;
u32 bufferAddr_;