Camera interface

The camera interface enables access to the host system’s cameras and other video capture devices inside the workshop.

By using the interface, the SDK publisher allows the workshop to access the host’s cameras, which can be useful in various SDK-specific tasks such as testing hardware or embedded devices.

Camera interface plug

An essential element here is the camera interface plug, which is declared in the SDK definition.

Its structure includes just the name of the plug and the interface; both must be set to camera.

Defining the plug in an SDK allows the workshops using this SDK to connect to the host’s cameras, which can be useful in various SDK-specific tasks such as testing hardware or embedded devices.

Camera interface slot

To let SDKs in a workshop access the host’s cameras, Workshop provides a camera interface slot that multiple camera interface plugs can access.

When the SDK is installed at runtime during launch and refresh operations, Workshop checks that the plug targeting the slot passes validation; if it does, it can be connected.

Connection

The interface isn’t connected automatically at launch and refresh for security reasons. The workshop connect and workshop disconnect commands can be invoked manually after the workshop has started:

$ workshop connect ws/camera-sdk:camera
$ workshop disconnect ws/camera-sdk:camera

Establishing a connection means that all existing video4linux and media devices will be made available inside the workshop. While the connection is active, adding new devices on the host will also make them available inside the workshop, whereas unplugged devices will also be removed from the workshop.

To check if the interface is connected:

$ workshop connections --all

  INTERFACE  PLUG              SLOT              NOTES
  ...
  camera     ws/camera:camera  ws/system:camera  manual

This means the host’s cameras are available inside the workshop:

$ workshop shell ws
workshop@ws-8584e571$ ls /dev/video*

  /dev/video0  /dev/video1

workshop@ws-8584e571$ ls /dev/media*

  /dev/media0

See also

Explanation:

Reference: