]> git.sesse.net Git - nageru/blobdiff - pbo_frame_allocator.cpp
Add functionality for MJPEG export.
[nageru] / pbo_frame_allocator.cpp
index ea17f1259fde4076320c9ebdb37da6c714a6c5f3..c8687025e2f2f1d5dc0d193a07035b01e272f970 100644 (file)
@@ -52,6 +52,7 @@ void PBOFrameAllocator::init_frame(size_t frame_idx, size_t frame_size, GLuint w
        Frame frame;
        frame.data = (uint8_t *)glMapBufferRange(buffer, 0, frame_size, permissions | map_bits | GL_MAP_PERSISTENT_BIT);
        frame.data2 = frame.data + frame_size / 2;
+       frame.data_copy = new uint8_t[frame_size];
        check_error();
        frame.size = frame_size;
        frame.userdata = &userdata[frame_idx];
@@ -214,6 +215,8 @@ PBOFrameAllocator::~PBOFrameAllocator()
 
 void PBOFrameAllocator::destroy_frame(Frame *frame)
 {
+       delete[] frame->data_copy;
+
        GLuint pbo = ((Userdata *)frame->userdata)->pbo;
        glBindBuffer(buffer, pbo);
        check_error();