Skip to content

Commit

Permalink
TITANIC: Update AVISurface to use refactored AVIDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jul 1, 2017
1 parent 2838776 commit e4ba3fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions engines/titanic/support/avi_surface.cpp
Expand Up @@ -55,7 +55,7 @@ AVISurface::AVISurface(const CResourceKey &key) : _movieName(key.getString()) {
if (!_decoder->loadFile(_movieName))
error("Could not open video - %s", key.getString().c_str());

_streamCount = _decoder->videoTrackCount();
_streamCount = _decoder->getTransparencyTrack() ? 2 : 1;

_soundManager = nullptr;
_hasAudio = false;
Expand Down Expand Up @@ -222,7 +222,7 @@ void AVISurface::setVideoSurface(CVideoSurface *surface) {

// Handling for secondary video stream
if (_streamCount == 2) {
const Common::String &streamName = _decoder->getVideoTrack(1).getName();
const Common::String &streamName = _decoder->getTransparencyTrack()->getName();

if (streamName == "mask0") {
_videoSurface->_transparencyMode = TRANS_MASK0;
Expand All @@ -243,7 +243,9 @@ void AVISurface::setupDecompressor() {
return;

for (int idx = 0; idx < _streamCount; ++idx) {
Graphics::PixelFormat format = _decoder->getVideoTrack(idx).getPixelFormat();
Graphics::PixelFormat format = (idx == 0) ?
_decoder->getVideoTrack(0).getPixelFormat() :
_decoder->getTransparencyTrack()->getPixelFormat();
int decoderPitch = _decoder->getWidth() * format.bytesPerPixel;
bool flag = false;

Expand Down
7 changes: 7 additions & 0 deletions engines/titanic/support/avi_surface.h
Expand Up @@ -57,6 +57,13 @@ class AVIDecoder : public Video::AVIDecoder {
* Returns the specified video track
*/
Video::AVIDecoder::AVIVideoTrack &getVideoTrack(uint idx);

/**
* Returns the transparency video track, if present
*/
AVIVideoTrack *getTransparencyTrack() {
return static_cast<AVIVideoTrack *>(_transparencyTrack.track);
}
};

class AVISurface {
Expand Down

0 comments on commit e4ba3fc

Please sign in to comment.