Home
Vision module

FrameSampler

PacketProcessor that forwards a sampled subset of decoded video frames.

FrameSampler

#include <icy/vision/framesampler.h>
class FrameSampler

Defined in src/vision/include/icy/vision/framesampler.h:49

Inherits: PacketProcessor

PacketProcessor that forwards a sampled subset of decoded video frames.

The sampler is intentionally zero-copy on its synchronous path: sampled frames are forwarded by reference and dropped frames are discarded before any queue hop. Pair it with DetectionQueue when a worker-thread boundary is required.

List of all members

NameKindOwner
emittervariableDeclared here
FrameSamplerfunctionDeclared here
setConfigfunctionDeclared here
configfunctionDeclared here
statsfunctionDeclared here
resetfunctionDeclared here
processfunctionDeclared here
acceptsfunctionDeclared here
_configvariableDeclared here
_seenvariableDeclared here
_forwardedvariableDeclared here
_droppedvariableDeclared here
_lastForwardedTimeUsecvariableDeclared here
shouldForwardfunctionDeclared here
kUnsetTimeUsecvariableDeclared here
sanitizefunctionDeclared here
PacketProcessorfunctionInherited from PacketProcessor
processfunctionInherited from PacketProcessor
acceptsfunctionInherited from PacketProcessor
operator<<functionInherited from PacketProcessor
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
~PacketStreamAdapterfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
getEmitterfunctionInherited from PacketStreamAdapter
retentionfunctionInherited from PacketStreamAdapter
onStreamStateChangefunctionInherited from PacketStreamAdapter
_emittervariableInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter

Inherited from PacketProcessor

KindNameDescription
functionPacketProcessor inline
functionprocess virtualThis method performs processing on the given packet and emits the result.
functionaccepts virtual inlineThis method ensures compatibility with the given packet type. Return false to reject the packet.
functionoperator<< virtual inlineStream operator alias for process()

Inherited from PacketStreamAdapter

KindNameDescription
functionPacketStreamAdapterConstruct the adapter, binding it to the given packet signal.
function~PacketStreamAdapter virtual inline
functionemit virtualEmit a mutable raw buffer as a packet.
functionemit virtualEmit a read-only raw buffer as a packet (data is copied internally).
functionemit virtualEmit a string as a packet (data is copied internally).
functionemit virtualEmit a flag-only packet carrying no payload data.
functionemit virtualEmit an existing packet directly onto the outgoing signal.
functiongetEmitterReturns a reference to the outgoing packet signal.
functionretention virtual constReturns how this adapter treats incoming packet lifetime. Most adapters are synchronous and therefore only borrow the packet for the current call chain. Queue-style adapters override this to advertise that they clone before deferred use. Callers may treat the first adapter reporting Cloned or Retained as the explicit ownership boundary in the stream graph.
functiononStreamStateChange virtual inlineCalled by the PacketStream to notify when the internal Stream state changes. On receiving the Stopped state, it is the responsibility of the adapter to have ceased all outgoing packet transmission, especially in multi-thread scenarios.
variable_emitter
functionPacketStreamAdapterNonCopyable and NonMovable.
functionoperator=Deleted assignment operator.
functionPacketStreamAdapterDeleted constructor.
functionoperator=Deleted assignment operator.

Public Attributes

ReturnNameDescription
PacketSignalemitter

emitter

PacketSignal emitter

Defined in src/vision/include/icy/vision/framesampler.h:52

Public Methods

ReturnNameDescription
FrameSampler inline explicit
voidsetConfig inline
FrameSamplerConfigconfig const inline
FrameSamplerStatsstats const inline
voidreset inline
voidprocess virtual inline overrideThis method performs processing on the given packet and emits the result.
boolaccepts virtual inline overrideThis method ensures compatibility with the given packet type. Return false to reject the packet.

FrameSampler

inline explicit

inline explicit FrameSampler(FrameSamplerConfig config = {})

Defined in src/vision/include/icy/vision/framesampler.h:54


setConfig

inline

inline void setConfig(FrameSamplerConfig config)

Defined in src/vision/include/icy/vision/framesampler.h:60


config

const inline

inline FrameSamplerConfig config() const

Defined in src/vision/include/icy/vision/framesampler.h:66


stats

const inline

inline FrameSamplerStats stats() const

Defined in src/vision/include/icy/vision/framesampler.h:71


reset

inline

inline void reset()

Defined in src/vision/include/icy/vision/framesampler.h:80


process

virtual inline override

virtual inline void process(IPacket & packet) override

Defined in src/vision/include/icy/vision/framesampler.h:88

This method performs processing on the given packet and emits the result.

Processors that defer work asynchronously must either clone the packet or retain an owned equivalent. See retention().

Reimplements

accepts

virtual inline override

virtual inline bool accepts(IPacket *) override

Defined in src/vision/include/icy/vision/framesampler.h:107

This method ensures compatibility with the given packet type. Return false to reject the packet.

Reimplements

Private Attributes

ReturnNameDescription
FrameSamplerConfig_config
std::atomic< uint64_t >_seen
std::atomic< uint64_t >_forwarded
std::atomic< uint64_t >_dropped
std::atomic< int64_t >_lastForwardedTimeUsec

_config

FrameSamplerConfig _config

Defined in src/vision/include/icy/vision/framesampler.h:141


_seen

std::atomic< uint64_t > _seen {0}

Defined in src/vision/include/icy/vision/framesampler.h:142


_forwarded

std::atomic< uint64_t > _forwarded {0}

Defined in src/vision/include/icy/vision/framesampler.h:143


_dropped

std::atomic< uint64_t > _dropped {0}

Defined in src/vision/include/icy/vision/framesampler.h:144


_lastForwardedTimeUsec

std::atomic< int64_t > _lastForwardedTimeUsec {kUnsetTimeUsec}

Defined in src/vision/include/icy/vision/framesampler.h:145

Private Methods

ReturnNameDescription
boolshouldForward const inline

shouldForward

const inline

inline bool shouldForward(const av::PlanarVideoPacket & frame, uint64_t seen) const

Defined in src/vision/include/icy/vision/framesampler.h:124

Private Static Attributes

ReturnNameDescription
constexpr int64_tkUnsetTimeUsec static constexpr

kUnsetTimeUsec

static constexpr

constexpr int64_t kUnsetTimeUsec = std::numeric_limits<int64_t>::min()

Defined in src/vision/include/icy/vision/framesampler.h:115

Private Static Methods

ReturnNameDescription
FrameSamplerConfigsanitize static inline

sanitize

static inline

static inline FrameSamplerConfig sanitize(FrameSamplerConfig config)

Defined in src/vision/include/icy/vision/framesampler.h:117