From 9217f274f64f690b768d332663e1731a3ee5ef15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 22 Nov 2019 16:22:56 +0100 Subject: libcamera: Switch to FrameBuffer interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch to the FrameBuffer interface where all buffers are treated as external buffers and are allocated outside the camera. Applications allocating buffers using libcamera are switched to use the FrameBufferAllocator helper. Follow-up changes to this one will finalize the transition to the new FrameBuffer interface by removing code that is left unused after this change. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/v4l2/v4l2_camera.h | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) (limited to 'src/v4l2/v4l2_camera.h') diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h index 06eab0e1..f1f04d9e 100644 --- a/src/v4l2/v4l2_camera.h +++ b/src/v4l2/v4l2_camera.h @@ -9,50 +9,38 @@ #define __V4L2_CAMERA_H__ #include -#include #include +#include #include #include #include +#include #include "semaphore.h" using namespace libcamera; -class V4L2FrameMetadata +class V4L2Camera : public Object { public: - V4L2FrameMetadata(Buffer *buffer); - - int index() const { return index_; } - - unsigned int bytesused() const { return bytesused_; } - uint64_t timestamp() const { return timestamp_; } - unsigned int sequence() const { return sequence_; } - - FrameMetadata::Status status() const { return status_; } - -private: - int index_; + struct Buffer { + Buffer(unsigned int index, const FrameMetadata &data) + : index(index), data(data) + { + } - unsigned int bytesused_; - uint64_t timestamp_; - unsigned int sequence_; + unsigned int index; + FrameMetadata data; + }; - FrameMetadata::Status status_; -}; - -class V4L2Camera : public Object -{ -public: V4L2Camera(std::shared_ptr camera); ~V4L2Camera(); int open(); void close(); void getStreamConfig(StreamConfiguration *streamConfig); - std::vector completedBuffers(); + std::vector completedBuffers(); int configure(StreamConfiguration *streamConfigOut, const Size &size, PixelFormat pixelformat, @@ -78,9 +66,10 @@ private: bool isRunning_; std::mutex bufferLock_; + FrameBufferAllocator *bufferAllocator_; std::deque> pendingRequests_; - std::deque> completedBuffers_; + std::deque> completedBuffers_; }; #endif /* __V4L2_CAMERA_H__ */ -- cgit v1.2.1