From a4be7bb5ff4d4dce1fdc942a103f6360dad91f11 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 19 Jan 2020 21:42:09 +0200 Subject: libcamera: camera: Move private data members to private implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the d-pointer idiom ([1], [2]) to hide the private data members from the Camera class interface. This will ease maintaining ABI compatibility, and prepares for the implementation of the Camera class threading model. The FrameBufferAllocator class accesses the Camera private data members directly. In order to hide them, this pattern is replaced with new private member functions in the Camera class, and the FrameBufferAllocator is updated accordingly. [1] https://wiki.qt.io/D-Pointer [2] https://en.cppreference.com/w/cpp/language/pimpl Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- include/libcamera/camera.h | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index 6597ade8..c37319ed 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -98,34 +98,22 @@ public: int stop(); private: - enum State { - CameraAvailable, - CameraAcquired, - CameraConfigured, - CameraRunning, - }; - - Camera(PipelineHandler *pipe, const std::string &name); + Camera(PipelineHandler *pipe, const std::string &name, + const std::set &streams); ~Camera(); - bool stateBetween(State low, State high) const; - bool stateIs(State state) const; + class Private; + std::unique_ptr p_; friend class PipelineHandler; void disconnect(); - void requestComplete(Request *request); - std::shared_ptr pipe_; - std::string name_; - std::set streams_; - std::set activeStreams_; - - bool disconnected_; - State state_; - - /* Needed to update allocator_ and to read state_ and activeStreams_. */ friend class FrameBufferAllocator; + int exportFrameBuffers(Stream *stream, + std::vector> *buffers); + int freeFrameBuffers(Stream *stream); + /* \todo Remove allocator_ from the exposed API */ FrameBufferAllocator *allocator_; }; -- cgit v1.2.1