NVIDIA Holoscan SDK v2.7.0
Holoscan v2.7.0

Class VideoStreamReplayerOp

Base Type

class VideoStreamReplayerOp : public holoscan::Operator

Operator class to replay a video stream from a file.

==Named Outputs==

  • output : nvidia::gxf::Tensor

    • A message containing a video frame deserialized from disk. Depending on the metadata in the file being read, this tensor could be on either CPU or GPU. For the data used in examples distributed with the SDK, the tensor will be an unnamed GPU tensor (name == “”).

==Parameters==

  • directory: Directory path for reading files from.

  • basename: User specified file name without extension.

  • batch_size: Number of entities to read and publish for one tick. Optional (default: 1).

  • ignore_corrupted_entities: If an entity could not be deserialized, it is ignored by default; otherwise a failure is generated. Optional (default: true).

  • frame_rate: Frame rate to replay. If zero value is specified, it follows timings in timestamps. Optional (default: 0.0).

  • realtime: Playback video in realtime, based on frame_rate or timestamps. Optional (default: true).

  • repeat: Repeat video stream in a loop. Optional (default: false).

  • count: Number of frame counts to playback. If zero value is specified, it is ignored. If the count is less than the number of frames in the video, it would finish early. Optional (default: 0).

  • allocator: The allocator used for Tensor objects. Currently this can only use the default allocator type of <a class="reference internal" href="classholoscan_1_1UnboundedAllocator.html#classholoscan_1_1UnboundedAllocator" target="_self">holoscan::UnboundedAllocator</a>. Optional (default: <a class="reference internal" href="classholoscan_1_1UnboundedAllocator.html#classholoscan_1_1UnboundedAllocator" target="_self">holoscan::UnboundedAllocator</a>)

  • entity_serializer: The entity serializer used for deserialization. The default is to use a default-initialized holoscan::gxzf::StdEntitySerializer. If this argument is specified, then the allocator argument is ignored.

==Device Memory Requirements==

This operator reads data from a file to an intermediate host buffer and then transfers the data to the GPU. Because both host and device memory is needed, an allocator supporting both memory types must be used. Options for this are <a class="reference internal" href="classholoscan_1_1UnboundedAllocator.html#classholoscan_1_1UnboundedAllocator" target="_self">UnboundedAllocator</a> and the <a class="reference internal" href="classholoscan_1_1RMMAllocator.html#classholoscan_1_1RMMAllocator" target="_self">RMMAllocator</a>. When using RMMAllocator, the following memory blocks are needed:

  1. One block of host memory equal in size to a single uncompressed video frame is needed. Note that for RMMAllocator, the memory sizes should be specified in MiB, so the minimum value can be obtained by:

Copy
Copied!
            

#include <cmath> ceil(static_cast<double>(height * width * channels * element_size_bytes) / (1024 * 1024));

  1. One block of device memory equal in size to the host memory block.

When declaring an RMMAllocator memory pool, host_memory_initial_size and device_memory_initial_size must be greater than or equal to the values discussed above.

Public Functions

HOLOSCAN_OPERATOR_FORWARD_ARGS (VideoStreamReplayerOp) VideoStreamReplayerOp()=default
~VideoStreamReplayerOp() override
virtual void setup(OperatorSpec &spec) override

Define the operator specification.

Parameters

spec – The reference to the operator specification.

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.

Previous Class VideoStreamRecorderOp
Next Class VirtualOperator
© Copyright 2022-2024, NVIDIA. Last updated on Dec 2, 2024.