24 #include <fvutils/writers/seq_writer.h> 25 #include <core/exceptions/system.h> 52 this->writer = writer;
65 SeqWriter::~SeqWriter()
77 void SeqWriter::set_path(
const char* img_path)
80 this->img_path = strdup(img_path);
81 printf(
"SeqWriter: img path set to %s\n", this->img_path);
89 void SeqWriter::set_filename(
const char* filename)
92 this->filename = strdup(filename);
99 void SeqWriter::set_dimensions(
unsigned int width,
unsigned int height)
101 writer->set_dimensions(width, height);
107 void SeqWriter::set_colorspace(colorspace_t cspace)
109 this->cspace = cspace;
116 void 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,
"%04d%02d%02d_%02d%02d%02d_%06ld", now_tm.tm_year + 1900,
130 now_tm.tm_mon + 1, now_tm.tm_mday, now_tm.tm_hour, now_tm.tm_min,
131 now_tm.tm_sec, now_tv.tv_usec) == -1)
141 if (asprintf(&fn,
"%s/%s_%s-%04u", img_path, timestring, filename, frame_number) == -1)
148 if (asprintf(&fn,
"%s_%s-%04u", timestring, filename, frame_number) == -1)
159 if (asprintf(&fn,
"%s/%s-%04u", img_path, timestring, frame_number) == -1)
166 if (asprintf(&fn,
"%s-%04u", timestring, frame_number) == -1)
173 writer->set_filename(fn);
177 writer->set_buffer(cspace, buffer);
Fawkes library namespace.
Interface to write images.
Base class for exceptions in Fawkes.
System ran out of memory and desired operation could not be fulfilled.