]> git.sesse.net Git - bmusb/blobdiff - bmusb/bmusb.h
Release 0.7.8.
[bmusb] / bmusb / bmusb.h
index b1861efb6ddf045ae7d6a49a31d2c4667e314a25..cec84d9ae6bef90c65fee708462991eea0978d8b 100644 (file)
@@ -31,6 +31,7 @@ class FrameAllocator {
        struct Frame {
                uint8_t *data = nullptr;
                uint8_t *data2 = nullptr;  // Only if interleaved == true.
+               uint8_t *data_copy = nullptr;  // Will get a non-interleaved copy if not nullptr.
                size_t len = 0;  // Number of bytes we actually have.
                size_t size = 0;  // Number of bytes we have room for.
                size_t overflow = 0;
@@ -72,6 +73,22 @@ class FrameAllocator {
        // if so, the frame in progress will be dropped.
        virtual Frame alloc_frame() = 0;
 
+       // Similar to alloc_frame(), with two additional restrictions:
+       //
+       //  - The width, height and stride given must be correct
+       //    (can not be changed after the call).
+       //  - create_frame(), unlike alloc_frame(), is allowed to sleep
+       //    (so bmusb will never call it, but in Nageru, other producers
+       //    might)
+       //
+       // These two restrictions are relevant for Nageru, since it means that
+       // it can make frame_copy point directly into a VA-API buffer to avoid
+       // an extra copy.
+       virtual Frame create_frame(size_t width, size_t height, size_t stride)
+       {
+               return alloc_frame();
+       }
+
        virtual void release_frame(Frame frame) = 0;
 };