]> git.sesse.net Git - nageru/blobdiff - h264encode.h
Add a wrapper to make fences refcounted, as we will soon be needing to split them...
[nageru] / h264encode.h
index f355116781cadde6f06c25d5a7c2b8a35b17870d..b14ca6f4690643d6281be45c0dbd27e19b49f3a5 100644 (file)
@@ -35,13 +35,11 @@ extern "C" {
 #include <memory>
 #include <mutex>
 #include <thread>
-#include <thread>
-#include <thread>
-#include <thread>
 #include <condition_variable>
 
 #include "pbo_frame_allocator.h"
 #include "context.h"
+#include "ref_counted_gl_sync.h"
 
 #define SURFACE_NUM 16 /* 16 surfaces for source YUV */
 
@@ -63,7 +61,7 @@ public:
        void 
 #endif
        bool begin_frame(GLuint *y_tex, GLuint *cbcr_tex);
-       void end_frame(GLsync fence);
+       void end_frame(RefCountedGLsync fence, const std::vector<FrameAllocator::Frame> &input_frames_to_release);
 
 private:
        struct storage_task {
@@ -92,10 +90,12 @@ private:
        //int frame_width, frame_height;
        //int ;
        int current_storage_frame;
-#if 0
-       std::map<int, std::pair<FrameAllocator::Frame, GLsync>> pending_frames;
-#endif
-       std::map<int, GLsync> pending_frames;
+
+       struct PendingFrame {
+               RefCountedGLsync fence;
+               std::vector<FrameAllocator::Frame> input_frames_to_release;
+       };
+       std::map<int, PendingFrame> pending_frames;
        QSurface *surface;
 
        AVFormatContext *avctx;