Evdev joystick plugin
[lsnes.git] / avidump / jmd.hpp
blob2efcc27a73ce13b441451df838585faa96920824
1 #ifndef _jmd__hpp__included__
2 #define _jmd__hpp__included__
4 #include <cstdint>
5 #include <string>
6 #include <fstream>
7 #include <deque>
8 #include <list>
9 #include <vector>
11 class jmd_dumper
13 public:
14 jmd_dumper(const std::string& filename, unsigned level);
15 ~jmd_dumper();
16 void video(uint64_t ts, uint32_t* memory, uint32_t width, uint32_t height);
17 void audio(uint64_t ts, short l, short r);
18 void gameinfo(const std::string& gamename, const std::list<std::pair<std::string, std::string>>&
19 authors, double gametime, const std::string& rerecords);
20 void end(uint64_t ts);
21 private:
22 struct frame_buffer
24 uint64_t ts;
25 std::vector<char> data;
27 struct sample_buffer
29 uint64_t ts;
30 short l;
31 short r;
34 std::deque<frame_buffer> frames;
35 std::deque<sample_buffer> samples;
37 std::vector<char> compress_frame(uint32_t* memory, uint32_t width, uint32_t height);
38 void flush_buffers(bool force);
39 void flush_frame(frame_buffer& f);
40 void flush_sample(sample_buffer& s);
42 std::ofstream jmd;
43 uint64_t last_written_ts;
44 unsigned clevel;
47 #endif