aboutsummaryrefslogtreecommitdiff
path: root/graphics/video/coktel_decoder.cpp
diff options
context:
space:
mode:
authorSven Hesse2011-01-16 16:27:52 +0000
committerSven Hesse2011-01-16 16:27:52 +0000
commitfaa66fc01a343c66b1006e6ee22045770094b7b7 (patch)
tree4d9f2a6606e7b2a56160043bbb33eb7c50ab24b8 /graphics/video/coktel_decoder.cpp
parentafd101c526872272558a8c23f3e2cb67de8da7dc (diff)
downloadscummvm-rg350-faa66fc01a343c66b1006e6ee22045770094b7b7.tar.gz
scummvm-rg350-faa66fc01a343c66b1006e6ee22045770094b7b7.tar.bz2
scummvm-rg350-faa66fc01a343c66b1006e6ee22045770094b7b7.zip
VIDEO: Add color mode methods
To query the video's color mode and notifying the decoder that the system's color mode changed. svn-id: r55259
Diffstat (limited to 'graphics/video/coktel_decoder.cpp')
-rw-r--r--graphics/video/coktel_decoder.cpp62
1 files changed, 48 insertions, 14 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp
index fbbb957dfc..b750660b2d 100644
--- a/graphics/video/coktel_decoder.cpp
+++ b/graphics/video/coktel_decoder.cpp
@@ -211,6 +211,9 @@ void CoktelDecoder::disableSound() {
_audioStream = 0;
}
+void CoktelDecoder::colorModeChanged() {
+}
+
bool CoktelDecoder::getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) {
return false;
}
@@ -231,6 +234,10 @@ int32 CoktelDecoder::getSubtitleIndex() const {
return -1;
}
+bool CoktelDecoder::isPaletted() const {
+ return true;
+}
+
void CoktelDecoder::close() {
disableSound();
freeSurface();
@@ -1523,7 +1530,7 @@ VMDDecoder::VMDDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) :
_soundBytesPerSample(0), _soundStereo(0), _soundHeaderSize(0), _soundDataSize(0),
_audioFormat(kAudioFormat8bitRaw), _hasVideo(false), _videoCodec(0),
_blitMode(0), _bytesPerPixel(0), _firstFramePos(0), _videoBufferSize(0),
- _externalCodec(false), _codec(0), _subtitle(-1) {
+ _externalCodec(false), _codec(0), _subtitle(-1), _isPaletted(true) {
_videoBuffer [0] = 0;
_videoBuffer [1] = 0;
@@ -1582,6 +1589,34 @@ void VMDDecoder::setXY(uint16 x, uint16 y) {
_y = y;
}
+bool VMDDecoder::openExternalCodec() {
+ delete _codec;
+ _codec = 0;
+
+ if (_externalCodec) {
+ if (_videoCodec == kVideoCodecIndeo3) {
+ _isPaletted = false;
+
+#ifdef USE_INDEO3
+ _codec = new Indeo3Decoder(_width, _height);
+#else
+ warning("VMDDecoder::openExternalCodec(): Indeo3 decoder not compiled in");
+#endif
+
+ } else {
+ warning("VMDDecoder::openExternalCodec(): Unknown video codec FourCC \"%s\"",
+ tag2str(_videoCodec));
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void VMDDecoder::colorModeChanged() {
+ openExternalCodec();
+}
+
bool VMDDecoder::load(Common::SeekableReadStream *stream) {
close();
@@ -1703,25 +1738,16 @@ bool VMDDecoder::load(Common::SeekableReadStream *stream) {
}
bool VMDDecoder::assessVideoProperties() {
+ _isPaletted = true;
+
if ((_version & 2) && !(_version & 8)) {
_externalCodec = true;
_videoBufferSize = 0;
} else
_externalCodec = false;
- if (_externalCodec) {
- if (_videoCodec == kVideoCodecIndeo3) {
-#ifdef USE_INDEO3
- _codec = new Indeo3Decoder(_width, _height);
-#else
- warning("VMDDecoder::assessVideoProperties(): Indeo3 decoder not compiled in");
-#endif
- } else {
- warning("VMDDecoder::assessVideoProperties(): Unknown video codec FourCC \"%s\"",
- tag2str(_videoCodec));
- return false;
- }
- }
+ if (!openExternalCodec())
+ return false;
if (_externalCodec)
_blitMode = 0;
@@ -1732,6 +1758,8 @@ bool VMDDecoder::assessVideoProperties() {
_blitMode = n - 1;
_bytesPerPixel = n;
+
+ _isPaletted = false;
}
if ((_bytesPerPixel > 1) && !_externalCodec) {
@@ -1967,6 +1995,8 @@ void VMDDecoder::close() {
_externalCodec = false;
_codec = 0;
+
+ _isPaletted = true;
}
bool VMDDecoder::isVideoLoaded() const {
@@ -2534,6 +2564,10 @@ int32 VMDDecoder::getSubtitleIndex() const {
return _subtitle;
}
+bool VMDDecoder::isPaletted() const {
+ return _isPaletted;
+}
+
} // End of namespace Graphics
#endif // GRAPHICS_VIDEO_COKTELDECODER_H