[PATCH v2 0/3] gstreamer: Generate controls from control_ids_*.yaml files
Nicolas Dufresne
nicolas at ndufresne.ca
Thu Oct 3 16:16:39 CEST 2024
Le mercredi 02 octobre 2024 à 14:22 +0300, Laurent Pinchart a écrit :
> On Wed, Oct 02, 2024 at 12:04:08PM +0200, Jaslo Ziska wrote:
> > Nicolas Dufresne <nicolas at ndufresne.ca> writes:
> > > Le lundi 30 septembre 2024 à 11:11 +0200, Jaslo Ziska a écrit :
> > > > Laurent Pinchart <laurent.pinchart at ideasonboard.com> writes:
> > > > > Hi Jaslo,
> > > > >
> > > > > I think this series is close to being ready, and I would be very happy
> > > > > to merge this much awaited feature. Do you plan to send a v3 ?
> > > >
> > > > Yes, I very much plan on continuing to work on this. I was a
> > > > pretty busy the past month but I should have more time later in
> > > > October.
> > > >
> > > > Unfortunately, I don't think that the series is quite ready.
> > > > Nicolas had requested some bigger changes in v1 which still need
> > > > to be discussed and implemented and I also want to add the
> > > > readable/writeable and minimum/maximum properties to the yaml
> > > > files (although this could also be done separately after
> > > > merging).
> > >
> > > My proposal is to program a subset to be exposed as properties, the one that are
> > > obviously usable and that the documentation make sense. I think you did a great
> > > job on the generator and adding features later to support controls that have
> > > more complex semantic is better then trying to support them all
> > > in one go today.
> >
> > Sounds good. Where would you suggest the list of controls to be
> > exposed should be? Maybe just a plain list in the Python generator
> > file?
>
> The other option is to store the information in the yaml files. I don't
> have a very strong opinion, the yaml files have the advantage that all
> the data related to controls will be in a single place, but the
> generator script has the advantage of keeping all gstreamer-related data
> close to the gstreamer element. That may be useful when it will be time
> to move libcamerasrc from the libcamera repository to the gstreamer
> repository (if we ever do so). On the other hand, tha yaml files are not
> installed, so there would still be issues.
I would start simple and close to GStreamer at this stage. So just a list in the
generator works for me.
>
> Complete brainstorming mode, I'm wondering if at some point in the
> future it would make sense to handle the gstreamer controls in a more
> dynamic fashion by querying libcamera at runtime instead of using code
> generation. This doesn't invalidate the approach you've taken here, I
> think code generation is good for the time being.
GObject properties have to be setup at class instance creation time, which can
only happen once (unlike instance creation or the contructor). That limits how
"dynamic" this can be. Dynamic class creation is possible, but have never been
done for possibly hot-pluggable devices (even though I will likely disable UVC
support in our GStreamer element as folks are struggling getting on part support
as what the v4l2src offers).
The code generator is by far a lot more straightforward to follow and maintain
in my opinion. In the long term, we can use a hand written property to expose
the map of supported properties, which isn't different when you use libcamera
directly, since the properties comes in that form.
Nicolas
>
> > > If the selection is all rw, the marking of that can wait. Min/max would be my
> > > preference to have, but as we are breaking the API anyway still, we can also do
> > > small break in the gstreamer element later too (as long as its well reported in
> > > the release notes).
> >
> > You also suggested a GStreamer property that returns a
> > GstStructure which lists all the actually present controls for the
> > camera and their actual limits. Do you still want this implemented
> > and if so how do you imagine this structure to be laid out?
> >
> > > > > On Tue, Aug 13, 2024 at 02:25:04PM +0200, Jaslo Ziska wrote:
> > > > > > Hi everyone,
> > > > > >
> > > > > > this is the second version of the patch set to implement gstreamer controls
> > > > > > from the yaml files.
> > > > > > This now depends on "[PATCH 00/10] libcamera: Improve code generation for
> > > > > > controls" for the code generation.
> > > > > >
> > > > > > The following things changed:
> > > > > >
> > > > > > The (old) third commit fixing a typo has been removed as it is already merged.
> > > > > >
> > > > > > The first commit is new: it removes the auto-focus-mode property from the
> > > > > > device provider where it has been added on accident.
> > > > > >
> > > > > > The commit message has been updated in the second commit.
> > > > > >
> > > > > > The third commit, which adds the code that generates the gstreamer controls,
> > > > > > now makes use of jinja2 and the new controls.py file. As a consequence the
> > > > > > whole code generation has been redone.
> > > > > >
> > > > > > There are also some new features:
> > > > > >
> > > > > > It is now possible to read the metadata returned by requests from the gstreamer
> > > > > > properties. This is done using a new function readMetadata() which reads the
> > > > > > ControlList in requestCompleted().
> > > > > >
> > > > > > Before a control is set it is now checked whether this control is actually
> > > > > > supported by the camera. This is done by checking the cameras ControlInfoMap.
> > > > > >
> > > > > > The Rectangle type is now supported.
> > > > > >
> > > > > > Some checks were added to make sure the arrays passed to the element have the
> > > > > > correct length.
> > > > > >
> > > > > > Best regards,
> > > > > >
> > > > > > Jaslo
> > > > > >
> > > > > > Jaslo Ziska (3):
> > > > > > gstreamer: Remove auto-focus-mode property from device provider
> > > > > > gstreamer: Remove auto-focus-mode property from libcamerasrc
> > > > > > gstreamer: Generate controls from control_ids_*.yaml files
> > > > > >
> > > > > > src/gstreamer/gstlibcamera-controls.cpp.in | 296 +++++++++++++++++++++
> > > > > > src/gstreamer/gstlibcamera-controls.h | 43 +++
> > > > > > src/gstreamer/gstlibcameraprovider.cpp | 15 --
> > > > > > src/gstreamer/gstlibcamerasrc.cpp | 50 ++--
> > > > > > src/gstreamer/meson.build | 10 +
> > > > > > utils/codegen/controls.py | 8 +
> > > > > > utils/codegen/gen-gst-controls.py | 151 +++++++++++
> > > > > > utils/codegen/meson.build | 1 +
> > > > > > 8 files changed, 528 insertions(+), 46 deletions(-)
> > > > > > create mode 100644 src/gstreamer/gstlibcamera-controls.cpp.in
> > > > > > create mode 100644 src/gstreamer/gstlibcamera-controls.h
> > > > > > create mode 100755 utils/codegen/gen-gst-controls.py
>
More information about the libcamera-devel
mailing list