ScummVM API documentation
player.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GROOVIE_VIDEO_PLAYER_H
23 #define GROOVIE_VIDEO_PLAYER_H
24 
25 #include "common/system.h"
26 #include "video/subtitles.h"
27 
28 namespace Audio {
29 class QueuingAudioStream;
30 }
31 
32 namespace Groovie {
33 
34 class GroovieEngine;
35 
36 class VideoPlayer {
37 public:
39  virtual ~VideoPlayer() {}
40 
41  bool load(Common::SeekableReadStream *file, uint16 flags);
42  bool playFrame();
43  virtual void resetFlags() {}
44  virtual void setOrigin(int16 x, int16 y) {}
45  virtual void stopAudioStream() = 0;
46  void fastForward();
47  bool isFastForwarding();
48  virtual void drawString(Graphics::Surface *surface, const Common::String text, int posx, int posy, uint32 color, bool blackBackground) {}
49  virtual void copyfgtobg(uint8 arg) {}
50  void setOverrideSpeed(bool isOverride);
51 
52  void loadSubtitles(const char *fname) { _subtitles.loadSRTFile(fname); }
53  void unloadSubtitles();
54 
55 protected:
56  // To be implemented by subclasses
57  virtual uint16 loadInternal() = 0;
58  virtual bool playFrameInternal() = 0;
59 
60  bool getOverrideSpeed() const { return _overrideSpeed; }
61 
62  GroovieEngine *_vm;
63  OSystem *_syst;
65  uint16 _flags;
66  Audio::QueuingAudioStream *_audioStream;
67 
68 
69 private:
70  // Synchronization stuff
71  bool _begunPlaying;
72  bool _overrideSpeed;
73  uint16 _fps;
74  float _millisBetweenFrames;
75  uint32 _lastFrameTime;
76  float _frameTimeDrift;
77  uint32 _startTime;
78 
79  Video::Subtitles _subtitles;
80 
81 protected:
82  void waitFrame();
83 };
84 
85 } // End of Groovie namespace
86 
87 #endif // GROOVIE_VIDEO_PLAYER_H
Definition: str.h:59
Definition: surface.h:67
Definition: groovie.h:118
Definition: stream.h:745
Definition: subtitles.h:61
Definition: audiostream.h:370
Definition: player.h:36
Definition: system.h:161
Definition: cursor.h:32
Definition: system.h:38