VIDEO/GOB: Stubb VMDDecoder

svn-id: r51896
This commit is contained in:
Sven Hesse 2010-08-08 00:56:04 +00:00
parent bab55f3a1d
commit 1f63009426
3 changed files with 129 additions and 4 deletions

View File

@ -679,11 +679,9 @@ Graphics::CoktelDecoder *VideoPlayer::openVideo(const Common::String &file, Prop
else if (properties.type == kVideoTypePreIMD)
video = new Graphics::PreIMDDecoder(properties.width, properties.height, *_vm->_mixer, Audio::Mixer::kSFXSoundType);
else if (properties.type == kVideoTypeVMD)
warning("TODO: VMD");
//_video = new Graphics::Vmd(_vm->_video->_palLUT);
video = new Graphics::VMDDecoder(*_vm->_mixer, Audio::Mixer::kSFXSoundType);
else if (properties.type == kVideoTypeRMD)
warning("TODO: RMD");
//_video = new Graphics::Vmd(_vm->_video->_palLUT);
video = new Graphics::VMDDecoder(*_vm->_mixer, Audio::Mixer::kSFXSoundType);
else
warning("Couldn't open video \"%s\": Invalid video Type", fileName.c_str());

View File

@ -1314,6 +1314,102 @@ PixelFormat IMDDecoder::getPixelFormat() const {
return PixelFormat::createFormatCLUT8();
}
VMDDecoder::VMDDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType) : CoktelDecoder(mixer, soundType),
_stream(0), _videoBuffer(0), _videoBufferSize(0) {
}
VMDDecoder::~VMDDecoder() {
close();
}
bool VMDDecoder::seek(int32 frame, int whence, bool restart) {
if (!isVideoLoaded())
// Nothing to do
return false;
// Find the frame to which to seek
if (whence == SEEK_CUR)
frame += _curFrame;
else if (whence == SEEK_END)
frame = _frameCount - frame - 1;
else if (whence == SEEK_SET)
frame--;
else
return false;
if ((frame < -1) || (((uint32) frame) >= _frameCount))
// Out of range
return false;
if (frame == _curFrame)
// Nothing to do
return true;
// TODO
return true;
}
bool VMDDecoder::load(Common::SeekableReadStream &stream) {
close();
_stream = &stream;
_stream->seek(0);
warning("TODO: VMDDecoder::load()");
return false;
}
void VMDDecoder::close() {
reset();
CoktelDecoder::close();
delete _stream;
delete[] _videoBuffer;
_stream = 0;
_videoBuffer = 0;
_videoBufferSize = 0;
}
bool VMDDecoder::isVideoLoaded() const {
return _stream != 0;
}
Surface *VMDDecoder::decodeNextFrame() {
if (!isVideoLoaded() || endOfVideo())
return 0;
createSurface();
processFrame();
renderFrame();
if (_curFrame == 0)
_startTime = g_system->getMillis();
return &_surface;
}
void VMDDecoder::processFrame() {
_curFrame++;
}
// Just a simple blit
void VMDDecoder::renderFrame() {
}
PixelFormat VMDDecoder::getPixelFormat() const {
return PixelFormat::createFormatCLUT8();
}
} // End of namespace Graphics
#endif // GRAPHICS_VIDEO_COKTELDECODER_H

View File

@ -324,6 +324,37 @@ private:
void emptySoundSlice(bool hasNextCmd);
};
class VMDDecoder : public CoktelDecoder {
public:
VMDDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
~VMDDecoder();
bool seek(int32 frame, int whence = SEEK_SET, bool restart = false);
// VideoDecoder interface
bool load(Common::SeekableReadStream &stream);
void close();
bool isVideoLoaded() const;
Surface *decodeNextFrame();
PixelFormat getPixelFormat() const;
private:
Common::SeekableReadStream *_stream;
// Buffer for processed frame data
byte *_videoBuffer;
uint32 _videoBufferSize;
// Frame decoding
void processFrame();
void renderFrame();
};
} // End of namespace Graphics
#endif // GRAPHICS_VIDEO_COKTELDECODER_H