ScummVM API documentation
avi_frames.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  * Additional copyright for this file:
8  * Copyright (C) 1995 Presto Studios, Inc.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14 
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19 
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef BURIED_AVI_FRAMES_H
26 #define BURIED_AVI_FRAMES_H
27 
28 #include "common/list.h"
29 #include "common/scummsys.h"
30 #include "common/path.h"
31 
32 namespace Graphics {
33 struct Surface;
34 }
35 
36 namespace Video {
37 class VideoDecoder;
38 }
39 
40 namespace Buried {
41 
42 class AVIFrames {
43 public:
44  AVIFrames(const Common::Path &fileName = Common::Path(), uint cachedFrames = 0);
45  ~AVIFrames();
46 
47  bool open(const Common::Path &fileName, uint cachedFrames = 0);
48  void close();
49 
50  const Graphics::Surface *getFrame(int frameIndex);
51  Graphics::Surface *getFrameCopy(int frameIndex);
52 
53  int getFrameCount();
54 
55  void enableFrameCache(bool enable) { _cacheEnabled = enable; }
56  bool flushFrameCache();
57 
58 private:
59  const Graphics::Surface *retrieveFrameFromCache(int frameIndex) const;
60  void addFrameToCache(int frameIndex, Graphics::Surface *frame);
61 
62  struct CachedFrame {
63  CachedFrame(int i, Graphics::Surface *f) : index(i), frame(f) {}
64 
65  int index;
66  Graphics::Surface *frame;
67  };
68 
70 
71  Common::Path _fileName;
72  FrameList _cachedFrames;
73  uint _maxCachedFrames;
74  Video::VideoDecoder *_video;
75  bool _cacheEnabled;
76 
77  const Graphics::Surface *_lastFrame;
78  Graphics::Surface *_tempFrame;
79  int _lastFrameIndex;
80 };
81 
82 } // End of namespace Buried
83 
84 #endif
Definition: surface.h:67
Definition: avi_frames.h:42
Definition: path.h:52
Definition: agent_evaluation.h:31
Definition: video_decoder.h:52
Definition: formatinfo.h:28
Definition: avi_frames.h:36