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