[libcamera-devel] [PATCH v4 2/5] HACK: libcamera: Request: expose Camera from Request

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Wed Feb 9 08:49:22 CET 2022


On 08/02/2022 16:29, Kieran Bingham wrote:
> Quoting Tomi Valkeinen (2022-02-04 13:38:11)
>> Request has Camera as a private member. Expose this so that users can
>> more easily associate a received Request to a Camera.
> 
> I still don't think this is a hack. I've wanted this in the past [0].
> 
>    [0] https://patchwork.libcamera.org/patch/9328/

And Laurent wants to get rid of the Camera field =)

> I'm still fighting myself if shared ptr is appropriate here, as I don't
> think we want to convey that the camera here could be stored or kept -
> it should only be used as a convenience to check the camera while
> dealing with the request - but I don't think that's really going to be
> an issue ... so

Plain pointers are a bit tricky wrt. Python. If the pointer means that 
the ownership is given to the caller, it's fine, Python then owns the 
object. But if the pointer means that the caller does not own the 
object, and can only use the pointer temporarily, it's a problem as we 
can't guarantee such (use only temporarily) thing on the Python side.

Cameras are handled with shared_ptrs in libcamera, so I don't quite see 
why you wouldn't use shared_ptr<Camera> everywhere.

  Tomi


More information about the libcamera-devel mailing list