diff options
author | Matthew Hoops | 2012-09-12 20:18:13 -0400 |
---|---|---|
committer | Matthew Hoops | 2012-09-12 20:18:13 -0400 |
commit | d5ed8b1901b88e361a2a420a9daf586f6089a36b (patch) | |
tree | d19e4dd7baf33b7447d69d8ad8d3c25732a69698 /video | |
parent | ff51a7661d7a2cb296b987edfc3d81727160e627 (diff) | |
parent | 8808393b3a3428df2946d7967e52aba084c8ffe5 (diff) | |
download | scummvm-rg350-d5ed8b1901b88e361a2a420a9daf586f6089a36b.tar.gz scummvm-rg350-d5ed8b1901b88e361a2a420a9daf586f6089a36b.tar.bz2 scummvm-rg350-d5ed8b1901b88e361a2a420a9daf586f6089a36b.zip |
Merge remote branch 'upstream/master' into pegasus
Conflicts:
AUTHORS
Diffstat (limited to 'video')
-rw-r--r-- | video/bink_decoder.cpp | 22 | ||||
-rw-r--r-- | video/bink_decoder.h | 2 | ||||
-rw-r--r-- | video/video_decoder.cpp | 21 | ||||
-rw-r--r-- | video/video_decoder.h | 8 |
4 files changed, 27 insertions, 26 deletions
diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp index 620316806f..30632cdd6c 100644 --- a/video/bink_decoder.cpp +++ b/video/bink_decoder.cpp @@ -260,7 +260,23 @@ BinkDecoder::BinkVideoTrack::BinkVideoTrack(uint32 width, uint32 height, const G _colHighHuffman[i].symbols[j] = j; } - _surface.create(width, height, format); + // Make the surface even-sized: + _surfaceHeight = height; + _surfaceWidth = width; + + if (height & 1) { + _surfaceHeight++; + } + if (width & 1) { + _surfaceWidth++; + } + + _surface.create(_surfaceWidth, _surfaceHeight, format); + // Since we over-allocate to make surfaces even-sized + // we need to set the actual VIDEO size back into the + // surface. + _surface.h = height; + _surface.w = width; // Give the planes a bit extra space width = _surface.w + 32; @@ -329,9 +345,11 @@ void BinkDecoder::BinkVideoTrack::decodePacket(VideoFrame &frame) { // Convert the YUV data we have to our format // We're ignoring alpha for now + // The width used here is the surface-width, and not the video-width + // to allow for odd-sized videos. assert(_curPlanes[0] && _curPlanes[1] && _curPlanes[2]); Graphics::convertYUV420ToRGB(&_surface, _curPlanes[0], _curPlanes[1], _curPlanes[2], - _surface.w, _surface.h, _surface.w, _surface.w >> 1); + _surfaceWidth, _surfaceHeight, _surfaceWidth, _surfaceWidth >> 1); // And swap the planes with the reference planes for (int i = 0; i < 4; i++) diff --git a/video/bink_decoder.h b/video/bink_decoder.h index 150e91aab7..27d3aa3691 100644 --- a/video/bink_decoder.h +++ b/video/bink_decoder.h @@ -231,6 +231,8 @@ private: int _frameCount; Graphics::Surface _surface; + int _surfaceWidth; ///< The actual surface width + int _surfaceHeight; ///< The actual surface height uint32 _id; ///< The BIK FourCC. diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp index c9d3d22070..24287c4d33 100644 --- a/video/video_decoder.cpp +++ b/video/video_decoder.cpp @@ -35,7 +35,6 @@ namespace Video { VideoDecoder::VideoDecoder() { _startTime = 0; - _needsRewind = false; _dirtyPalette = false; _palette = 0; _isPlaying = false; @@ -62,7 +61,6 @@ void VideoDecoder::close() { delete *it; _tracks.clear(); - _needsRewind = false; _dirtyPalette = false; _palette = 0; _startTime = 0; @@ -271,8 +269,6 @@ bool VideoDecoder::rewind() { if (!isRewindable()) return false; - _needsRewind = false; - // Stop all tracks so they can be rewound if (isPlaying()) stopAudio(); @@ -306,8 +302,6 @@ bool VideoDecoder::seek(const Audio::Timestamp &time) { if (!isSeekable()) return false; - _needsRewind = false; - // Stop all tracks so they can be seeked if (isPlaying()) stopAudio(); @@ -337,10 +331,6 @@ void VideoDecoder::start() { _isPlaying = true; _startTime = g_system->getMillis(); - // If someone previously called stop(), we'll rewind it. - if (_needsRewind) - rewind(); - // Adjust start time if we've seeked to something besides zero time if (_lastTimeChange.totalNumberOfFrames() != 0) _startTime -= _lastTimeChange.msecs(); @@ -363,15 +353,8 @@ void VideoDecoder::stop() { // Also reset the pause state. _pauseLevel = 0; - // If this is a rewindable video, don't close it too. We'll just rewind() the video - // the next time someone calls start(). Otherwise, since it can't be rewound, we - // just close it. - if (isRewindable()) { - _lastTimeChange = getTime(); - _needsRewind = true; - } else { - close(); - } + // Keep the time marked down in case we start up again + _lastTimeChange = getTime(); } Audio::Timestamp VideoDecoder::getDuration() const { diff --git a/video/video_decoder.h b/video/video_decoder.h index daf78c227a..66980ab09b 100644 --- a/video/video_decoder.h +++ b/video/video_decoder.h @@ -102,16 +102,14 @@ public: /** * Begin playback of the video. * - * @note This has no effect is the video is already playing. + * @note This has no effect if the video is already playing. */ void start(); /** * Stop playback of the video. * - * @note This will close() the video if it is not rewindable. - * @note If the video is rewindable, the video will be rewound on the - * next start() call unless rewind() or seek() is called before then. + * @note This has no effect if the video is not playing. */ void stop(); @@ -765,7 +763,7 @@ private: TrackList _tracks; // Current playback status - bool _isPlaying, _needsRewind, _needsUpdate; + bool _isPlaying, _needsUpdate; Audio::Timestamp _lastTimeChange, _endTime; bool _endTimeSet; |