V4L2SourceOp
🚧 Documentation is under development
The Holoscan SDK guide is currently under active development. Some sections may be incomplete or change without notice.
Questions? Contact RidgeRun or email to support@ridgerun.com.
-
Overview
-
Build, Run, and Validate
-
Core Concepts
-
Operators and Graphs
-
Tensor Data and Memory
-
Interprocess Communication
-
-
Application and Operator Development
- Building an HSDK Application
- Writing a Minimal Operator
- Typed Parameters and Configuration
- Reading, Writing, and Forwarding Data
- Writing Tensor Operators
- Complete Operator Patterns
- Authoring Runtime Behavior
- Runtime Parameter Updates
- Lifecycle Callbacks and Restart Control
- Performance and Debugging
- SDK Source Map
-
Operator Reference
-
Core Operators
-
Holoscan Camera
-
Holoscan RidgeRun
- Overview
- Build and Installation
- ArgusCameraOp
- V4L2SourceOp
- V4L2UserPtrSourceOp
- BgraToPlanarTensorOp
- RawBayerToBgraOp
- RawBayerToYoloTensorOp
- YuyvToBgraOp
- TensorRtInferenceOp
- DrmDisplayOp
- DrmBgraDisplayOp
- X11DisplayOp
- CudaCompositorOp
- DepthColorizerOp
- FakesinkOp
- FrameSkipperOp
- InterprocessSrcOp
- TestPatternOp
-
-
Migration from Holoscan 4.x
-
Examples
-
Core
-
Holoscan Camera
-
Holoscan RidgeRun
-
-
Benchmark and Use Cases
-
Holoscan vs GStreamer
- Overview
-
Capture and Display
-
Capture and Inference
- Compare the workloads
- Implemented Applications
- Framework Selection
- Interprocess
-
V4L2SourceOp
V4L2SourceOp captures an exact single-plane RG10 Bayer mode from a Linux V4L2 device using driver-owned MMAP buffers. Each dequeued frame is copied row by row into a plan-owned CUDA tensor before the driver buffer is requeued.
Input arguments
| Argument | Meaning |
|---|---|
device
|
V4L2 device path, for example /dev/video0.
|
width, height
|
Required RG10 capture dimensions. |
fps
|
Requested capture rate; defaults to 30.
|
frame_limit
|
Optional shared frame limit used by the demonstration applications. |
Ports and data contract
| Port | Memory | Queue | Trigger | Contract |
|---|---|---|---|---|
frame
|
CUDA device, runtime-owned | N/A | OnClock at fps
|
U16 tensor with shape [height, width, 1] containing unpacked RG10 values.
|
V4L2SourceOp -> RawBayerToBgraOp -> X11DisplayOp or DrmBgraDisplayOp
The source negotiates the requested single-plane RG10 mode and does not emit a frame when the captured buffer is invalid.
Build
Follow Holoscan RidgeRun Build and Installation for the module build and installation. The operator-specific include, target, and runtime requirements are listed below.
Include v4l2_source/v4l2_source.hpp and link holoscan::v4l2_source. The camera driver must support single-plane VIDEO_CAPTURE, streaming I/O and V4L2_PIX_FMT_SRGGB10.
Example
The output is a CUDA Tensor, so applications bind the source port to a CUDA device during compilation:
auto camera = graph.op<V4L2SourceOp>(
"camera", "/dev/video0", 1920, 1080, 60);
auto convert = graph.op<RawBayerToBgraOp>("convert", 1920, 1080);
graph.add_flow(camera->frame, convert->input);
compile_options.deployment.bind_tensor_output_device(
holoscan::TensorOutputDevicePlacement{
.operator_path = "camera",
.output_port = "frame",
.device = holoscan::DeviceId{0}});
At startup the source negotiates format and frame interval, requests driver-owned MMAP buffers, maps them and starts streaming. Each clock activation dequeues one buffer. The implementation copies rows with cudaMemcpy2DAsync, synchronizes before returning the buffer to V4L2, derives a capture timestamp when the driver timestamp is usable, emits the frame and requeues the buffer. A damaged buffer, unavailable frame, incompatible stride or failed requeue is reported or dropped without publishing an invalid image.
The optional frame limit counts successfully emitted frames. stop() performs STREAMOFF, unmaps all buffers and releases the V4L2 request. This operator is kept for the repository's early demonstration path; use V4L2UserPtrSourceOp when the application needs the CUDA-mapped USERPTR memory model.