[libcamera-devel] [RFC v3 2/5] libcamera: Request: expose Camera from Request

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Wed Dec 15 14:01:15 CET 2021


On 10/12/2021 13:42, Tomi Valkeinen wrote:
> On 09/12/2021 18:50, Laurent Pinchart wrote:
>> Hi Tomi,
>>
>> Thank you for the patch.
>>
>> On Thu, Dec 09, 2021 at 11:29:03AM +0200, Tomi Valkeinen wrote:
>>> Request has Camera as a private member. Expose this so that users can
>>> more easily associate a received Request to a Camera.
>>>
>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
>>> ---
>>>   include/libcamera/request.h | 2 ++
>>>   src/libcamera/request.cpp   | 5 +++++
>>>   2 files changed, 7 insertions(+)
>>>
>>> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
>>> index f434335b..6e8987b6 100644
>>> --- a/include/libcamera/request.h
>>> +++ b/include/libcamera/request.h
>>> @@ -60,6 +60,8 @@ public:
>>>       std::string toString() const;
>>> +    std::shared_ptr<Camera> camera() const;
>>
>> I'm not thrilled by this, as it would prevent us from removing the
>> camera pointer stored in the Request class, which I've been tempted to
>> do already.
>>
>> Why do we need this, and do we have any alternative ?
> 
> I use it to associate the completed Request with a camera. But I guess 
> the same can be done with the cookie with a few more lines.

Oh, there's another use. I have Request.set_control(), which takes a 
control name (string) and a value. I need the camera instance to find 
the control IDs.

That's currently the only way to set controls. I need to figure out some 
other way to handle it.

  Tomi


More information about the libcamera-devel mailing list