Frames¶
Frames encapsulate all data and signals that flow through a pipeline.
The base class is Limef::frame::Frame; subclasses are identified by
Limef::frame::FrameClass.
-
namespace frame¶
Frames encapsulate data and signals.
Enums
-
enum class BufferLocation¶
Location of frame buffer memory.
Used to track where the decoded frame data lives, enabling zero-copy pipelines when source and destination support the same buffer type.
Values:
-
enumerator CPU¶
System RAM (software decode or downloaded from GPU)
-
enumerator VAAPI¶
Intel/AMD GPU via VAAPI.
-
enumerator CUDA¶
NVIDIA GPU via CUDA.
-
enumerator DMABuf¶
Linux DMA buffer (V4L2, Jetson)
-
enumerator Vulkan¶
Vulkan image (future)
-
enumerator CPU¶
-
enum class FrameClass¶
Frame type identifier.
FrameClass identifies the type of frame. It is used by
Frameand inherited classes to identify themselves and to do pointer casting to the correct subclass ofFrame.Values:
-
enumerator Null¶
identifies test frame class
NullFrame
-
enumerator Packet¶
identifies class
PacketFrame
-
enumerator Codec¶
identifies class
CodecFrame
-
enumerator Decoded¶
identifies class
DecodedFrame
-
enumerator Signal¶
identifies class
SignalFrame
-
enumerator Raw¶
identifies class
RawFrame
-
enumerator Info¶
identifies class InfoFrame
-
enumerator Stream¶
identifies class
StreamFrame(raw/decoded stream info for encoders)
-
enumerator SDP¶
identifies class
SDPFrame(SDP for RTSP)
-
enumerator RTPPacket¶
identifies class
RTPPacketFrame(RTP/RTCP packets)
-
enumerator Tensor¶
identifies class
TensorFrame(general N-plane tensor, CPU or GPU)
-
enumerator Null¶
Functions
-
inline size_t alignSize(size_t size, size_t alignment = 32)¶
Align a size to the specified boundary. Used by some frame classes to de/serialize data.
- Parameters:
size – Size to align
alignment – Alignment boundary (must be power of 2). Default: 32 bytes = ffmpeg’s default alignment
- Returns:
size_t Aligned size
-
static void computeContiguousStrides(int ndim, const int64_t *shape, size_t elem_size, int64_t *strides)¶
Compute C-contiguous (row-major) strides for the given shape and element size.
Variables
-
constexpr int64_t RTP_NOPTS_VALUE = INT64_MIN¶
Sentinel value for invalid PTS/DTS (same as AV_NOPTS_VALUE)
-
static constexpr int TENSOR_MAX_PLANES = 4¶
-
static constexpr int TENSOR_MAX_DIMS = 4¶
-
class CodecFrame : public Limef::frame::Frame¶
- #include <codecframe.h>
A frame containing stream information for decoders.
Manages an internal
AVFormatContextandAVStreams and contains minimal stream information required by decoders:Codec parameters
Time base
Frame rates
Downstream decoders use this information to initialize their decoder contexts.
Subclassed by Limef::frame::StreamFrame
Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
virtual void reset() override¶
Resets the state of the frame (if any)
-
virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
virtual void updateFrom(const Frame *other_) override¶
Updates the current frame (copy operation) using the input frame.
-
virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
void addStream(const AVStream *src)¶
Add a stream to internal format context.
Copies essential stream information:
Codec parameters
Time base
Frame rates
- Parameters:
src – Source stream to copy from
- Throws:
std::runtime_error – on allocation or copy failure
-
void addStreamFromCodecParams(const AVCodecParameters *params, AVRational timebase, AVRational framerate, int stream_index = 0)¶
Add a stream from codec parameters (for encoder output)
Creates a synthetic stream from just AVCodecParameters. Used when an encoder produces codec info that downstream decoders need.
- Parameters:
params – Codec parameters (from encoder’s getCodecParams())
timebase – Time base for the stream (e.g., {1, 1000000} for microseconds)
framerate – Frame rate (e.g., {30, 1} for 30fps)
stream_index – Index for this stream (default 0)
- Throws:
std::runtime_error – on allocation or copy failure
-
bool updateExtradata(int stream_index, const uint8_t *extradata, size_t extradata_size)¶
Update extradata for a stream.
Updates just the extradata for an existing stream without rebuilding the entire CodecFrame. Useful when extradata is extracted from the bitstream after the initial CodecFrame was created.
- Parameters:
stream_index – Index of the stream to update
extradata – Pointer to extradata bytes
extradata_size – Size of extradata in bytes
- Returns:
true if update succeeded, false if stream not found
-
const AVStream *getVideoStream() const¶
Get the video stream if present.
- Returns:
const AVStream* Pointer to video stream or nullptr if not found
-
inline std::chrono::microseconds getVideoFrameDuration() const¶
Get the video frame duration.
Returns the cached frame duration calculated from the video stream’s avg_frame_rate when addStream() was called. Returns 0 if no video stream.
- Returns:
Frame duration in microseconds
-
inline const AVFormatContext *getFormatContext() const¶
Get the internal format context.
- Returns:
const AVFormatContext* Pointer to format context
-
inline AVFormatContext *getFormatContextMutable()¶
Mutable version.
-
class DecodedFrame : public Limef::frame::Frame¶
- #include <decodedframe.h>
Frame containing either decoded video, audio data or both.
A unified frame class for handling both decoded video and audio frames. Contains two pre-allocated AVFrames that adapt to the maximum required size for their respective media types. Works with the FrameFifo pre-allocated stack system for efficient memory management.
Has both video and audio interal AVFrame’s of which either one is active.
Usage example:
DecodedFrame* frame = framefifo.getFrame(); // For video if (frame->reserveVideo(1920, 1080, AV_PIX_FMT_YUV420P)) { // frame ready for video data } // For audio if (frame->reserveAudio(44100, 2, AV_SAMPLE_FMT_S16, 1024)) { // frame ready for audio data } // Switch frame mode to video: frame->setMediaType(MediaType::Video)
Public Types
Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
virtual void reset() noexcept override¶
Reset frame for reuse from stack.
Keeps memory allocated but resets internal state. Both video and audio frames are kept but marked as unused.
-
virtual Frame *clone() const override¶
Create a new frame for stack allocation.
- Returns:
Frame* New DecodedFrame instance
-
virtual void updateFrom(const Frame *other) override¶
Copy data from another frame.
Called when frame is pulled from stack. Reuses existing memory when possible, growing buffers if needed.
- Parameters:
other – Source frame to copy from
-
virtual std::string dump() const override¶
Create string representation of frame state.
- Returns:
std::string Frame information
-
inline int getWidth() const noexcept¶
If current active type is video, return video width
-
inline int getHeight() const noexcept¶
If current active type is video, return video height
-
inline AVPixelFormat getVideoFormat() const noexcept¶
If current active type is video, return video format
-
inline bool isHWFrame() const noexcept¶
If current active type is video, return true if it is a hardware frame/format
-
inline BufferLocation location() const noexcept¶
Get the location of the frame buffer.
-
inline bool isOnCPU() const noexcept¶
Check if frame data is on CPU.
-
inline bool isOnGPU() const noexcept¶
Check if frame data is on GPU/hardware.
-
inline int dmaBufFd() const noexcept¶
Get DMA-buf file descriptor (returns -1 if not a DMA-buf frame)
-
inline void setDMABufFd(int fd) noexcept¶
Set DMA-buf file descriptor (for V4L2 backend)
-
inline void setTargetHWPool(AVBufferRef *pool) noexcept¶
Set target HW frames pool for GPU→GPU copy in updateFrom()
When set, updateFrom() will allocate from this pool and do a true GPU→GPU copy instead of just referencing the source buffer. Used by FrameFifo to ensure stack frames own their GPU buffers.
- Parameters:
pool – The hw_frames_ctx pool to allocate from (not owned, must outlive frame)
-
inline AVBufferRef *getTargetHWPool() const noexcept¶
Get the target HW pool (nullptr if not set)
-
const uint8_t *getCPUData(int plane = 0) const¶
Get CPU-accessible data for a plane.
For CPU frames, returns the data directly. For GPU frames, triggers a copy to CPU cache on first call, then returns cached data.
- Parameters:
plane – Plane index (0 for Y, 1 for U, 2 for V in YUV)
- Returns:
Pointer to plane data, or nullptr if unavailable
-
bool materializeToCPU()¶
Explicitly copy frame data from GPU to CPU.
After this call, getCPUData() will return valid CPU pointers.
- Returns:
true if materialization succeeded or frame already on CPU
-
inline int getSampleRate() const noexcept¶
If current active type is audio, return sample rate
-
inline const AVChannelLayout *getChannelLayout() const noexcept¶
If current active type is audio, return channel layout
-
inline AVSampleFormat getAudioFormat() const noexcept¶
If current active type is audio, return sample fmt
-
inline void setTimeBase(const AVRational &tb) noexcept¶
Set the timebase of this frame’s timestamps
-
inline AVRational getTimeBase() const noexcept¶
Get the timebase of this frame’s timestamps
-
std::chrono::microseconds getTimestamp() const noexcept¶
Returns the active frame’s PTS in microseconds (rescaled via time_base)
-
void setTimestamp(std::chrono::microseconds ts) noexcept¶
Sets the active frame’s PTS from microseconds (rescaled via time_base)
-
inline const AVFrame *getFrame() const noexcept¶
Get currently active frame.
- Returns:
const AVFrame* Either video or audio frame based on media_type
-
bool reserveVideo(int width, int height, AVPixelFormat format, AVBufferRef *hw_ctx = nullptr)¶
Reserve space for video frame.
Allocates or reuses memory for video frame. Sets media type to Video on success.
- Parameters:
width – Frame width
height – Frame height
format – Pixel format
hw_ctx – Hardware context (nullptr for SW frames)
- Returns:
true if allocation successful
-
bool reserveAudio(int sample_rate, const AVChannelLayout &ch_layout, AVSampleFormat format, int nb_samples)¶
Reserve space for audio frame.
- Parameters:
sample_rate – Audio sample rate
ch_layout – Channel layout
format – Sample format
nb_samples – Number of samples per channel
- Returns:
true if allocation successful
-
virtual size_t serialize(uint8_t *buffer, size_t buffer_size) override¶
Serialize frame to a byte buffer with memory alignment.
Produces a buffer with aligned data suitable for memory mapping
Writes all data it can - the return value indicates the number of bytes that would have been required to write all data
- Parameters:
buffer – Output buffer to hold serialized data
buffer_size – Size of the provided output buffer
-
virtual bool deserialize(const uint8_t *buffer, size_t buffer_size) override¶
Deserialize frame from a byte buffer.
- Parameters:
buffer – Input buffer containing serialized data
buffer_size – Size of the provided input
-
inline bool hasOverflow() const noexcept¶
Check if overflow was detected during the last deserialization.
This flag is set during deserialization if the buffer didn’t contain enough data for the complete frame.
- Returns:
true If overflow was detected
- Returns:
false If no overflow was detected
-
inline virtual FrameClass getFrameClass() const noexcept override¶
-
class Frame¶
- #include <frame.h>
Frame base class.
Frame class uses intentionally raw pointers, not unique or shared pointers. The object lifetime is managed by the
FrameFifoclass. Frame subclasses are used to encapsulate almost anything:Payload packets
Decoded frames (bitmap and raw audio)
FFMpeg’s AVFormatContext to inform downstream threads and framefilters about the stream
Signals to inform downstream framefilters and threads about their tasks
etc.
FrameFifosubclasses typically make copies of frames for downstream using the (1)Frame::updateFrommethod or with the (2)Frame::clone` method.(1) copies data between existing frames, always trying to minimize memory (re)allocations. Think if it as a “delta” copying: apply just a delta to modify the target frame.
(2) uses the copy constructor to create a new frame and reserves memory from scratch.
The = operator (3) is a copy-operator like (1), but is more carefree: i.e. just copies from source to target without caring much about the efficiency / if there are mem reallocs.
On many occacions, (1) may just internally use (3).
For each subclass, you also need to define a static method called
staticFrameClass()that is used inFrame::asto identify the frame:static FrameClass staticFrameClass() { return FrameClass::Null; }
Subclassed by Limef::frame::CodecFrame, Limef::frame::DecodedFrame, Limef::frame::InfoFrame, Limef::frame::NullFrame, Limef::frame::PacketFrame, Limef::frame::RTPPacketFrame, Limef::frame::RawFrame, Limef::frame::SDPFrame, Limef::frame::SignalFrame, Limef::frame::TensorFrame
Public Functions
-
virtual FrameClass getFrameClass() const noexcept = 0¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
virtual void reset() = 0¶
Resets the state of the frame (if any)
-
virtual Frame *clone() const = 0¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
inline Slot getSlot() const noexcept¶
Get slot value.
-
inline void setSlot(const Slot slot_) noexcept¶
Set slot value.
-
virtual std::string dump() const = 0¶
Returns a one-liner string representation of the frame.
-
inline virtual bool deserialize(const uint8_t *buffer, size_t buffer_size)¶
Serialize frame into bytes.
Public Static Functions
Set the logger for all Frame classes.
- Parameters:
logger_instance – Logger to use
-
static inline void setLogLevel(spdlog::level::level_enum level)¶
Set the log level for the Frame logger.
- Parameters:
level – Log level to set
-
static inline std::shared_ptr<spdlog::logger> getLogger()¶
Get the current logger instance.
- Returns:
std::shared_ptr<spdlog::logger> Current logger
-
class InfoFrame : public Limef::frame::Frame¶
- #include <infoframe.h>
Frame for carrying diagnostic/status messages.
Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
inline virtual void reset() noexcept override¶
Resets the state of the frame (if any)
-
inline virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
virtual void updateFrom(const Frame *other_) override¶
Updates the current frame (copy operation) using the input frame.
-
virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
inline virtual FrameClass getFrameClass() const noexcept override¶
-
class NullFrame : public Limef::frame::Frame¶
- #include <frame.h>
A dummy / placeholder frame class.
Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
inline virtual void reset() noexcept override¶
Resets the state of the frame (if any)
-
inline virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
inline virtual void updateFrom(const Frame *other) override¶
Updates the current frame (copy operation) using the input frame.
-
inline virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
inline virtual FrameClass getFrameClass() const noexcept override¶
-
class PacketFrame : public Limef::frame::Frame¶
- #include <packetframe.h>
A Frame object encapsulating an FFmpeg AVPacket.
PacketFrame represents a demuxed video stream and encapsulates an AVPacket structure.
AVPacket encapsulates the payload and various metadata resulting from the demuxing process.
Copy ctor and operator take care of the proper copying of the underlying AVPacket. So does
PacketFrame::updateFrom.Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
virtual void reset() noexcept override¶
Resets the state of the frame (if any)
-
virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
virtual void updateFrom(const Frame *other) override¶
Updates the current frame (copy operation) using the input frame.
-
std::chrono::microseconds getTimestamp() const noexcept¶
Returns internal AVPacket PTS timestamp in microseconds.
-
std::chrono::microseconds getDTSTimestamp() const noexcept¶
Returns internal AVPacket DTS timestamp in microseconds.
-
void setTimestamp(std::chrono::microseconds ts) noexcept¶
Sets internal AVPacket timestamp in microseconds.
-
virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
inline const AVPacket *getPacket() const noexcept¶
Returns the internal AVPacket.
-
inline AVPacket *getPacketMutable() const noexcept¶
Returns the internal AVPacket.
-
void setPacket(const AVPacket *src)¶
Sets the internal AVPacket.
-
void setData(const uint8_t *data, int size, bool shrink = false)¶
Set AVPacket’s payload data.
-
std::string dumpFirstNBytes(size_t n) const¶
Returns a string that peeks into AVPacket’s payload data.
-
std::string dumpPacketInfo(size_t bytesToDump = 16) const¶
Returns a string that dymps first n bytes of AVPacket’s payload.
-
inline void setMediaType(AVMediaType type) noexcept¶
Set the media type of this packet
-
inline void setTimeBase(const AVRational &tb) noexcept¶
Set the timebase of this packet’s timestamps
-
inline AVRational getTimeBase() const noexcept¶
Get the timebase of this packet’s timestamps
-
inline AVMediaType getMediaType() const noexcept¶
Get the media type of this packet
-
inline bool isVideo() const noexcept¶
Convenience method: check if the packet is video
-
inline bool isAudio() const noexcept¶
Convenience method: check if the packet is audio
-
inline virtual FrameClass getFrameClass() const noexcept override¶
-
struct Plane¶
- #include <tensorframe.h>
One plane of a TensorFrame.
Either CPU-only (data_ set, d_data_ nullptr) or GPU-only (d_data_ set, data_ nullptr). Mixed CPU+GPU in the same plane is not supported.
Fields are intentionally public — consumers read them directly without getters, just as with AVFrame::data[] / linesize[].
Public Functions
-
inline size_t contentBytes() const noexcept¶
Total content bytes: shape[0] * strides[0].
For contiguous planes this equals elementSize * product(shape). Returns 0 if the plane is empty (ndim == 0).
Public Members
-
uint8_t *data_ = nullptr¶
CPU pointer (nullptr if GPU-only)
-
uint8_t *d_data_ = nullptr¶
GPU device pointer (nullptr if CPU-only)
-
int64_t shape[TENSOR_MAX_DIMS] = {}¶
Logical dimensions (active: shape[0..ndim-1])
-
int64_t strides[TENSOR_MAX_DIMS] = {}¶
Byte strides per dimension (C-contiguous by default)
-
int ndim = 0¶
Number of active dimensions.
-
size_t nbytes = 0¶
Allocated bytes (grow-only — never shrinks)
-
int device_id = 0¶
CUDA device id (ignored for CPU planes)
-
inline size_t contentBytes() const noexcept¶
-
class RawFrame : public Limef::frame::Frame¶
- #include <rawframe.h>
Frame containing raw muxed stream data.
Encapsulates raw bytes from a muxed media stream. This can be used for both pre-muxed input streams and muxer outputs. The frame simply holds a buffer of bytes without interpreting them - the actual interpretation is done by muxers/demuxers.
Example usage:
RawFrame frame; frame.setData(buffer, size); // Copy data from buffer // Get pointer to internal data const uint8_t* data = frame.getData(); size_t size = frame.getSize();
Public Types
Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
virtual void reset() noexcept override¶
Resets the state of the frame (if any)
-
virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
virtual void updateFrom(const Frame *other) override¶
Updates the current frame (copy operation) using the input frame.
-
virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
void setData(const uint8_t *data, size_t size, bool shrink = false)¶
Set frame data content.
Copies data into internal buffer. If current capacity is insufficient, buffer will be reallocated unless shrink is false.
- Parameters:
data – Source data pointer
size – Size of data in bytes
shrink – If true, buffer will be shrunk if significantly larger than needed
-
inline const uint8_t *getData() const noexcept¶
Get pointer to internal data buffer.
-
inline size_t getSize() const noexcept¶
Get current data size in bytes.
-
inline size_t getCapacity() const noexcept¶
Get allocated buffer capacity.
-
std::string peekBytes(size_t n) const¶
Peek at first N bytes of data.
Useful for debugging and logging.
- Parameters:
n – Number of bytes to peek at
- Returns:
std::string Hexadecimal representation of bytes
-
DataFormat getDataFormat() const noexcept¶
Get the data format.
- Returns:
DataFormat Format of the contained data
-
void setDataFormat(DataFormat format)¶
Set the data format.
- Parameters:
format – Format of the contained data
-
virtual size_t serialize(uint8_t *buffer, size_t buffer_size) override¶
Serialize frame to a byte buffer with memory alignment.
Produces a buffer with aligned data suitable for memory mapping
Writes all data it can - the return value indicates the number of bytes that would have been required to write all data
- Parameters:
buffer – Output buffer to hold serialized data
buffer_size – Size of the provided output buffer
-
virtual bool deserialize(const uint8_t *buffer, size_t buffer_size) override¶
Deserialize frame from a byte buffer.
- Parameters:
buffer – Input buffer containing serialized data
buffer_size – Size of the provided input
-
inline bool hasOverflow() const noexcept¶
Check if overflow was detected during the last deserialization.
This flag is set during deserialization if the buffer didn’t contain enough data for the complete frame.
- Returns:
true If overflow was detected
- Returns:
false If no overflow was detected
-
inline virtual FrameClass getFrameClass() const noexcept override¶
-
class RTPPacketFrame : public Limef::frame::Frame¶
- #include <rtppacketframe.h>
Frame containing RTP or RTCP packet data.
Used to carry individual RTP/RTCP packets from RTPMuxerFrameFilter to RTSPServerThread for transmission to clients.
Example usage:
RTPPacketFrame rtp; rtp.setData(packet_bytes, packet_size); rtp.setTrackIndex(0); // video track rtp.setPacketType(RTPPacketFrame::PacketType::RTP); pass(&rtp);
Public Types
Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
virtual void reset() noexcept override¶
Resets the state of the frame (if any)
-
inline virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
virtual void updateFrom(const Frame *other) override¶
Updates the current frame (copy operation) using the input frame.
-
virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
void setData(const uint8_t *data, size_t size, bool shrink = false)¶
Set packet data.
Copies data into internal buffer. Buffer grows as needed but doesn’t shrink unless explicitly requested.
- Parameters:
data – Source data pointer
size – Size of data in bytes
shrink – If true, buffer will be shrunk if significantly larger than needed
-
inline const uint8_t *getData() const noexcept¶
Get pointer to internal data buffer.
-
inline size_t getSize() const noexcept¶
Get current data size in bytes.
-
inline size_t getCapacity() const noexcept¶
Get allocated buffer capacity.
-
inline PacketType getPacketType() const noexcept¶
Get packet type (RTP or RTCP)
-
inline void setPacketType(PacketType type) noexcept¶
Set packet type.
-
inline int getTrackIndex() const noexcept¶
Get track index (0=video, 1=audio, etc.)
-
inline void setTrackIndex(int index) noexcept¶
Set track index.
-
inline bool isKeyframe() const noexcept¶
Check if this packet is from a keyframe (video only)
-
inline void setKeyframe(bool kf) noexcept¶
Set keyframe flag.
-
inline int64_t getPTS() const noexcept¶
Get PTS (presentation timestamp)
-
inline void setPTS(int64_t pts) noexcept¶
Set PTS.
-
inline int64_t getDTS() const noexcept¶
Get DTS (decode timestamp)
-
inline void setDTS(int64_t dts) noexcept¶
Set DTS.
-
std::string peekBytes(size_t n) const¶
Peek at first N bytes of data (for debugging)
- Parameters:
n – Number of bytes to peek at
- Returns:
std::string Hexadecimal representation of bytes
-
inline virtual FrameClass getFrameClass() const noexcept override¶
-
class SDPFrame : public Limef::frame::Frame¶
- #include <sdpframe.h>
Frame containing SDP (Session Description Protocol) data.
Used to pass SDP information downstream, typically from RTPMuxerFrameFilter to RTSPServerThread for DESCRIBE responses.
Example usage:
SDPFrame sdp; sdp.setSDP("v=0\r\no=- ...\r\n"); sdp.setSlot(1); pass(&sdp);
Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
inline virtual void reset() noexcept override¶
Resets the state of the frame (if any)
-
inline virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
virtual void updateFrom(const Frame *other) override¶
Updates the current frame (copy operation) using the input frame.
-
virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
inline const std::string &getSDP() const noexcept¶
Get the SDP string.
-
inline void setSDP(const std::string &sdp)¶
Set the SDP string.
-
inline virtual FrameClass getFrameClass() const noexcept override¶
-
class SignalFrame : public Limef::frame::Frame¶
- #include <signalframe.h>
Encapsulates
Signalobjects.Encapsulates signals that can be passed to
Thread’s andFrameFilters.Public Functions
-
inline explicit SignalFrame(const Limef::signal::Signal &signal)¶
Default ctor.
- Parameters:
signal – a
Signalcarried by this frame
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
inline virtual void reset() noexcept override¶
Resets the state of the frame (if any)
-
inline virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
virtual void updateFrom(const Frame *other) override¶
Updates the current frame (copy operation) using the input frame.
-
virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
template<typename T>
inline const T *asSignal() const¶ Returns and casts to correct signal type.
Returns the signal carried by this frame, casted to the type implied by the template type:
If the signal is not of the desired type, returns nullptr.const auto* basicSignal = signalFrame->template asSignal<BasicSignal>()
-
inline explicit SignalFrame(const Limef::signal::Signal &signal)¶
-
class StreamFrame : public Limef::frame::CodecFrame¶
- #include <streamframe.h>
A frame containing stream information for raw/decoded sources.
StreamFrame is a subclass of CodecFrame, used to carry stream metadata from raw or decoded sources to downstream encoders.
While CodecFrame carries encoded stream info (codec parameters, extradata) for decoders, StreamFrame carries raw stream info (dimensions, format, timing) for encoders.
The distinction allows the pipeline to detect misrouted frames:
DecodingFrameFilter expects CodecFrame (encoded stream)
EncodingFrameFilter expects StreamFrame (raw/decoded stream)
Internally uses the same AVFormatContext/AVStream mechanism as CodecFrame, but the codec_id will typically be AV_CODEC_ID_RAWVIDEO or AV_CODEC_ID_PCM_*.
Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
inline virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
inline virtual void updateFrom(const Frame *other_) override¶
Updates the current frame (copy operation) using the input frame.
-
virtual bool deserialize(const uint8_t *buffer, size_t buffer_size) override¶
Serialize frame into bytes.
-
inline virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
class TensorFrame : public Limef::frame::Frame¶
- #include <tensorframe.h>
General-purpose multi-plane tensor frame, decoupled from FFmpeg.
Planes are reserved explicitly with reserveCPUPlane() / reserveGPUPlane(). Memory is grow-only — buffers are reused across frames of the same or smaller size, reallocated only when a larger frame arrives.
Public Functions
-
inline virtual FrameClass getFrameClass() const noexcept override¶
Return
Frame’s type.Return’s Frame’s
Limef::FrameClassthat can be used to identify the subclass of the Frame. You can use it like this:frame->getFrameClass() == FrameClass::Packet
-
virtual void reset() noexcept override¶
Resets the state of the frame (if any)
-
virtual Frame *clone() const override¶
Returns a cloned frame. Implement carefully! Is used extensively by
Limef::FrameFifo.
-
virtual void updateFrom(const Frame *other) override¶
Updates the current frame (copy operation) using the input frame.
-
virtual std::string dump() const override¶
Returns a one-liner string representation of the frame.
-
bool reserveCPUPlane(int plane_idx, int ndim, const int64_t *shape, DType dtype)¶
Allocate or reuse a CPU plane.
Allocates a contiguous (C-order) buffer large enough for the given shape and dtype. Grow-only: if the existing buffer is already large enough, it is reused and only the metadata is updated.
- Parameters:
plane_idx – Index of plane to allocate (0 .. TENSOR_MAX_PLANES-1)
ndim – Number of dimensions
shape – Array of ndim dimension sizes
dtype – Element type
- Returns:
true on success
Public Members
-
Plane planes[TENSOR_MAX_PLANES]¶
Plane array — read/write access.
-
inline virtual FrameClass getFrameClass() const noexcept override¶
-
enum class BufferLocation¶