diff options
author | Paul Gilbert | 2014-05-20 08:37:42 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-05-20 08:37:42 -0400 |
commit | 8a08a19097b4338c73dc9456622b75233b9b0194 (patch) | |
tree | ecc7b90f90de253d33bba1a42fcfd7a766139cf6 /common | |
parent | 555b4dfd6e076dd5ef5cfc982fb5dbf3e211d198 (diff) | |
parent | c1890cc739d94c4310ec8933b8fca3f43b8df294 (diff) | |
download | scummvm-rg350-8a08a19097b4338c73dc9456622b75233b9b0194.tar.gz scummvm-rg350-8a08a19097b4338c73dc9456622b75233b9b0194.tar.bz2 scummvm-rg350-8a08a19097b4338c73dc9456622b75233b9b0194.zip |
Merge branch 'master' into mads
Diffstat (limited to 'common')
-rw-r--r-- | common/EventMapper.cpp | 6 | ||||
-rw-r--r-- | common/quicktime.cpp | 43 | ||||
-rw-r--r-- | common/quicktime.h | 9 | ||||
-rw-r--r-- | common/scummsys.h | 5 | ||||
-rw-r--r-- | common/zlib.cpp | 12 |
5 files changed, 56 insertions, 19 deletions
diff --git a/common/EventMapper.cpp b/common/EventMapper.cpp index 84774742c6..30896d7514 100644 --- a/common/EventMapper.cpp +++ b/common/EventMapper.cpp @@ -37,11 +37,17 @@ List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) { #ifdef ENABLE_VKEYBD else if (ev.kbd.keycode == KEYCODE_F7 && ev.kbd.hasFlags(0)) { mappedEvent.type = EVENT_VIRTUAL_KEYBOARD; + + // Avoid blocking F7 events from engine. + addDelayedEvent(100, ev); } #endif #ifdef ENABLE_KEYMAPPER else if (ev.kbd.keycode == KEYCODE_F8 && ev.kbd.hasFlags(0)) { mappedEvent.type = EVENT_KEYMAPPER_REMAP; + + // Avoid blocking F8 events from engine. + addDelayedEvent(100, ev); } #endif } diff --git a/common/quicktime.cpp b/common/quicktime.cpp index 6ab5a42b89..76880e1016 100644 --- a/common/quicktime.cpp +++ b/common/quicktime.cpp @@ -529,7 +529,7 @@ int QuickTimeParser::readSTSD(Atom atom) { _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags uint32 entryCount = _fd->readUint32BE(); - track->sampleDescs.resize(entryCount); + track->sampleDescs.reserve(entryCount); for (uint32 i = 0; i < entryCount; i++) { // Parsing Sample description table Atom a = { 0, 0, 0 }; @@ -541,7 +541,7 @@ int QuickTimeParser::readSTSD(Atom atom) { _fd->readUint16BE(); // reserved _fd->readUint16BE(); // index - track->sampleDescs[i] = readSampleDesc(track, format, size - 16); + track->sampleDescs.push_back(readSampleDesc(track, format, size - 16)); debug(0, "size=%d 4CC= %s codec_type=%d", size, tag2str(format), track->codecType); @@ -692,8 +692,14 @@ int QuickTimeParser::readWAVE(Atom atom) { if (atom.size > (1 << 30)) return -1; - if (track->sampleDescs[0]->getCodecTag() == MKTAG('Q', 'D', 'M', '2')) // Read extra data for QDM2 - track->extraData = _fd->readStream(atom.size); + // We should only get here within an stsd atom + if (track->sampleDescs.empty()) + return -1; + + SampleDesc *sampleDesc = track->sampleDescs.back(); + + if (sampleDesc->getCodecTag() == MKTAG('Q', 'D', 'M', '2')) // Read extra data for QDM2 + sampleDesc->_extraData = _fd->readStream(atom.size); else if (atom.size > 8) return readDefault(atom); else @@ -735,6 +741,12 @@ int QuickTimeParser::readESDS(Atom atom) { Track *track = _tracks.back(); + // We should only get here within an stsd atom + if (track->sampleDescs.empty()) + return -1; + + SampleDesc *sampleDesc = track->sampleDescs.back(); + _fd->readUint32BE(); // version + flags byte tag; @@ -750,7 +762,7 @@ int QuickTimeParser::readESDS(Atom atom) { if (tag != kMP4DecConfigDescTag) return 0; - track->objectTypeMP4 = _fd->readByte(); + sampleDesc->_objectTypeMP4 = _fd->readByte(); _fd->readByte(); // stream type _fd->readUint16BE(); _fd->readByte(); // buffer size _fd->readUint32BE(); // max bitrate @@ -761,9 +773,9 @@ int QuickTimeParser::readESDS(Atom atom) { if (tag != kMP4DecSpecificDescTag) return 0; - track->extraData = _fd->readStream(length); + sampleDesc->_extraData = _fd->readStream(length); - debug(0, "MPEG-4 object type = %02x", track->objectTypeMP4); + debug(0, "MPEG-4 object type = %02x", sampleDesc->_objectTypeMP4); return 0; } @@ -773,8 +785,14 @@ int QuickTimeParser::readSMI(Atom atom) { Track *track = _tracks.back(); + // We should only get here within an stsd atom + if (track->sampleDescs.empty()) + return -1; + + SampleDesc *sampleDesc = track->sampleDescs.back(); + // This atom just contains SVQ3 extra data - track->extraData = _fd->readStream(atom.size); + sampleDesc->_extraData = _fd->readStream(atom.size); return 0; } @@ -794,6 +812,12 @@ void QuickTimeParser::close() { QuickTimeParser::SampleDesc::SampleDesc(Track *parentTrack, uint32 codecTag) { _parentTrack = parentTrack; _codecTag = codecTag; + _extraData = 0; + _objectTypeMP4 = 0; +} + +QuickTimeParser::SampleDesc::~SampleDesc() { + delete _extraData; } QuickTimeParser::Track::Track() { @@ -814,11 +838,9 @@ QuickTimeParser::Track::Track() { codecType = CODEC_TYPE_MOV_OTHER; editCount = 0; editList = 0; - extraData = 0; frameCount = 0; duration = 0; startTime = 0; - objectTypeMP4 = 0; mediaDuration = 0; } @@ -829,7 +851,6 @@ QuickTimeParser::Track::~Track() { delete[] sampleSizes; delete[] keyframes; delete[] editList; - delete extraData; for (uint32 i = 0; i < sampleDescs.size(); i++) delete sampleDescs[i]; diff --git a/common/quicktime.h b/common/quicktime.h index caa92578b1..f5fd578e3a 100644 --- a/common/quicktime.h +++ b/common/quicktime.h @@ -108,10 +108,13 @@ protected: class SampleDesc { public: SampleDesc(Track *parentTrack, uint32 codecTag); - virtual ~SampleDesc() {} + virtual ~SampleDesc(); uint32 getCodecTag() const { return _codecTag; } + SeekableReadStream *_extraData; + byte _objectTypeMP4; + protected: Track *_parentTrack; uint32 _codecTag; @@ -150,16 +153,12 @@ protected: uint32 editCount; EditListEntry *editList; - SeekableReadStream *extraData; - uint32 frameCount; uint32 duration; uint32 mediaDuration; uint32 startTime; Rational scaleFactorX; Rational scaleFactorY; - - byte objectTypeMP4; }; virtual SampleDesc *readSampleDesc(Track *track, uint32 format, uint32 descSize) = 0; diff --git a/common/scummsys.h b/common/scummsys.h index 1342b0cde6..c30bc4a52a 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -405,8 +405,13 @@ typedef unsigned int uint32; typedef signed int int32; typedef unsigned int uint; + #ifdef __PLAYSTATION2__ + typedef signed long int64; + typedef unsigned long uint64; + #else typedef signed long long int64; typedef unsigned long long uint64; + #endif #endif diff --git a/common/zlib.cpp b/common/zlib.cpp index 448e1eadd5..c22ea1e660 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -27,6 +27,7 @@ #include "common/ptr.h" #include "common/util.h" #include "common/stream.h" +#include "common/debug.h" #include "common/textconsole.h" #if defined(USE_ZLIB) @@ -140,6 +141,10 @@ bool inflateZlibInstallShield(byte *dst, uint dstLen, const byte *src, uint srcL return true; } +#ifndef RELEASE_BUILD +static bool _shownBackwardSeekingWarning = false; +#endif + /** * A simple wrapper class which can be used to wrap around an arbitrary * other SeekableReadStream and will then provide on-the-fly decompression support. @@ -159,11 +164,10 @@ protected: uint32 _pos; uint32 _origSize; bool _eos; - bool _shownBackwardSeekingWarning; public: - GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream(), _shownBackwardSeekingWarning(false) { + GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream() { assert(w != 0); // Verify file header is correct @@ -263,13 +267,15 @@ public: // from the start of the file. A rather wasteful operation, best // to avoid it. :/ +#ifndef RELEASE_BUILD if (!_shownBackwardSeekingWarning) { // We only throw this warning once per stream, to avoid // getting the console swarmed with warnings when consecutive // seeks are made. - warning("Backward seeking in GZipReadStream detected"); + debug(1, "Backward seeking in GZipReadStream detected"); _shownBackwardSeekingWarning = true; } +#endif _pos = 0; _wrapped->seek(0, SEEK_SET); |