GROOVIE: Initial plug in of subtitles to video player

This commit is contained in:
Eugene Sandulenko 2018-05-21 22:39:52 +02:00
parent bb42c9bda4
commit 5e05bacb1c
2 changed files with 17 additions and 0 deletions

View File

@ -950,6 +950,18 @@ bool Script::playvideofromref(uint32 fileref, bool loopUntilAudioDone) {
if (_version == kGroovieCDY && _scriptFile == "26a_graf.grv")
_bitflags |= 1;
_vm->_videoPlayer->load(_videoFile, _bitflags);
// Find correct filename
ResInfo info;
_vm->_resMan->getResInfo(fileref, info);
// Remove the extension and add ".txt"
info.filename.deleteLastChar();
info.filename.deleteLastChar();
info.filename.deleteLastChar();
info.filename += "txt";
_vm->_videoPlayer->loadSubtitles(info.filename.c_str());
} else {
error("Groovie::Script: Couldn't open file");
return true;

View File

@ -23,6 +23,7 @@
#define GROOVIE_VIDEO_PLAYER_H
#include "common/system.h"
#include "video/subtitles.h"
namespace Audio {
class QueuingAudioStream;
@ -48,6 +49,8 @@ public:
virtual void copyfgtobg(uint8 arg) {}
void setOverrideSpeed(bool isOverride);
void loadSubtitles(const char *fname) { _subtitles.loadSRTFile(fname); }
protected:
// To be implemented by subclasses
virtual uint16 loadInternal() = 0;
@ -71,6 +74,8 @@ private:
uint32 _lastFrameTime;
float _frameTimeDrift;
Video::Subtitles _subtitles;
protected:
void waitFrame();
};