DRAGONS: Free video decoder and handle failure to load video file

This commit is contained in:
Eric Fry 2020-03-09 19:03:33 +11:00
parent 529af3837c
commit bbe0b262e5
2 changed files with 9 additions and 1 deletions

View File

@ -32,7 +32,10 @@ StrPlayer::StrPlayer(DragonsEngine *vm, Screen *screen) : _vm(vm), _screen(scree
void StrPlayer::playVideo(const Common::String &filename) {
bool skipped = false;
_decoder->loadFile(filename);
if (!_decoder->loadFile(filename)) {
error("Error playing video from %s", filename.c_str());
}
_decoder->start();
while (!_vm->shouldQuit() && !_decoder->endOfVideo() && !skipped) {
@ -57,4 +60,8 @@ void StrPlayer::playVideo(const Common::String &filename) {
_decoder->close();
}
StrPlayer::~StrPlayer() {
delete _decoder;
}
} // End of namespace Dragons

View File

@ -35,6 +35,7 @@ private:
Video::VideoDecoder *_decoder;
public:
StrPlayer(DragonsEngine *vm, Screen *screen);
~StrPlayer();
void playVideo(const Common::String &filename);
private: