Fixposition SDK 0.0.0-heads/main-0-g6a396b9
Collection of c++ libraries and apps for use with Fixposition products on Linux
Loading...
Searching...
No Matches
fpsdk::common::video::VideoFrameDecoder Class Referenceabstract

Helper for decoding video frames. More...

#include <video.hpp>

Collaboration diagram for fpsdk::common::video::VideoFrameDecoder:
[legend]

Public Member Functions

 VideoFrameDecoder (const VideoDecoderParams &params)
 Constructor.
virtual ~VideoFrameDecoder ()
 Destructor.
bool Init ()
 Initialise video decoder.
virtual std::optional< ImageDataDecodeFrame (const uint8_t *data, const std::size_t size)=0
 Decode one frame.
std::optional< ImageDataDecodeFrame (const std::vector< uint8_t > &data)
 Decode video data.
virtual bool IsOkay () const =0
 Check if decoder is in error state.

Protected Attributes

VideoDecoderParams params_
 Params.

Detailed Description

Helper for decoding video frames.

Note that separate instances of this should be used to process different video streams.

Definition at line 196 of file video.hpp.

Constructor & Destructor Documentation

◆ VideoFrameDecoder()

fpsdk::common::video::VideoFrameDecoder::VideoFrameDecoder ( const VideoDecoderParams & params)

Constructor.

Don't use, use the CreateVideoFrameDecoder() factory function.

Parameters
[in]paramsThe parameters

Member Function Documentation

◆ Init()

bool fpsdk::common::video::VideoFrameDecoder::Init ( )

Initialise video decoder.

Returns
true on success, false otherwise (bad params, failed to initialse stuff, ...)

◆ DecodeFrame() [1/2]

virtual std::optional< ImageData > fpsdk::common::video::VideoFrameDecoder::DecodeFrame ( const uint8_t * data,
const std::size_t size )
pure virtual

Decode one frame.

  • This works for data that is available frame by frame. That is, it does not work for regular video streams where the data is chunked arbitrarily. Ideally, start by supplying an I frame incl. all the necessary NAL units (NALUs) to decode a first frame. After that, the following P frames should decode fine.
  • For example, for HEVC (H.265) a full set of data for a I frame should contain:
    • NALU type 32 (VPS, Video Parameter Set)
    • NALU type 33 (SPS, Sequence Parameter Set)
    • NALU type 34 (PPS, Picture Parameter Set)
    • NALU type 19 (IDR, Instantaneous Decoding Refresh, and RADL, Random Access Decodable Leading) (possibly other types 16-23 (IRAP, Intra Random Access Point) NALUs might work)
  • The video encoder should be configured accordingly (to repeat the VPS/SPS/PPS for each I-frame, and possibly to produce all/only I frames.
Parameters
[in]dataData for one (not more, not less) video frame
[in]sizeSize of data
Returns
the decoded, converted and scaled image, nullptr otherwise (not enough data, bad data, ...)

◆ DecodeFrame() [2/2]

std::optional< ImageData > fpsdk::common::video::VideoFrameDecoder::DecodeFrame ( const std::vector< uint8_t > & data)

Decode video data.

Parameters
[in]dataData for one (recommended) or more video frame(s)
Returns
the decoded, converted and scaled image, nullptr otherwise (not enough data, bad data, ...)

◆ IsOkay()

virtual bool fpsdk::common::video::VideoFrameDecoder::IsOkay ( ) const
pure virtual

Check if decoder is in error state.

This is useful to check when DecodeFrame() didn't return a frame. If the decoder is in error state, it cannot be used anymore and must be discarded.

Returns
true if the decoder is okay, false if it is in error state

Member Data Documentation

◆ params_

VideoDecoderParams fpsdk::common::video::VideoFrameDecoder::params_
protected

Params.

Definition at line 262 of file video.hpp.


The documentation for this class was generated from the following file:
  • fpsdk_common/include/fpsdk_common/video.hpp