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