[libcamera-devel] [PATCH] Add enable_auto_focus option to the GStreamer plugin

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Jun 2 07:19:38 CEST 2023


On Thu, Jun 01, 2023 at 12:24:22PM -0400, Nicolas Dufresne wrote:
> Le jeudi 01 juin 2023 à 08:39 +0100, Naushir Patuck a écrit :
> > > If you have any idea what the default should be in the GStreamer
> > > element, please feel free to chime in :-)
> > 
> > Perhaps GStreamer should do nothing with focus by default and rely on the IPA
> > default behaviour (i.e. go to hyperfocal)?  This then relies on the application
> > to choose what it wants to do on startup, just like any other application that
> > directly uses libcamera.
> 
> To reassure you, it can't be worse then what most UVC camera do today. Having a
> default matching this would help consistency though (or being similarly bad from
> some point of view). Later, on top, there should be ways to move to a more
> manual control in focus aware Gst applications.

Hmmmm... I'm really in two minds here.

First of all, we can't expect the same default behaviour for all cameras
when it comes to auto-focus, simply because many cameras don't have a
controllable focus lens, and some (I'm thinking about UVC devices here)
may not have the ability to turn auto-focus on. Still, implementing
consistent defaults where possible is a goal I highly value, in order to
maximize application portability.

When it comes to the libcamera core, setting the focus lens to the
hyperfocal distance and disabling auto-focus seems like a good default
to me. Different use cases would favour different defaults, and I don't
think there's one particular use case that could be considered so
prevalent that it would call for enabling continuous auto-focus by
default. Different defaults could however be implemented in different
layers. For instance, I could imagine PipeWire deciding to enabling
continuous auto-focus by default on desktop or mobile systems.

For libcamerasrc, I don't know if the same reasoning should lead to the
same result, or if we should consider that the vast majority of use
cases for the GStreamer element call for enabling auto-focus by default.
I currently side towards doing the same as in the libcamera core, as I
believe it would be confusing for users to have different default
behaviours when using libcamera through different adaptation layers.
However, I could also imagine enabling auto-focus by default in the V4L2
adaptation layer for instance, as that layer is mostly meant to expose
libcamera-based cameras as webcams.

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list