Skip to content

[CameraInterface] Find the plugin and its cameras without being told: default endpoint, config file, --auto - #1532

Closed
farbod-nv wants to merge 1 commit into
fm/camera_capture_m0_benchfrom
fm/camera_capture_m0_config
Closed

farbod-nv wants to merge 1 commit into
fm/camera_capture_m0_benchfrom
fm/camera_capture_m0_config

Conversation

@farbod-nv

Copy link
Copy Markdown
Contributor

Description

Tenth pull request of the camera interface, stacked on #1531 (camera_bench), whose branch is this one's base.

It removes the need to tell the plugin and its readers where to find each other and which cameras to serve. After this, the whole of it is:

# ~/.config/isaaccapture/cameras.yaml
cameras:
  head:
    backend: synthetic
camera_plugin
CameraReader reader = CameraReader::open("head");
while (auto frames = reader.next(std::chrono::seconds(1)))
{
    const ImageView left = frames->image(0);
}
  • A default endpoint. default_endpoint_path() in camera_ipc is the socket path both sides agree on: $XDG_RUNTIME_DIR/isaaccapture/camera.sock, or under /tmp/isaaccapture-<uid>/ when that variable is not set. The plugin makes the directory for its owner alone and refuses one that others can enter, which matters for the /tmp case.
  • Named instances. A second plugin on the same machine runs with --instance=NAME on its own endpoint (camera-NAME.sock), and readers name the same instance. An instance name cannot carry a path.
  • A configuration file. load_config_file() reads the cameras from YAML: an id, backend:, and that backend's options as name: value, three lines per camera, plus an optional slots:. The default file is $XDG_CONFIG_HOME/isaaccapture/cameras.yaml. A file that cannot be used is reported with its line and what is expected there.
  • --auto. Without a file, or with --auto, the plugin serves every camera its backends find plugged in. A backend offers that through Backend::discover. The synthetic backend has nothing to find, so in this build --auto ends with a message that says how to name cameras; the camera backends that follow implement it.
  • The reader's API puts the group first. CameraReader::open(group, options = {}, plugin = {}) and list(plugin = {}); PluginLocation names an instance or a socket path and defaults to this user's plugin. This replaces the open(endpoint, group, options) form introduced in [CameraInterface] The connection between a camera plugin and its readers: camera_protocol, camera_endpoint, camera_reader #1528, so the common call needs no path.
  • camera_bench reads from the default endpoint or a named instance too. The plugin's --endpoint and --camera arguments remain, for tests and one-off runs.

Type of change

  • New feature (non-breaking change which adds functionality)

Testing

  • tests/cpp/core/camera_ipc/test_endpoint_path.cpp (2 cases): the default path with and without XDG_RUNTIME_DIR, named instances, instance names that carry a path are refused; the directory is created with mode 0700, and one that others can enter, a symlink, or a directory that cannot be made is refused.
  • tests/cpp/plugins/camera/test_camera_config.cpp (4 cases): a file names cameras in order with their options and pool size; eight kinds of unusable file are reported with the line and what is expected; the default file location; discovery asks only the backends that can look.
  • tests/cpp/plugins/camera/test_camera_plugin.cpp, one new case that runs plugins as processes with their own runtime and configuration directories: a plugin without arguments serves its configuration file and a reader that names only the group gets frames; a named instance runs beside it with its own cameras; --config names another file; --auto and a missing file end with exit code 1; conflicting arguments with 2.
  • All 77 camera tests pass through CTest, and under AddressSanitizer with UBSan; the camera_ipc, reader and plugin suites ran twice each under ThreadSanitizer with no reports. 15 repeated runs of the plugin suite without a failure.
  • Built through the repository's own build (BUILD_PLUGINS=ON) with the project warning set promoted to errors.
  • Ubuntu 22.04 x86_64, GCC 11.4, Linux 6.8.
  • clang-format-14 reports no changes; SKIP=check-copyright-year pre-commit run --all-files passes.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the linter and formatter with SKIP=check-copyright-year pre-commit run --all-files
  • I have made corresponding changes to the documentation (the plugin's, the reader's and camera_ipc's READMEs)
  • I have added tests that prove my fix/feature works (or explained why not)
  • I have signed off all my commits (git commit -s) per the DCO

🤖 Generated with Claude Code

A plugin started without arguments now serves the cameras of the user's
configuration file on the user's default endpoint, and a reader opened
with only a group name looks there:

  # ~/.config/isaaccapture/cameras.yaml
  cameras:
    head:
      backend: synthetic

  $ camera_plugin

  CameraReader reader = CameraReader::open("head");

- default_endpoint_path() in camera_ipc is the path both sides agree on,
  under $XDG_RUNTIME_DIR. A second plugin on the same machine is a named
  instance (--instance) with its own endpoint. The plugin makes the
  directory for its owner alone and refuses one that others can enter.
- load_config_file() reads the cameras: an id, a backend, and the backend's
  options, three lines per camera. A file that cannot be used is reported
  with its line.
- Without a file, or with --auto, the plugin serves every camera its
  backends find plugged in. A backend offers that through Backend::discover;
  the synthetic backend has nothing to find.
- CameraReader::open and list take the group first and the plugin's
  location last, defaulting to this user's plugin.
- camera_bench reads from the default endpoint or a named instance too.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@farbod-nv

Copy link
Copy Markdown
Contributor Author

Folded into #1530. The first milestone of the camera interface is now four pull requests instead of twelve: #1521, #1528, #1530 and #1534.

This branch was successfully deployed

1 active deployment
dev — 03207033 Deployed Nov 14, 2026 by farbod-nv via publish-wheel #6957
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants