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 <vector>
8 #include <memory>
9 
10 namespace openmsx {
11 
12 class Reactor;
13 class AviWriter;
14 class Wav16Writer;
15 class Filename;
16 class PostProcessor;
17 class FrameSource;
18 class MSXMixer;
19 class TclObject;
20 
22 {
23 public:
24  explicit AviRecorder(Reactor& reactor);
25  ~AviRecorder();
26 
27  void addWave(unsigned num, short* data);
28  void addImage(FrameSource* frame, EmuTime::param time);
29  void stop();
30  unsigned getFrameHeight() const;
31 
32 private:
33  void start(bool recordAudio, bool recordVideo, bool recordMono,
34  bool recordStereo, const Filename& filename);
35  void status(array_ref<TclObject> tokens, TclObject& result) const;
36 
37  void processStart (array_ref<TclObject> tokens, TclObject& result);
38  void processStop (array_ref<TclObject> tokens);
39  void processToggle(array_ref<TclObject> tokens, TclObject& result);
40 
41  Reactor& reactor;
42 
43  struct Cmd final : Command {
44  Cmd(CommandController& commandController);
45  void execute(array_ref<TclObject> tokens, TclObject& result) override;
46  std::string help(const std::vector<std::string>& tokens) const override;
47  void tabCompletion(std::vector<std::string>& tokens) const override;
48  } recordCommand;
49 
50  std::vector<short> audioBuf;
51  std::unique_ptr<AviWriter> aviWriter; // can be nullptr
52  std::unique_ptr<Wav16Writer> wavWriter; // can be nullptr
53  std::vector<PostProcessor*> postProcessors;
54  MSXMixer* mixer;
55  EmuDuration duration;
56  EmuTime prevTime;
57  unsigned sampleRate;
58  unsigned frameWidth;
59  unsigned frameHeight;
60  bool warnedFps;
61  bool warnedSampleRate;
62  bool warnedStereo;
63  bool stereo;
64 };
65 
66 } // namespace openmsx
67 
68 #endif
unsigned getFrameHeight() const
Definition: AviRecorder.cc:187
Contains the main loop of openMSX.
Definition: Reactor.hh:61
void addWave(unsigned num, short *data)
Definition: AviRecorder.cc:118
Interface for getting lines from a video frame.
Definition: FrameSource.hh:14
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()
AviRecorder(Reactor &reactor)
Definition: AviRecorder.cc:25