[libcamera-devel] "cam" utility is quite confusing

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Jul 30 13:14:30 CEST 2022


Hello,

On Sat, Jul 30, 2022 at 10:26:11AM +0100, Kieran Bingham wrote:
> Quoting Pavel Machek via libcamera-devel (2022-07-29 20:56:20)
> > Hi!
> > 
> > I just spent quite some time debugging C++... when problem was in my
> > commnad line.
> 
> I'm sorry to hear that. cam is just a test tool, so indeed it possibly
> doesn't have the friendliest CLI - but it should still be expected to be
> usable, so I think you've hit a very valid bug.
> 
> > First, --sdl needs to come up after -c. Okay, documentation warns
> > about that "Options valid in the context of --camera:".
> > 
> > Second, AFAICT, you can not have file output and sdl viewfinder at the
> > same time.
> 
> That's an internal limitation at the moment I think that each buffer is
> only processed by one output. It could be extended to support more I
> believe.
> 
> > Third, and most confusing... --sdl will not actually display anything
> > unless you also pass -C. I don't think help text is really clear about
> > that.
> > 
> > I believe command line interface could be improved (automatically
> > assume -C when --sdl is passed? allow --sdl before -c?), or at least
> > documenation should be clear about these limitations.
> 
> This sounds good to me - --sdl doesn't make sense if it's not actually
> capturing, so I think an implicit -C is fine. Would you like to submit a
> patch for this?
> 
> I think the --sdl still needs to be within the context of a camera
> though. But I do wonder if we could default the first context to be the
> first camera? (Removing the need to explicitly set a -c ?

I'm not a big fan of implicit options. I'd rather turn the three options
related to sinks (-F, -D, -S) into a single sink option, as they're
mutually exclusive. Maybe "-S sdl", or "-o sdl" ? It could then later be
extended to support multiple sinks if needed, maybe along the line of
"-o sdl,file".

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list