Class V4L2VideoCaptureOp

class V4L2VideoCaptureOp : public holoscan::Operator

Operator class to get the video stream from V4L2.

https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/v4l2.html

Inputs a video stream from a V4L2 node, including USB cameras and HDMI IN.

  • Input stream is on host. If no pixel format is specified in the yaml configuration file, the pixel format will be automatically selected. However, only AR24 and YUYV are then supported. If a pixel format is specified in the yaml file, then this format will be used. However, note that the operator then expects that this format can be encoded as RGBA32. If not, the behaviour is undefined.

  • Output stream is on host. Always RGBA32 at this time.

Use holoscan::ops::FormatConverterOp to move data from the host to a GPU device.

Public Functions

HOLOSCAN_OPERATOR_FORWARD_ARGS (V4L2VideoCaptureOp) V4L2VideoCaptureOp()=default

virtual void setup(OperatorSpec &spec) override

Define the operator specification.

Parameters

spec – The reference to the operator specification.

virtual void start() override

Implement the startup logic of the operator.

This method is called multiple times over the lifecycle of the operator according to the order defined in the lifecycle, and used for heavy initialization tasks such as allocating memory resources.

virtual void initialize() override

Initialize the operator.

This function is called when the fragment is initialized by Executor::initialize_fragment().

virtual void compute(InputContext &op_input, OutputContext &op_output, ExecutionContext &context) override

Implement the compute method.

This method is called by the runtime multiple times. The runtime calls this method until the operator is stopped.

Parameters
  • op_input – The input context of the operator.

  • op_output – The output context of the operator.

  • context – The execution context of the operator.

virtual void stop() override

Implement the shutdown logic of the operator.

This method is called multiple times over the lifecycle of the operator according to the order defined in the lifecycle, and used for heavy deinitialization tasks such as deallocation of all resources previously assigned in start.

© Copyright 2022-2023, NVIDIA. Last updated on Feb 9, 2024.