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  [[nodiscard]] 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 private:
44  Reactor& reactor;
45 
46  struct Cmd final : Command {
47  explicit Cmd(CommandController& commandController);
48  void execute(span<const TclObject> tokens, TclObject& result) override;
49  [[nodiscard]] std::string help(span<const TclObject> tokens) const override;
50  void tabCompletion(std::vector<std::string>& tokens) const override;
51  } recordCommand;
52 
53  std::vector<int16_t> audioBuf;
54  std::unique_ptr<AviWriter> aviWriter; // can be nullptr
55  std::unique_ptr<Wav16Writer> wavWriter; // can be nullptr
56  std::vector<PostProcessor*> postProcessors;
57  MSXMixer* mixer;
58  EmuDuration duration;
59  EmuTime prevTime;
60  unsigned sampleRate;
61  unsigned frameWidth;
62  unsigned frameHeight;
63  bool warnedFps;
64  bool warnedSampleRate;
65  bool warnedStereo;
66  bool stereo;
67 };
68 
69 } // namespace openmsx
70 
71 #endif
void addImage(FrameSource *frame, EmuTime::param time)
Definition: AviRecorder.cc:171
void addWave(unsigned num, float *data)
Definition: AviRecorder.cc:123
AviRecorder(Reactor &reactor)
Definition: AviRecorder.cc:25
unsigned getFrameHeight() const
Definition: AviRecorder.cc:196
This class represents a filename.
Definition: Filename.hh:18
Interface for getting lines from a video frame.
Definition: FrameSource.hh:16
Contains the main loop of openMSX.
Definition: Reactor.hh:68
Definition: span.hh:126
This file implemented 3 utility functions:
Definition: Autofire.cc:9
constexpr const char *const filename