ifm3d
ifm3d::rtsp::VideoDecoder Class Referenceabstract

Abstract H.264 (etc.) video decoder. More...

#include <ifm3d/rtsp/video_decoder.h>

Public Member Functions

virtual int SendPacket (const std::uint8_t *data, int size, std::uint64_t pts)=0
 Push one unit of compressed data into the decoder. More...
 
virtual int ReceiveFrame (VideoFrame &out)=0
 Pull a decoded frame. More...
 
virtual int Flush ()
 Optional: flush buffered frames at end-of-stream.
 
virtual std::string LastError () const
 Optional: a human-readable description of the last error.
 

Protected Member Functions

 VideoDecoder (const VideoDecoder &)=default
 
VideoDecoderoperator= (const VideoDecoder &)=default
 
 VideoDecoder (VideoDecoder &&)=default
 
VideoDecoderoperator= (VideoDecoder &&)=default
 

Detailed Description

Abstract H.264 (etc.) video decoder.

Instances are created through VideoDecoderFactory::CreateDecoder and owned by the caller (via std::unique_ptr).

Member Function Documentation

◆ ReceiveFrame()

virtual int ifm3d::rtsp::VideoDecoder::ReceiveFrame ( VideoFrame out)
pure virtual

Pull a decoded frame.

Call repeatedly until it reports that no further frame is available.

out.pts identifies the SendPacket call this frame was decoded from. It is not necessarily the most recent one: an H.264 stream whose SPS advertises max_num_reorder_frames > 0 makes libavcodec hold frames back, so output routinely lags input by a fixed number of packets.

Returns
1 = frame ready in out, 0 = no further frame can be built from the data submitted so far, negative = error.

◆ SendPacket()

virtual int ifm3d::rtsp::VideoDecoder::SendPacket ( const std::uint8_t *  data,
int  size,
std::uint64_t  pts 
)
pure virtual

Push one unit of compressed data into the decoder.

Parameters
datacompressed payload, valid for the duration of the call.
sizesize of data in bytes.
ptsan opaque, caller-chosen identifier for this packet. The decoder does not interpret it; it only stores it and returns it on the VideoFrame decoded from this packet. Callers should keep it unique across the packets that may be in flight at once. Implementations that have no natural place to put it must carry it themselves.
Returns
0 on success, negative on error.

The documentation for this class was generated from the following file: