1 #include "output-drv.hpp"
9 class output_driver_rawrgbx
: public output_driver
12 output_driver_rawrgbx(const std::string
& filename
)
15 out
= new std::ofstream(filename
.c_str(), std::ios_base::binary
);
19 throw std::runtime_error("Unable to open output file");
20 set_video_callback
<output_driver_rawrgbx
>(*this, &output_driver_rawrgbx::video_callback
);
23 ~output_driver_rawrgbx()
31 const video_settings
& v
= get_video_settings();
32 framesize
= 4 * v
.get_width() * v
.get_height();
35 void video_callback(uint64_t timestamp
, const uint8_t* raw_rgbx_data
)
37 out
->write((const char*)raw_rgbx_data
, framesize
);
39 throw std::runtime_error("Error writing frame to file");
46 class output_driver_rawrgbx_factory
: output_driver_factory
49 output_driver_rawrgbx_factory()
50 : output_driver_factory("rawrgbx")
54 output_driver
& make(const std::string
& type
, const std::string
& name
, const std::string
& parameters
)
57 throw std::runtime_error("rawrgbx output does not take parameters");
58 return *new output_driver_rawrgbx(name
);