aboutsummaryrefslogtreecommitdiff
path: root/video/qt_decoder.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2012-04-15 16:00:01 -0400
committerMatthew Hoops2012-04-15 16:00:01 -0400
commit19d634389dc92c32112b13807b6a266ede7c0422 (patch)
treec7e19c7bb64d402316ea34d2b403160554ec24f8 /video/qt_decoder.cpp
parent586d9bf32fed9bc2009dcf890a0b714e1e618c2c (diff)
downloadscummvm-rg350-19d634389dc92c32112b13807b6a266ede7c0422.tar.gz
scummvm-rg350-19d634389dc92c32112b13807b6a266ede7c0422.tar.bz2
scummvm-rg350-19d634389dc92c32112b13807b6a266ede7c0422.zip
VIDEO: Create the QuickTime scaled surface after reading in a frame
Fixes issues where the codec hasn't been initialized
Diffstat (limited to 'video/qt_decoder.cpp')
-rw-r--r--video/qt_decoder.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index df839610a1..0d80c93a1f 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -152,7 +152,13 @@ const Graphics::Surface *QuickTimeDecoder::decodeNextFrame() {
// (needs to be done after we find the next track)
updateAudioBuffer();
- if (_scaledSurface) {
+ // We have to initialize the scaled surface
+ if (frame && (_scaleFactorX != 1 || _scaleFactorY != 1)) {
+ if (!_scaledSurface) {
+ _scaledSurface = new Graphics::Surface();
+ _scaledSurface->create(_width, _height, getPixelFormat());
+ }
+
scaleSurface(frame, _scaledSurface, _scaleFactorX, _scaleFactorY);
return _scaledSurface;
}
@@ -258,14 +264,10 @@ void QuickTimeDecoder::init() {
_nextVideoTrack = findNextVideoTrack();
if (_nextVideoTrack) {
- // Initialize the scaled surface
if (_scaleFactorX != 1 || _scaleFactorY != 1) {
- // We have to initialize the scaled surface
- _scaledSurface = new Graphics::Surface();
- _scaledSurface->create((_nextVideoTrack->getWidth() / _scaleFactorX).toInt(),
- (_nextVideoTrack->getHeight() / _scaleFactorY).toInt(), getPixelFormat());
- _width = _scaledSurface->w;
- _height = _scaledSurface->h;
+ // We have to take the scale into consideration when setting width/height
+ _width = (_nextVideoTrack->getWidth() / _scaleFactorX).toInt();
+ _height = (_nextVideoTrack->getHeight() / _scaleFactorY).toInt();
} else {
_width = _nextVideoTrack->getWidth().toInt();
_height = _nextVideoTrack->getHeight().toInt();
@@ -527,19 +529,12 @@ void QuickTimeDecoder::AudioTrackHandler::seekToTime(Audio::Timestamp time) {
}
QuickTimeDecoder::VideoTrackHandler::VideoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent) : TrackHandler(decoder, parent) {
- if (_parent->scaleFactorX != 1 || _parent->scaleFactorY != 1) {
- _scaledSurface = new Graphics::Surface();
- _scaledSurface->create(getWidth().toInt(), getHeight().toInt(), getPixelFormat());
- } else {
- _scaledSurface = 0;
- }
-
enterNewEditList(false);
_holdNextFrameStartTime = false;
_curFrame = -1;
_durationOverride = -1;
-
+ _scaledSurface = 0;
}
QuickTimeDecoder::VideoTrackHandler::~VideoTrackHandler() {
@@ -576,7 +571,12 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame()
enterNewEditList(true);
}
- if (_scaledSurface) {
+ if (frame && (_parent->scaleFactorX != 1 || _parent->scaleFactorY != 1)) {
+ if (!_scaledSurface) {
+ _scaledSurface = new Graphics::Surface();
+ _scaledSurface->create(getWidth().toInt(), getHeight().toInt(), getPixelFormat());
+ }
+
_decoder->scaleSurface(frame, _scaledSurface, _parent->scaleFactorX, _parent->scaleFactorY);
return _scaledSurface;
}