On 16/12/17 18:13, Kieran Bingham wrote:
+void save_raw_frame(IFramebuffer& fb, const char *filename)
+{
+ unique_ptr<ofstream> os;
+ os = unique_ptr<ofstream>(new ofstream(filename, ofstream::binary));
+
+ for (unsigned i = 0; i < fb.num_planes(); ++i)
+ os->write((char*)fb.map(i), fb.size(i));
+}
You don't need any of that unique_ptr stuff here. I needed it as the code needed
to handle the case where we don't save, i.e. os = null.
Ah OK - I thought it was providing the hook up to automatically close the stream
at the end of the function.
I guess an explicit close would be just as clean :)
You don't need an explicit close. The ofstream instance will be
destructed automatically, and thus the stream will be closed.
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki