openMSX
AviRecorder.hh
Go to the documentation of this file.
1 #ifndef AVIRECORDER_HH
2 #define AVIRECORDER_HH
3 
4 #include "Command.hh"
5 #include "EmuTime.hh"
6 #include "array_ref.hh"
7 #include "noncopyable.hh"
8 #include <vector>
9 #include <memory>
10 
11 namespace openmsx {
12 
13 class Reactor;
14 class AviWriter;
15 class Wav16Writer;
16 class Filename;
17 class PostProcessor;
18 class FrameSource;
19 class MSXMixer;
20 class TclObject;
21 
22 class AviRecorder : private noncopyable
23 {
24 public:
25  explicit AviRecorder(Reactor& reactor);
26  ~AviRecorder();
27 
28  void addWave(unsigned num, short* data);
29  void addImage(FrameSource* frame, EmuTime::param time);
30  void stop();
31  unsigned getFrameHeight() const;
32 
33 private:
34  void start(bool recordAudio, bool recordVideo, bool recordMono,
35  bool recordStereo, const Filename& filename);
36  void status(array_ref<TclObject> tokens, TclObject& result) const;
37 
38  void processStart (array_ref<TclObject> tokens, TclObject& result);
39  void processStop (array_ref<TclObject> tokens);
40  void processToggle(array_ref<TclObject> tokens, TclObject& result);
41 
42  Reactor& reactor;
43 
44  struct Cmd final : Command {
45  Cmd(CommandController& commandController);
46  void execute(array_ref<TclObject> tokens, TclObject& result) override;
47  std::string help(const std::vector<std::string>& tokens) const override;
48  void tabCompletion(std::vector<std::string>& tokens) const override;
49  } recordCommand;
50 
51  std::vector<short> audioBuf;
52  std::unique_ptr<AviWriter> aviWriter; // can be nullptr
53  std::unique_ptr<Wav16Writer> wavWriter; // can be nullptr
54  std::vector<PostProcessor*> postProcessors;
55  MSXMixer* mixer;
56  EmuDuration duration;
57  EmuTime prevTime;
58  unsigned sampleRate;
59  unsigned frameWidth;
60  unsigned frameHeight;
61  bool warnedFps;
62  bool warnedSampleRate;
63  bool warnedStereo;
64  bool stereo;
65 };
66 
67 } // namespace openmsx
68 
69 #endif
unsigned getFrameHeight() const
Definition: AviRecorder.cc:187
Contains the main loop of openMSX.
Definition: Reactor.hh:62
void addWave(unsigned num, short *data)
Definition: AviRecorder.cc:118
Interface for getting lines from a video frame.
Definition: FrameSource.hh:15
This class implements a subset of the proposal for std::array_ref (proposed for the next c++ standard...
Definition: array_ref.hh:19
This class represents a filename.
Definition: Filename.hh:17
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void addImage(FrameSource *frame, EmuTime::param time)
Definition: AviRecorder.cc:162
uint8_t * data()
Based on boost::noncopyable, see boost documentation: http://www.boost.org/libs/utility.
Definition: noncopyable.hh:12
AviRecorder(Reactor &reactor)
Definition: AviRecorder.cc:25