| 1 |
|
| 2 |
|
| 3 |
#ifndef AVIWRITER_HH |
| 4 |
#define AVIWRITER_HH |
| 5 |
|
| 6 |
#include "ZMBVEncoder.hh" |
| 7 |
|
| 8 |
#include "File.hh" |
| 9 |
|
| 10 |
#include "endian.hh" |
| 11 |
|
| 12 |
#include <cstdint> |
| 13 |
#include <span> |
| 14 |
#include <string> |
| 15 |
#include <vector> |
| 16 |
|
| 17 |
namespace openmsx { |
| 18 |
|
| 19 |
class FrameSource; |
| 20 |
|
| 21 |
class AviWriter |
| 22 |
{ |
| 23 |
public: |
| 24 |
AviWriter(const std::string& filename, unsigned width, unsigned height, |
| 25 |
unsigned channels, unsigned freq); |
| 26 |
~AviWriter(); |
| 27 |
void addFrame(const FrameSource* video, std::span<const int16_t> audio); |
| 28 |
void setFps(float fps_) { fps = fps_; } |
| 29 |
|
| 30 |
private: |
| 31 |
void addAviChunk(std::span<const char, 4> tag, std::span<const uint8_t> data, unsigned flags); |
| 32 |
|
| 33 |
private: |
| 34 |
File file; |
| 35 |
std::string filename; |
| 36 |
ZMBVEncoder codec; |
| 37 |
std::vector<Endian::L32> index; |
| 38 |
|
| 39 |
float fps = 0.0f; |
| 40 |
const uint32_t width; |
| 41 |
const uint32_t height; |
| 42 |
const uint32_t channels; |
| 43 |
const uint32_t audioRate; |
| 44 |
|
| 45 |
uint32_t frames = 0; |
| 46 |
uint32_t audioWritten = 0; |
| 47 |
uint32_t written = 0; |
| 48 |
}; |
| 49 |
|
| 50 |
} |
| 51 |
|
| 52 |
#endif |