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