]> git.sesse.net Git - nageru/blobdiff - pbo_frame_allocator.h
Re-run IWYU, again with lots of manual cleanup.
[nageru] / pbo_frame_allocator.h
index 825d01f5034429db4a0f8a1baa2e67a31f3f3cbe..452c006bd2d36c290de9cd456b4c4edbf4b87b85 100644 (file)
@@ -2,10 +2,12 @@
 #define _PBO_FRAME_ALLOCATOR 1
 
 #include <epoxy/gl.h>
+#include <stddef.h>
+#include <memory>
 #include <mutex>
 #include <queue>
 
-#include "bmusb.h"
+#include "bmusb/bmusb.h"
 
 // An allocator that allocates straight into OpenGL pinned memory.
 // Meant for video frames only. We use a queue rather than a stack,
@@ -15,13 +17,19 @@ public:
        // Note: You need to have an OpenGL context when calling
        // the constructor.
        PBOFrameAllocator(size_t frame_size,
+                         GLuint width, GLuint height,
                          size_t num_queued_frames = 16,  // FIXME: should be 6
                          GLenum buffer = GL_PIXEL_UNPACK_BUFFER_ARB,
                          GLenum permissions = GL_MAP_WRITE_BIT,
                          GLenum map_bits = GL_MAP_FLUSH_EXPLICIT_BIT);
        ~PBOFrameAllocator() override;
-        Frame alloc_frame() override;
-        void release_frame(Frame frame) override;
+       Frame alloc_frame() override;
+       void release_frame(Frame frame) override;
+
+       struct Userdata {
+               GLuint pbo;
+               GLuint tex_y, tex_cbcr;
+       };
 
 private:
        size_t frame_size;
@@ -29,6 +37,7 @@ private:
        std::mutex freelist_mutex;
        std::queue<Frame> freelist;
        GLenum buffer;
+       std::unique_ptr<Userdata[]> userdata;
 };
 
 #endif  // !defined(_PBO_FRAME_ALLOCATOR)