24 #include <core/exceptions/system.h>
25 #include <fvutils/writers/seq_writer.h>
35 namespace firevision {
48 this->writer = writer;
60 SeqWriter::~SeqWriter()
73 SeqWriter::set_path(
const char *img_path)
76 this->img_path = strdup(img_path);
77 printf(
"SeqWriter: img path set to %s\n", this->img_path);
86 SeqWriter::set_filename(
const char *filename)
89 this->filename = strdup(filename);
97 SeqWriter::set_dimensions(
unsigned int width,
unsigned int height)
99 writer->set_dimensions(width, height);
106 SeqWriter::set_colorspace(colorspace_t cspace)
108 this->cspace = cspace;
116 SeqWriter::write(
unsigned char *buffer)
121 time_t now = time(NULL);
123 struct timeval now_tv;
125 gettimeofday(&now_tv, NULL);
126 localtime_r(&now, &now_tm);
129 if (asprintf(×tring,
130 "%04d%02d%02d_%02d%02d%02d_%06ld",
131 now_tm.tm_year + 1900,
145 if (asprintf(&fn,
"%s/%s_%s-%04u", img_path, timestring, filename, frame_number) == -1) {
149 if (asprintf(&fn,
"%s_%s-%04u", timestring, filename, frame_number) == -1) {
156 if (asprintf(&fn,
"%s/%s-%04u", img_path, timestring, frame_number) == -1) {
160 if (asprintf(&fn,
"%s-%04u", timestring, frame_number) == -1) {
166 writer->set_filename(fn);
170 writer->set_buffer(cspace, buffer);
Base class for exceptions in Fawkes.
System ran out of memory and desired operation could not be fulfilled.
Interface to write images.
Fawkes library namespace.