ScummVM API documentation
movie.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 
23 #ifndef GAMOS_MOVIE_H
24 #define GAMOS_MOVIE_H
25 
26 #include "common/file.h"
27 
28 namespace Gamos {
29 
30 class GamosEngine;
31 
32 class MoviePlayer {
33 public:
34 
35  MoviePlayer() {
36  memset(_hdrBytes, 0, sizeof(_hdrBytes));
37  };
38 
39  bool playMovie(Common::File *file, uint32 offset, GamosEngine *gamos);
40 
41 
42 private:
43 
44  bool init(Common::File *file, uint32 offset, GamosEngine *gamos);
45  bool deinit();
46  bool error();
47 
48  int processControlChunk();
49  int processImageChunk();
50  int processPaletteChunk();
51  int processSoundChunk();
52  int proccessMidiChunk();
53 
54  bool readHdr();
55  bool readCompressed(int32 count, Common::Array<byte> *buf);
56 
57  uint8 processMessages(bool keepAct, uint32 *msecs);
58 
59  static byte *blit0(Common::Rect rect, byte *in, Graphics::Surface *surface);
60  static byte *blit1(Common::Rect rect, byte *in, Graphics::Surface *surface);
61  static byte *blit2(Common::Rect rect, byte *in, Graphics::Surface *surface);
62  static byte *blit3(Common::Rect rect, byte *in, Graphics::Surface *surface);
63 
64 
65 
66 private:
67 
68  GamosEngine *_gamos = nullptr;
69  Graphics::Screen *_screen = nullptr;
70  SystemProc *_messageProc = nullptr;
71 
72 
73  bool _doUpdateScreen = false;
74  uint32 _skippedFrames = 0;
75  uint32 _currentFrame = 0;
76  uint32 _firstFrameTime = 0;
77 
78  bool _forceStopMidi = false;
79 
80  int _loopCount = 1;
81  int _loopPoint = 0;
82 
83  Common::Point _pos; /* Movie frame leftup corner */
84  Common::Point _frameSize; /* Sizes of movie frame */
85 
86  int _midiBufferSize = 0;
87  int _soundBufferSize = 0;
88  int _paletteBufferSize = 0;
89  int _bufferSize = 0;
90  int _packedBufferSize = 0;
91  int _frameTime = 0;
92 
93  Common::Array<byte> _midiBuffer;
94  Common::Array<byte> _soundBuffer;
95  Common::Array<byte> _paletteBuffer;
96  Common::Array<byte> _buffer;
97  Common::Array<byte> _packedBuffer;
98 
99  bool _midiStarted = false;
100  bool _soundPlaying = false;
101 
102  Common::File *_file = nullptr;
103 
104  byte _hdrBytes[4];
105  int32 _hdrValue1 = 0;
106  int32 _hdrValue2 = 0;
107 };
108 
109 }
110 
111 #endif //GAMOS_MOVIE_H
Definition: surface.h:67
Definition: rect.h:536
Definition: screen.h:47
Definition: blit.h:28
Definition: movie.h:32
Definition: file.h:47
Definition: gamos.h:376
Definition: rect.h:144
Definition: proc.h:39