diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-19 21:42:09 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-23 22:36:30 +0200 |
commit | a4be7bb5ff4d4dce1fdc942a103f6360dad91f11 (patch) | |
tree | e5c218cb52d0224604745037cd20eaa3cf9734a5 /include | |
parent | a0295fdaf854bb10c387255f10677d9b6f1554dc (diff) |
libcamera: camera: Move private data members to private implementation
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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/camera.h | 28 |
1 files changed, 8 insertions, 20 deletions
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<Stream *> &streams); ~Camera(); - bool stateBetween(State low, State high) const; - bool stateIs(State state) const; + class Private; + std::unique_ptr<Private> p_; friend class PipelineHandler; void disconnect(); - void requestComplete(Request *request); - std::shared_ptr<PipelineHandler> pipe_; - std::string name_; - std::set<Stream *> streams_; - std::set<Stream *> activeStreams_; - - bool disconnected_; - State state_; - - /* Needed to update allocator_ and to read state_ and activeStreams_. */ friend class FrameBufferAllocator; + int exportFrameBuffers(Stream *stream, + std::vector<std::unique_ptr<FrameBuffer>> *buffers); + int freeFrameBuffers(Stream *stream); + /* \todo Remove allocator_ from the exposed API */ FrameBufferAllocator *allocator_; }; |