[RFC PATCH 0/7] Support different outputs for cam streams

Milan Zamazal mzamazal at redhat.com
Fri Mar 14 21:29:28 CET 2025


cam application supports multiple streams but only a single kind of
output for all of them at the same time.  It would be helpful if it was
possible to support different outputs for different streams, for example if a processed stream could be sent to display while a raw stream to files or if a processed stream would be written to PPM files while a raw stream to raw files.

This patch series implements this (besides some janitorial patches).
There are multiple options how to do it.  The selected way is to keep
the current output command line options, so that things don’t get
unnecessarily more complicated for the users, and adding new --stream
child options specifying the output.  To keep the implementation
simpler, it’s not possible to combine the current output options with
the newly introduced stream child options.

Examples of newly introduced command line options:

  cam ... -s role=viewfinder,... --stream-display \
          -s role=raw,... --stream-file=raw#

or

  cam ... -s role=viewfinder,... --stream-file=processed#.ppm \
          -s role=raw,... --stream-file=raw#

Milan Zamazal (7):
  apps: common: Fix flipped error condition
  apps: cam: Formatting fixes
  apps: cam: Remove unused imports
  apps: cam: Add support for multiple sinks
  apps: cam: Report error on multiple default sinks
  apps: cam: Track sink streams
  apps: cam: Add command line options for stream specific outputs

 src/apps/cam/camera_session.cpp | 140 ++++++++++++++++++++++++++------
 src/apps/cam/camera_session.h   |   2 +-
 src/apps/cam/file_sink.cpp      |   3 +-
 src/apps/cam/frame_sink.cpp     |  14 ++++
 src/apps/cam/frame_sink.h       |  26 ++++++
 src/apps/cam/kms_sink.cpp       |  16 ++--
 src/apps/cam/main.cpp           |  27 ++++--
 src/apps/cam/main.h             |   3 +
 src/apps/cam/sdl_sink.cpp       |  19 ++---
 src/apps/common/options.cpp     |   2 +-
 10 files changed, 202 insertions(+), 50 deletions(-)

-- 
2.48.1



More information about the libcamera-devel mailing list