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(const std::vector<std::string>& 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
openmsx::MSXMixer
Definition: MSXMixer.hh:30
openmsx::CommandController
Definition: CommandController.hh:19
openmsx::AviRecorder::~AviRecorder
~AviRecorder()
Definition: AviRecorder.cc:39
openmsx::EmuDuration
Definition: EmuDuration.hh:19
openmsx::AviRecorder::stop
void stop()
Definition: AviRecorder.cc:107
openmsx::AviRecorder
Definition: AviRecorder.hh:24
openmsx::AviRecorder::AviRecorder
AviRecorder(Reactor &reactor)
Definition: AviRecorder.cc:29
openmsx::AviRecorder::addWave
void addWave(unsigned num, float *data)
Definition: AviRecorder.cc:127
span
Definition: span.hh:126
openmsx::Reactor
Contains the main loop of openMSX.
Definition: Reactor.hh:67
openmsx::filename
constexpr const char *const filename
Definition: FirmwareSwitch.cc:10
span.hh
EmuTime.hh
openmsx::Filename
Filename
Definition: Filename.cc:35
openmsx::AviRecorder::getFrameHeight
unsigned getFrameHeight() const
Definition: AviRecorder.cc:200
openmsx::FrameSource
Interface for getting lines from a video frame.
Definition: FrameSource.hh:15
Command.hh
openmsx::Command
Definition: Command.hh:41
openmsx::AviRecorder::addImage
void addImage(FrameSource *frame, EmuTime::param time)
Definition: AviRecorder.cc:175
openmsx::TclObject
Definition: TclObject.hh:24
openmsx::Filename
This class represents a filename.
Definition: Filename.hh:18
openmsx::Interpreter
Definition: Interpreter.hh:19
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5