AviRecorder.hh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef AVIRECORDER_HH
  2. #define AVIRECORDER_HH
  3. #include "Command.hh"
  4. #include "EmuTime.hh"
  5. #include "span.hh"
  6. #include <cstdint>
  7. #include <vector>
  8. #include <memory>
  9. namespace openmsx {
  10. class AviWriter;
  11. class Filename;
  12. class FrameSource;
  13. class Interpreter;
  14. class MSXMixer;
  15. class PostProcessor;
  16. class Reactor;
  17. class TclObject;
  18. class Wav16Writer;
  19. class AviRecorder
  20. {
  21. public:
  22. explicit AviRecorder(Reactor& reactor);
  23. ~AviRecorder();
  24. void addWave(unsigned num, float* data);
  25. void addImage(FrameSource* frame, EmuTime::param time);
  26. void stop();
  27. unsigned getFrameHeight() const;
  28. private:
  29. void start(bool recordAudio, bool recordVideo, bool recordMono,
  30. bool recordStereo, const Filename& filename);
  31. void status(span<const TclObject> tokens, TclObject& result) const;
  32. void processStart (Interpreter& interp, span<const TclObject> tokens, TclObject& result);
  33. void processStop (span<const TclObject> tokens);
  34. void processToggle(Interpreter& interp, span<const TclObject> tokens, TclObject& result);
  35. Reactor& reactor;
  36. struct Cmd final : Command {
  37. explicit Cmd(CommandController& commandController);
  38. void execute(span<const TclObject> tokens, TclObject& result) override;
  39. std::string help(const std::vector<std::string>& tokens) const override;
  40. void tabCompletion(std::vector<std::string>& tokens) const override;
  41. } recordCommand;
  42. std::vector<int16_t> audioBuf;
  43. std::unique_ptr<AviWriter> aviWriter; // can be nullptr
  44. std::unique_ptr<Wav16Writer> wavWriter; // can be nullptr
  45. std::vector<PostProcessor*> postProcessors;
  46. MSXMixer* mixer;
  47. EmuDuration duration;
  48. EmuTime prevTime;
  49. unsigned sampleRate;
  50. unsigned frameWidth;
  51. unsigned frameHeight;
  52. bool warnedFps;
  53. bool warnedSampleRate;
  54. bool warnedStereo;
  55. bool stereo;
  56. };
  57. } // namespace openmsx
  58. #endif