openMSX
AviWriter.hh
Go to the documentation of this file.
1 // Code based on DOSBox-0.65
2 
3 #ifndef AVIWRITER_HH
4 #define AVIWRITER_HH
5 
6 #include "ZMBVEncoder.hh"
7 #include "File.hh"
8 #include "endian.hh"
9 #include <cstdint>
10 #include <vector>
11 
12 namespace openmsx {
13 
14 class Filename;
15 class FrameSource;
16 
17 class AviWriter
18 {
19 public:
20  AviWriter(const Filename& filename, unsigned width, unsigned height,
21  unsigned bpp, unsigned channels, unsigned freq);
22  ~AviWriter();
23  void addFrame(FrameSource* frame, unsigned samples, int16_t* sampleData);
24  void setFps(float fps_) { fps = fps_; }
25 
26 private:
27  void addAviChunk(const char* tag, unsigned size, void* data, unsigned flags);
28 
29  File file;
30  ZMBVEncoder codec;
31  std::vector<Endian::L32> index;
32 
33  float fps;
34  const unsigned width;
35  const unsigned height;
36  const unsigned channels;
37  const unsigned audiorate;
38 
39  unsigned frames;
40  unsigned audiowritten;
41  unsigned written;
42 };
43 
44 } // namespace openmsx
45 
46 #endif
AviWriter(const Filename &filename, unsigned width, unsigned height, unsigned bpp, unsigned channels, unsigned freq)
Definition: AviWriter.cc:17
size_t size(std::string_view utf8)
Interface for getting lines from a video frame.
Definition: FrameSource.hh:14
constexpr const char *const filename
This class represents a filename.
Definition: Filename.hh:17
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void addFrame(FrameSource *frame, unsigned samples, int16_t *sampleData)
Definition: AviWriter.cc:264
void setFps(float fps_)
Definition: AviWriter.hh:24