Skip to content

Class videocomposer::InputSource

ClassList > videocomposer > InputSource

More...

  • #include <InputSource.h>

Inherited by the following classes: videocomposer::HAPVideoInput, videocomposer::LiveInputSource, videocomposer::VideoFileInput

Public Types

Type Name
enum CodecType
enum DecodeBackend

Public Functions

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

Detailed Description

Abstract base class for all input sources.

This interface allows different input types (video files, live video, streaming, etc.) to be used interchangeably. Each layer can have its own input source.

Public Types Documentation

enum CodecType

enum videocomposer::InputSource::CodecType {
    HAP,
    HAP_Q,
    HAP_ALPHA,
    H264,
    HEVC,
    AV1,
    SOFTWARE
};

Codec types supported by the system


enum DecodeBackend

enum videocomposer::InputSource::DecodeBackend {
    HAP_DIRECT,
    GPU_HARDWARE,
    CPU_SOFTWARE
};

Decode backend types


Public Functions Documentation

function close

virtual void videocomposer::InputSource::close () = 0

Close the input source and release resources


function detectCodec

virtual CodecType videocomposer::InputSource::detectCodec () const = 0

Detect the codec type of this input source

Returns:

CodecType enum value


function getCachedCPUFrame

inline const FrameBuffer * videocomposer::InputSource::getCachedCPUFrame () const

function getCachedFrameNumber

inline int64_t videocomposer::InputSource::getCachedFrameNumber () const

function getCachedGPUTexture

inline const GPUTextureFrameBuffer * videocomposer::InputSource::getCachedGPUTexture () const

function getCurrentFrame

virtual int64_t videocomposer::InputSource::getCurrentFrame () const = 0

Get the current frame number (last frame read)

Returns:

Current frame number, or -1 if not available


function getFrameInfo

virtual FrameInfo videocomposer::InputSource::getFrameInfo () const = 0

Get information about the video source

Returns:

FrameInfo structure with video properties


function getOptimalBackend

virtual DecodeBackend videocomposer::InputSource::getOptimalBackend () const = 0

Get the optimal decode backend for this input source

Returns:

DecodeBackend enum value indicating best decoding method


function hasCachedFrame

inline bool videocomposer::InputSource::hasCachedFrame () const

function invalidateCache

inline void videocomposer::InputSource::invalidateCache () 

function isCachedOnGPU

inline bool videocomposer::InputSource::isCachedOnGPU () const

function isLiveStream

inline virtual bool videocomposer::InputSource::isLiveStream () const

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

Returns:

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


function isReady

virtual bool videocomposer::InputSource::isReady () const = 0

Check if input source is ready/opened

Returns:

true if ready, false otherwise


function open

virtual bool videocomposer::InputSource::open (
    const std::string & source
) = 0

Open the input source

Parameters:

  • source Path or identifier for the source

Returns:

true on success, false on failure


function readFrame

virtual bool videocomposer::InputSource::readFrame (
    int64_t frameNumber,
    FrameBuffer & buffer
) = 0

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


function readLatestFrame

inline virtual bool videocomposer::InputSource::readLatestFrame (
    FrameBuffer & buffer
) 

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

Parameters:

Returns:

true on success, false on failure


function resetSeekState

inline virtual void videocomposer::InputSource::resetSeekState () 

Reset internal seek optimization state Call this before seek() to force a full seek even if the frame number is the same as the current position. Used for MTC full frame SYSEX position commands where we must seek regardless of current position.


function seek

virtual bool videocomposer::InputSource::seek (
    int64_t frameNumber
) = 0

Seek to a specific frame number

Parameters:

  • frameNumber Target frame number

Returns:

true on success, false on failure


function setCachedFrame [1/2]

inline void videocomposer::InputSource::setCachedFrame (
    int64_t frameNumber,
    const GPUTextureFrameBuffer & gpu
) 

function setCachedFrame [2/2]

inline void videocomposer::InputSource::setCachedFrame (
    int64_t frameNumber,
    const FrameBuffer & cpu
) 

function supportsDirectGPUTexture

virtual bool videocomposer::InputSource::supportsDirectGPUTexture () const = 0

Check if this input source supports direct GPU texture decoding HAP codecs can decode directly to OpenGL textures (zero-copy)

Returns:

true if direct GPU texture is supported


function ~InputSource

virtual videocomposer::InputSource::~InputSource () = default


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