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
openmsx::MSXMixer
Definition: MSXMixer.hh:30
openmsx::CommandController
Definition: CommandController.hh:18
openmsx::AviRecorder::~AviRecorder
~AviRecorder()
Definition: AviRecorder.cc:38
openmsx::EmuDuration
Definition: EmuDuration.hh:19
openmsx::AviRecorder::stop
void stop()
Definition: AviRecorder.cc:106
openmsx::AviRecorder
Definition: AviRecorder.hh:24
openmsx::AviRecorder::AviRecorder
AviRecorder(Reactor &reactor)
Definition: AviRecorder.cc:28
openmsx::AviRecorder::addWave
void addWave(unsigned num, float *data)
Definition: AviRecorder.cc:126
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:50
openmsx::AviRecorder::getFrameHeight
unsigned getFrameHeight() const
Definition: AviRecorder.cc:199
openmsx::FrameSource
Interface for getting lines from a video frame.
Definition: FrameSource.hh:14
Command.hh
openmsx::Command
Definition: Command.hh:41
openmsx::AviRecorder::addImage
void addImage(FrameSource *frame, EmuTime::param time)
Definition: AviRecorder.cc:174
openmsx::TclObject
Definition: TclObject.hh:22
openmsx::Filename
This class represents a filename.
Definition: Filename.hh:18
openmsx::Interpreter
Definition: Interpreter.hh:17
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5