[libcamera-devel] [PATCH 00/30] Multi-camera support in the cam application

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Jul 7 04:19:11 CEST 2021


Hello,

This patch series adds multi-camera support to the cam application,
allowing it to capture streams from different cameras at the same time.
While this can be used with any cameras, it is most useful to test
concurrent usage of different cameras belonging to the same pipeline
handler, as multiple cam instances can be run in parallel to capture
from cameras belonging to different pipeline handlers.

The patch series starts with a rework of the options parser to support
parent-child relationships in options, allowing for syntaxes such as

cam -c1 -C20 -c2 -C30

to capture 20 and 30 frames from cameras 1 and 2 respectively. The
second part of the series reworks the cam application to slowly move
towards multi-camera support, with the last patch flipping the switch.

I've tested this successfully with cameras belonging to different
pipeline handler instances. The PipelineHandler::lock() function
currently prevents concurrent usage of cameras belonging to the same
pipeline handler. While this will need to be addressed in order to get
the full potential from multi-camera support in cam, the cam application
is expected to work the same way regardless of whether the cameras
belong to the same or different pipeline handlers.

Laurent Pinchart (30):
  cam: options: Make KeyValueParser::usage() private
  cam: options: Move Option struct to options.cpp
  cam: options: Document the options parser API
  cam: options: Move OptionValue class after OptionsParser
  cam: options: Add optionName() function to Option structure
  cam: options: Slit OptionsParser::usage() in two functions
  cam: options: Disable copy for parsers
  cam: options: Move key string left in usage() for key-value parser
  cam: options: Support parent-child relationship between options
  cam: options: Drop some OptionValue cast operators
  cam: options: Avoid copies of OptionvValue and KeyValueParser::Options
  cam: Rename Capture to CameraSession
  cam: camera_session: Access event loop through global instance
  cam: Move event loop exit from CameraSession to CamApp
  cam: Move event loop execution from CameraSession to CamApp
  cam: camera_session: Use std::unique_ptr<> to manage class members
  cam: Store camera session pointer in CamApp class
  cam: Move CameraConfiguration creation to CameraSession class
  cam: Move camera acquire to the CameraSession class
  cam: Use std::unique_ptr<> to manager CameraManager
  cam: Drop unneeded error check and message
  cam: Make CamApp::cameraName() static
  cam: Move camera session creation and monitoring setup to run()
  cam: Move printing of camera information to CameraSession class
  cam: Move session_ member variable to a local variable in run()
    function
  cam: Reorganize run() function and merge the two event loops
  cam: Allow specifying directories in the --file option
  cam: Make camera-related options sub-options of OptCamera
  cam: Add camera index to file name of capture frames
  cam: Support using multiple cameras concurrently

 src/cam/buffer_writer.cpp  |   7 +-
 src/cam/buffer_writer.h    |   2 +-
 src/cam/camera_session.cpp | 345 ++++++++++++++++++
 src/cam/camera_session.h   |  76 ++++
 src/cam/capture.cpp        | 241 -------------
 src/cam/capture.h          |  55 ---
 src/cam/main.cpp           | 312 ++++++----------
 src/cam/meson.build        |   2 +-
 src/cam/options.cpp        | 707 +++++++++++++++++++++++++++++++++----
 src/cam/options.h          |  97 ++---
 src/cam/stream_options.cpp |   3 +-
 11 files changed, 1227 insertions(+), 620 deletions(-)
 create mode 100644 src/cam/camera_session.cpp
 create mode 100644 src/cam/camera_session.h
 delete mode 100644 src/cam/capture.cpp
 delete mode 100644 src/cam/capture.h

-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list