Skip to content

Class videocomposer::LiveInputSource

ClassList > videocomposer > LiveInputSource

More...

  • #include <LiveInputSource.h>

Inherits the following classes: videocomposer::InputSource

Inherited by the following classes: videocomposer::FFmpegLiveInput, videocomposer::NDIVideoInput

Classes

Type Name
struct Statistics

Public Types inherited from videocomposer::InputSource

See videocomposer::InputSource

Type Name
enum CodecType
enum DecodeBackend

Public Functions

Type Name
LiveInputSource ()
int getBufferSize () const
int getBufferedFrameCount () const
Statistics getStatistics () const
bool isBufferEmpty () const
virtual bool isLiveStream () override const
virtual bool readFrame (int64_t frameNumber, FrameBuffer & buffer) override
virtual bool readLatestFrame (FrameBuffer & buffer) override
void resetStatistics ()
virtual bool seek (int64_t frameNumber) override
void setBufferSize (int frames)
virtual ~LiveInputSource ()

Public Functions inherited from videocomposer::InputSource

See videocomposer::InputSource

Type Name
virtual void close () = 0
virtual CodecType detectCodec () const = 0
const FrameBuffer * getCachedCPUFrame () const
int64_t getCachedFrameNumber () const
const GPUTextureFrameBuffer * getCachedGPUTexture () const
virtual int64_t getCurrentFrame () const = 0
virtual FrameInfo getFrameInfo () const = 0
virtual DecodeBackend getOptimalBackend () const = 0
bool hasCachedFrame () const
void invalidateCache ()
bool isCachedOnGPU () const
virtual bool isLiveStream () const
virtual bool isReady () const = 0
virtual bool open (const std::string & source) = 0
virtual bool readFrame (int64_t frameNumber, FrameBuffer & buffer) = 0
virtual bool readLatestFrame (FrameBuffer & buffer)
virtual void resetSeekState ()
virtual bool seek (int64_t frameNumber) = 0
void setCachedFrame (int64_t frameNumber, const GPUTextureFrameBuffer & gpu)
void setCachedFrame (int64_t frameNumber, const FrameBuffer & cpu)
virtual bool supportsDirectGPUTexture () const = 0
virtual ~InputSource () = default

Protected Functions

Type Name
virtual bool captureFrame (FrameBuffer & buffer) = 0
virtual const char * getSourceTypeName () const
void startCaptureThread ()
void stopCaptureThread ()

Detailed Description

LiveInputSource - Base class for live input sources (NDI, V4L2, RTSP, etc.)

Provides async frame capture with buffering to prevent frame drops. Live streams cannot seek, so they continuously capture frames in a background thread.

Features: * Circular frame buffer with configurable size * Move semantics for efficient frame handling * Statistics tracking (frames captured, dropped, errors) * Automatic error logging with threshold

Public Functions Documentation

function LiveInputSource

videocomposer::LiveInputSource::LiveInputSource () 

function getBufferSize

inline int videocomposer::LiveInputSource::getBufferSize () const

function getBufferedFrameCount

int videocomposer::LiveInputSource::getBufferedFrameCount () const

function getStatistics

Statistics videocomposer::LiveInputSource::getStatistics () const

function isBufferEmpty

bool videocomposer::LiveInputSource::isBufferEmpty () const

function isLiveStream

inline virtual bool videocomposer::LiveInputSource::isLiveStream () override const

Check if this is a live stream (no seeking, continuous reading)

Returns:

true for live streams (NDI, V4L2, RTSP), false for files

Implements videocomposer::InputSource::isLiveStream


function readFrame

virtual bool videocomposer::LiveInputSource::readFrame (
    int64_t frameNumber,
    FrameBuffer & buffer
) override

Read a frame at the given frame number

Parameters:

  • frameNumber Frame number to read
  • buffer FrameBuffer to store the decoded frame

Returns:

true on success, false on failure

Implements videocomposer::InputSource::readFrame


function readLatestFrame

virtual bool videocomposer::LiveInputSource::readLatestFrame (
    FrameBuffer & buffer
) override

For live streams: get the latest available frame Default implementation calls readFrame(0, buffer)

Parameters:

Returns:

true on success, false on failure

Implements videocomposer::InputSource::readLatestFrame


function resetStatistics

void videocomposer::LiveInputSource::resetStatistics () 

function seek

inline virtual bool videocomposer::LiveInputSource::seek (
    int64_t frameNumber
) override

Seek to a specific frame number

Parameters:

  • frameNumber Target frame number

Returns:

true on success, false on failure

Implements videocomposer::InputSource::seek


function setBufferSize

void videocomposer::LiveInputSource::setBufferSize (
    int frames
) 

function ~LiveInputSource

virtual videocomposer::LiveInputSource::~LiveInputSource () 

Protected Functions Documentation

function captureFrame

virtual bool videocomposer::LiveInputSource::captureFrame (
    FrameBuffer & buffer
) = 0

function getSourceTypeName

inline virtual const char * videocomposer::LiveInputSource::getSourceTypeName () const

function startCaptureThread

void videocomposer::LiveInputSource::startCaptureThread () 

function stopCaptureThread

void videocomposer::LiveInputSource::stopCaptureThread () 


The documentation for this class was generated from the following file src/cuems_videocomposer/cpp/input/LiveInputSource.h