Skip to main content

ClikaRT::io::VideoReader

class

Header: ClikaRT/io/video.h

A lazily-opened video. open reads the header only; info() reports the stream metadata; the frames_* getters decode on demand. frames_at is the primitive; a custom sampling policy computes its own indices against info() and calls it. Move-only.

Every fallible method returns its value directly and raises ClikaRT::Error on failure (wrap in CLIKART_TRY(...) to inspect a Result instead).

Nested types​

NameDescription
FrameRangeA lazy range over frames yielding FrameBatches of up to batch_size frames each. The consecutive form covers all frames [0, T); the explicit form covers an arbitrary indices set. Each dereference decodes its window (and raises ClikaRT::Error on a decode failure). An index past the clip's last frame is refused by name at the decode, whichever form asked for it.

Static member functions​

open(string_view)​

static VideoReader open(std::string_view path)

Open a reader over a file (reads the header only). path is copied.

Declared in ClikaRT/io/video.h, line 47

open(Span< uint8_t>)​

static VideoReader open(ClikaRT::Span<const std::uint8_t> bytes)

Open a reader over a file (reads the header only). path is copied.

Declared in ClikaRT/io/video.h, line 51

Member functions​

VideoReader()​

VideoReader(VideoReader&&) noexcept

Declared in ClikaRT/io/video.h, line 53

operator=()​

VideoReader& operator=(VideoReader&&) noexcept

Move-assign: transfers the reader.

Declared in ClikaRT/io/video.h, line 55

~VideoReader()​

~VideoReader()

Releases the reader and its decoder state.

Declared in ClikaRT/io/video.h, line 57

info()​

VideoInfo info() const

The stream's static metadata (read at open). Infallible.

Declared in ClikaRT/io/video.h, line 60

frames_at()​

FrameBatch frames_at(ClikaRT::Span<const std::int64_t> indices) const

Decode exactly the frames at indices (in order) → a FrameBatch. The primitive every other getter routes through. indices is read during the call, not retained.

Declared in ClikaRT/io/video.h, line 66

sample_uniform()​

FrameBatch sample_uniform(std::int64_t n) const

Uniformly sample n frames across the whole clip (the built-in default sampling policy).

Declared in ClikaRT/io/video.h, line 71

frames_at_timestamps()​

FrameBatch frames_at_timestamps(ClikaRT::Span<const double> seconds) const

Decode the frames nearest each timestamp in seconds. seconds is read during the call, not retained.

Declared in ClikaRT/io/video.h, line 76

frame_bytes()​

std::vector<std::uint8_t> frame_bytes(std::int64_t index) const

A single frame's raw RGB bytes (length H * W * 3) copied into a vector.

Declared in ClikaRT/io/video.h, line 80

to_process_metadata()​

VideoInfo to_process_metadata() const

The to_process_metadata bridge: the reader's info as the processor's 3-field VideoMetadata-shaped VideoInfo (total_num_frames / fps / duration_seconds), so a clip feeds a video processor directly. Infallible.

Declared in ClikaRT/io/video.h, line 85

frames(int64_t)​

FrameRange frames(std::int64_t batch_size = 1) const

Iterate all frames [0, T) in batches of batch_size.

Declared in ClikaRT/io/video.h, line 136

frames(Span< int64_t>, int64_t)​

FrameRange frames(ClikaRT::Span<const std::int64_t> indices, std::int64_t batch_size = 1) const

Iterate an explicit indices set in batches of batch_size.

Declared in ClikaRT/io/video.h, line 138