diff options
author | Matthew Hoops | 2009-12-31 00:37:40 +0000 |
---|---|---|
committer | Matthew Hoops | 2009-12-31 00:37:40 +0000 |
commit | 85787988a03c247e01596ebbb1386a478ded2df7 (patch) | |
tree | e05fc8c494f1022f5d8320978a6dc454d887bd1b /engines/mohawk/video | |
parent | 5c52ed9f4be95fb68267139a6e329112f234ef2e (diff) | |
download | scummvm-rg350-85787988a03c247e01596ebbb1386a478ded2df7.tar.gz scummvm-rg350-85787988a03c247e01596ebbb1386a478ded2df7.tar.bz2 scummvm-rg350-85787988a03c247e01596ebbb1386a478ded2df7.zip |
Remove the getBeginOffset() hack from Common::SeekableReadStream and introduce QTPlayer::setChunkBeginOffset() to allow specifying what offset to use.
svn-id: r46786
Diffstat (limited to 'engines/mohawk/video')
-rw-r--r-- | engines/mohawk/video/qt_player.cpp | 5 | ||||
-rw-r--r-- | engines/mohawk/video/qt_player.h | 25 | ||||
-rw-r--r-- | engines/mohawk/video/video.cpp | 15 |
3 files changed, 32 insertions, 13 deletions
diff --git a/engines/mohawk/video/qt_player.cpp b/engines/mohawk/video/qt_player.cpp index 9df5a3c930..20fc8c1aa4 100644 --- a/engines/mohawk/video/qt_player.cpp +++ b/engines/mohawk/video/qt_player.cpp @@ -45,6 +45,7 @@ namespace Mohawk { QTPlayer::QTPlayer() : Video() { _audStream = NULL; + _beginOffset = 0; } QTPlayer::~QTPlayer() { @@ -897,10 +898,10 @@ int QTPlayer::readSTCO(MOVatom atom) { return -1; for (uint32 i = 0; i < st->chunk_count; i++) { - // WORKAROUND/HACK: The offsets in Riven videos (aka inside the Mohawk archives themselves) + // WORKAROUND/HACK: The offsets in Riven videos (ones inside the Mohawk archives themselves) // have offsets relative to the archive and not the video. This is quite nasty. We subtract // the initial offset of the stream to get the correct value inside of the stream. - st->chunk_offsets[i] = _fd->readUint32BE() - _fd->getBeginOffset(); + st->chunk_offsets[i] = _fd->readUint32BE() - _beginOffset; } for (uint32 i = 0; i < _numStreams; i++) { diff --git a/engines/mohawk/video/qt_player.h b/engines/mohawk/video/qt_player.h index c40c291767..14aea31ded 100644 --- a/engines/mohawk/video/qt_player.h +++ b/engines/mohawk/video/qt_player.h @@ -84,19 +84,30 @@ public: * @param stream the stream to load */ bool loadFile(Common::SeekableReadStream* stream); - - /** - * Get a packet of A/V data - */ - //VideoPacket getNextPacket(); /** * Close a QuickTime encoded video file */ void closeFile(); + /** + * Returns the downscale mode of the video + * @return the downscale mode of the video + */ ScaleMode getScaleMode(); + + /** + * Returns the palette of the video + * @return the palette of the video + */ byte *getPalette() { return _palette; } + + /** + * Set the beginning offset of the video so we can modify the offsets in the stco + * atom of videos inside the Mohawk archives + * @param the beginning offset of the video + */ + void setChunkBeginOffset(uint32 offset) { _beginOffset = offset; } protected: // This is the file handle from which data is read from. It can be the actual file handle or a decompressed stream. @@ -215,10 +226,12 @@ protected: Common::SeekableReadStream *getNextFramePacket(); void resetInternal(); uint32 getFrameDuration(uint32 frame); + + QueuedAudioStream *_audStream; int8 _videoStreamIndex; int8 _audioStreamIndex; uint _curAudioChunk; - QueuedAudioStream *_audStream; + uint32 _beginOffset; int readDefault(MOVatom atom); int readLeaf(MOVatom atom); diff --git a/engines/mohawk/video/video.cpp b/engines/mohawk/video/video.cpp index f13445d072..d6c6cbcec1 100644 --- a/engines/mohawk/video/video.cpp +++ b/engines/mohawk/video/video.cpp @@ -507,9 +507,12 @@ void VideoManager::playMovie(uint16 id) { if (_mlstRecords[i].code == id) { warning("STUB: Play tMOV %d (non-blocking) at (%d, %d)", _mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top); return; // TODO: This will do a lot of things wrong if enabled right now ;) + QTPlayer *qtPlayer = new QTPlayer(); + qtPlayer->setChunkBeginOffset(_vm->getResourceOffset(ID_TMOV, _mlstRecords[i].movieID)); + qtPlayer->loadFile(_vm->getRawData(ID_TMOV, _mlstRecords[i].movieID)); + VideoEntry entry; - entry.video = new QTPlayer(); - entry->loadFile(_vm->getRawData(ID_TMOV, _mlstRecords[i].movieID)); + entry.video = qtPlayer; entry.x = _mlstRecords[i].left; entry.y = _mlstRecords[i].top; entry.id = _mlstRecords[i].movieID; @@ -529,10 +532,12 @@ void VideoManager::playMovieBlocking(uint16 id) { // TODO: See if a non-blocking movie has been activated with the same id, // and if so, block input until that movie is finished. - + QTPlayer *qtPlayer = new QTPlayer(); + qtPlayer->setChunkBeginOffset(_vm->getResourceOffset(ID_TMOV, _mlstRecords[i].movieID)); + qtPlayer->loadFile(_vm->getRawData(ID_TMOV, _mlstRecords[i].movieID)); + VideoEntry entry; - entry.video = new QTPlayer(); - entry->loadFile(_vm->getRawData(ID_TMOV, _mlstRecords[i].movieID)); + entry.video = qtPlayer; entry.x = _mlstRecords[i].left; entry.y = _mlstRecords[i].top; entry.id = _mlstRecords[i].movieID; |