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