aboutsummaryrefslogtreecommitdiff
path: root/image/codecs
diff options
context:
space:
mode:
authorMatthew Hoops2014-05-27 00:09:11 -0400
committerMatthew Hoops2014-05-27 00:09:11 -0400
commit5891ef4d89936917aaa7edf06f5d1fbc06a1271f (patch)
tree1ae5fcd5c7cd3325c49ae50e13c6a602cade26aa /image/codecs
parent53332f8ab879b150883544fb8ea3987bdc190cdf (diff)
downloadscummvm-rg350-5891ef4d89936917aaa7edf06f5d1fbc06a1271f.tar.gz
scummvm-rg350-5891ef4d89936917aaa7edf06f5d1fbc06a1271f.tar.bz2
scummvm-rg350-5891ef4d89936917aaa7edf06f5d1fbc06a1271f.zip
VIDEO: Handle Truemotion dimensions specially
Truemotion uses its own demuxer and seems to follow its own AVI rules. Work around it by coercing the video's dimensions to use the codec's internal dimensions.
Diffstat (limited to 'image/codecs')
-rw-r--r--image/codecs/codec.cpp2
-rw-r--r--image/codecs/truemotion1.cpp19
-rw-r--r--image/codecs/truemotion1.h2
3 files changed, 14 insertions, 9 deletions
diff --git a/image/codecs/codec.cpp b/image/codecs/codec.cpp
index 64acf3f169..6b0c7ebcfb 100644
--- a/image/codecs/codec.cpp
+++ b/image/codecs/codec.cpp
@@ -61,7 +61,7 @@ Codec *createBitmapCodec(uint32 tag, int width, int height, int bitsPerPixel) {
#ifdef IMAGE_CODECS_TRUEMOTION1_H
case MKTAG('D','U','C','K'):
case MKTAG('d','u','c','k'):
- return new TrueMotion1Decoder(width, height);
+ return new TrueMotion1Decoder();
#endif
#ifdef USE_MPEG2
case MKTAG('m','p','g','2'):
diff --git a/image/codecs/truemotion1.cpp b/image/codecs/truemotion1.cpp
index 741b9d51eb..e60ec6c72e 100644
--- a/image/codecs/truemotion1.cpp
+++ b/image/codecs/truemotion1.cpp
@@ -89,11 +89,8 @@ static const CompressionType compressionTypes[17] = {
{ ALGO_RGB24H, 2, 2, BLOCK_2x2 }
};
-TrueMotion1Decoder::TrueMotion1Decoder(uint16 width, uint16 height) {
- _surface = new Graphics::Surface();
- _surface->create(width, height, getPixelFormat());
- _surface->fillRect(Common::Rect(width, height), getPixelFormat().RGBToColor(0, 0, 0));
-
+TrueMotion1Decoder::TrueMotion1Decoder() {
+ _surface = 0;
_vertPred = 0;
_buf = _mbChangeBits = _indexStream = 0;
@@ -101,8 +98,11 @@ TrueMotion1Decoder::TrueMotion1Decoder(uint16 width, uint16 height) {
}
TrueMotion1Decoder::~TrueMotion1Decoder() {
- _surface->free();
- delete _surface;
+ if (_surface) {
+ _surface->free();
+ delete _surface;
+ }
+
delete[] _vertPred;
}
@@ -194,6 +194,11 @@ void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream &stream) {
_vertPred = new uint32[_header.xsize];
}
+ if (!_surface) {
+ _surface = new Graphics::Surface();
+ _surface->create(_header.xsize, _header.ysize, getPixelFormat());
+ }
+
// There is 1 change bit per 4 pixels, so each change byte represents
// 32 pixels; divide width by 4 to obtain the number of change bits and
// then round up to the nearest byte.
diff --git a/image/codecs/truemotion1.h b/image/codecs/truemotion1.h
index bbbcd6d6be..51daf607d2 100644
--- a/image/codecs/truemotion1.h
+++ b/image/codecs/truemotion1.h
@@ -39,7 +39,7 @@ namespace Image {
*/
class TrueMotion1Decoder : public Codec {
public:
- TrueMotion1Decoder(uint16 width, uint16 height);
+ TrueMotion1Decoder();
~TrueMotion1Decoder();
const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream);