diff options
author | Paul Gilbert | 2015-05-31 14:45:10 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-05-31 14:45:10 -0400 |
commit | e5296ebf8dd09f603499b1894a33865ec71bb28f (patch) | |
tree | d7de032efd54dfdb3159cbc778a0c9ce8cd8aa91 /video/video_decoder.cpp | |
parent | 673537bad93f0b440172a0cc263ebf19cc95ffc0 (diff) | |
parent | 141ff4d08dc24b6bb17098bd71801e2a58e6a38f (diff) | |
download | scummvm-rg350-e5296ebf8dd09f603499b1894a33865ec71bb28f.tar.gz scummvm-rg350-e5296ebf8dd09f603499b1894a33865ec71bb28f.tar.bz2 scummvm-rg350-e5296ebf8dd09f603499b1894a33865ec71bb28f.zip |
Merge branch 'master' into phantom
Diffstat (limited to 'video/video_decoder.cpp')
-rw-r--r-- | video/video_decoder.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp index dce96aae03..217b4c8456 100644 --- a/video/video_decoder.cpp +++ b/video/video_decoder.cpp @@ -47,6 +47,7 @@ VideoDecoder::VideoDecoder() { _endTimeSet = false; _nextVideoTrack = 0; _mainAudioTrack = 0; + _canSetDither = true; // Find the best format for output _defaultHighColorFormat = g_system->getScreenFormat(); @@ -77,6 +78,7 @@ void VideoDecoder::close() { _endTimeSet = false; _nextVideoTrack = 0; _mainAudioTrack = 0; + _canSetDither = true; } bool VideoDecoder::loadFile(const Common::String &filename) { @@ -171,6 +173,7 @@ Graphics::PixelFormat VideoDecoder::getPixelFormat() const { const Graphics::Surface *VideoDecoder::decodeNextFrame() { _needsUpdate = false; + _canSetDither = false; readNextPacket(); @@ -488,6 +491,23 @@ bool VideoDecoder::seekIntern(const Audio::Timestamp &time) { return true; } +bool VideoDecoder::setDitheringPalette(const byte *palette) { + // If a frame was already decoded, we can't set it now. + if (!_canSetDither) + return false; + + bool result = false; + + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) { + if ((*it)->getTrackType() == Track::kTrackTypeVideo && ((VideoTrack *)*it)->canDither()) { + ((VideoTrack *)*it)->setDither(palette); + result = true; + } + } + + return result; +} + VideoDecoder::Track::Track() { _paused = false; } @@ -530,7 +550,9 @@ Audio::Timestamp VideoDecoder::FixedRateVideoTrack::getFrameTime(uint frame) con // (which Audio::Timestamp doesn't support). Common::Rational frameRate = getFrameRate(); - if (frameRate == frameRate.toInt()) // The nice case (a whole number) + // Try to keep it in terms of the frame rate, if the frame rate is a whole + // number. + if (frameRate.getDenominator() == 1) return Audio::Timestamp(0, frame, frameRate.toInt()); // Convert as best as possible |