bool Psmf::setStreamWithType(int type, int channel) { for (PsmfStreamMap::iterator iter = streamMap.begin(); iter != streamMap.end(); ++iter) { if (iter->second->type == type && iter->second->channel == channel) { setStreamNum(iter->first); return true; } } return false; }
void Psmf::DoState(PointerWrap &p) { 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); if (p.mode == p.MODE_READ) { // Already empty, if we're reading this is brand new. for (int i = 0; i < n; ++i) { int key; p.Do(key); PsmfStream *stream = new PsmfStream(0, 0); stream->DoState(p); streamMap[key] = stream; } } else { for (auto it = streamMap.begin(), end = streamMap.end(); it != end; ++it) { p.Do(it->first); it->second->DoState(p); } } p.DoMarker("Psmf"); }