[PATCH 4/4] libcamera: Make Camera::Private::isAcquired() protected
Kieran Bingham
kieran.bingham at ideasonboard.com
Sun Oct 20 00:47:37 CEST 2024
Quoting Harvey Yang (2024-10-18 08:57:37)
> As some pipeline handlers need to know if a CameraData is currently
> acquired, this patch makes the function protected, instead of private.
>
> For example, the upcoming mtkisp7 needs the information to determine if
> it should send camera disconnect signal.
Why? If a camera is disconnected - it should always send a disconnect
signal to any listener.
It means the application must no longer even remember the camera
existed!
--
Kieran
>
> Signed-off-by: Harvey Yang <chenghaoyang at chromium.org>
> Co-developed-by: Yudhistira Erlandinata <yerlandinata at chromium.org>
> Signed-off-by: Yudhistira Erlandinata <yerlandinata at chromium.org>
> ---
> include/libcamera/internal/camera.h | 4 +++-
> src/libcamera/camera.cpp | 3 +++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h
> index 0bef0980e..fe47a49b7 100644
> --- a/include/libcamera/internal/camera.h
> +++ b/include/libcamera/internal/camera.h
> @@ -43,6 +43,9 @@ public:
>
> const CameraControlValidator *validator() const { return validator_.get(); }
>
> +protected:
> + bool isAcquired() const;
> +
> private:
> enum State {
> CameraAvailable,
> @@ -52,7 +55,6 @@ private:
> CameraRunning,
> };
>
> - bool isAcquired() const;
> bool isRunning() const;
> int isAccessAllowed(State state, bool allowDisconnected = false,
> const char *from = __builtin_FUNCTION()) const;
> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
> index ef5a6725f..38aa4ad22 100644
> --- a/src/libcamera/camera.cpp
> +++ b/src/libcamera/camera.cpp
> @@ -670,6 +670,9 @@ static const char *const camera_state_names[] = {
> "Running",
> };
>
> +/**
> + * \return True if the camera is acquired, false otherwise
> + */
> bool Camera::Private::isAcquired() const
> {
> return state_.load(std::memory_order_acquire) != CameraAvailable;
> --
> 2.47.0.rc1.288.g06298d1525-goog
>
More information about the libcamera-devel
mailing list