Hi Hans, On Tue, 23 Mar 2021 09:33:38 +0100, Hans Verkuil wrote: > On 23/03/2021 09:23, Michael Tretter wrote: > > On Tue, 23 Mar 2021 08:57:53 +0100, Hans Verkuil wrote: > >> On 23/03/2021 08:52, Michael Tretter wrote: > >>> On Tue, 23 Mar 2021 08:49:13 +0100, Hans Verkuil wrote: [...] > >> I think you should either document it all, or change /** to /*. > > > > IMO documenting the parameters is rather pointless, because they are straight > > copies from the specifications and the documentation would be "see H264 > > specification" for every single one of them. I guess, I'll go for changing /** > > to /*. > > > > Actually, I thought about using the sps/pps structs defined in > > include/media/v4l2-ctrls.h. I was not convinced, because these are userspace > > facing API. Are the sps/pps definitions something, that would help other > > drivers, too, or should we rather avoid global definitions to discourage > > sps/pps parsing/generation in drivers? > > There is nothing wrong with using v4l2_ctrl_h264_sps/pps in your driver > instead of your own structs. > > Just note that these structs are now part of the uAPI, so can't be changed. > > If you need allegro specific data as well, then you might be better off > keeping your own structs. I checked this and, unfortunately, I need more data than what is available in the uAPI structs (at least cropping information is missing) and cannot reuse the uAPI structs. > > I'm not sure what you mean with your last question. If a driver needs to do > sps/pps parsing/generation, then why would it matter if it uses global or local > definitions? It still has to do it, right? And having reusable code might help > others. The question arises from the stateful video encoder interface specification [0]: Performing software stream processing, header generation etc. in the driver in order to support this interface is strongly discouraged. In case such operations are needed, use of the Stateless Video Encoder Interface (in development) is strongly advised. However, at least the drivers for the Techwell TW5864 and the CODA at least have partial support for writing sps/pps. I guess, having something reusable would be actually pretty helpful. That being said, the API and the documentation of the current sps/pps parsing/generation code is at least a bit sketchy - inconsistent documentation, h264 function being used for h264 and hevc, etc. I'm adding a cleanup of the interface to my todo list. Maybe at one point we could move this code from the driver to some common directory, if possible. Michael [0] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-encoder.html#memory-to-memory-stateful-video-encoder-interface