Sunshine master
Self-hosted game stream host for Moonlight.
cbs.h File Reference

Declarations for FFmpeg Coded Bitstream API. More...

#include "utility.h"
Include dependency graph for cbs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cbs::h264_t
 H.264 parameter set before and after VUI rewriting. More...
 
struct  cbs::hevc_t
 HEVC parameter sets before and after VUI rewriting. More...
 
struct  cbs::nal_t
 Original and rewritten bytes for one codec NAL unit. More...
 

Functions

h264_t cbs::make_sps_h264 (const AVCodecContext *avctx, const AVPacket *packet)
 Build replacement H.264 SPS bytes with Sunshine-required VUI fields.
 
hevc_t cbs::make_sps_hevc (const AVCodecContext *avctx, const AVPacket *packet)
 Build replacement HEVC VPS/SPS bytes with Sunshine-required VUI fields.
 
bool cbs::validate_sps (const AVPacket *packet, int codec_id)
 Check whether an encoded H.264 or HEVC packet contains active SPS VUI metadata.
 

Detailed Description

Declarations for FFmpeg Coded Bitstream API.

Function Documentation

◆ make_sps_h264()

h264_t cbs::make_sps_h264 ( const AVCodecContext * ctx,
const AVPacket * packet )

Build replacement H.264 SPS bytes with Sunshine-required VUI fields.

Build an H.264 replacement SPS for a packet.

Parameters
ctxFFmpeg codec context that provides colorimetry and reference-frame metadata.
packetEncoded packet containing the original SPS.
Returns
Original and rewritten SPS bytes.

◆ make_sps_hevc()

hevc_t cbs::make_sps_hevc ( const AVCodecContext * ctx,
const AVPacket * packet )

Build replacement HEVC VPS/SPS bytes with Sunshine-required VUI fields.

Build HEVC replacement parameter sets for a packet.

Parameters
ctxFFmpeg codec context that provides colorimetry and reference-frame metadata.
packetEncoded packet containing the original VPS and SPS.
Returns
Original and rewritten VPS/SPS bytes.

◆ validate_sps()

bool cbs::validate_sps ( const AVPacket * packet,
int codec_id )

Check whether an encoded H.264 or HEVC packet contains active SPS VUI metadata.

Parameters
packetEncoded packet to parse with FFmpeg's coded bitstream reader.
codec_idFFmpeg codec identifier; expected to be AV_CODEC_ID_H264 or AV_CODEC_ID_H265.
Returns
true when the packet's active SPS advertises VUI parameters.