SmolRTSP 0.2.0
A small, portable, extensible RTSP 1.0 implementation in C99
Loading...
Searching...
No Matches
h266.h File Reference

H.266 / VVC NAL representation. More...

#include <stdbool.h>
#include <stdint.h>
#include <slice99.h>
#include <smolrtsp/priv/compiler_attrs.h>
Include dependency graph for h266.h:

Go to the source code of this file.

Data Structures

struct  SmolRTSP_H266NalHeader
 An H.266 NAL header (RFC 9328 §1.1.4 / VVC spec §7.3.1.2). More...
 
struct  SmolRTSP_H266NalUnit
 An H.266 NAL unit. More...
 

Macros

#define SMOLRTSP_H266_NAL_HEADER_SIZE   sizeof(uint16_t)
 The size of an H.266 NAL header.
 
#define SMOLRTSP_H266_FU_HEADER_SIZE    (/* payload-hdr */ sizeof(uint16_t) + /* fu-header */ sizeof(uint8_t))
 The size of an H.266 fragmentation unit (FU) header.
 
#define SMOLRTSP_H266_NAL_UNIT_TRAIL_NUT   0
 Coded slice of a non-STSA, non-RASL trailing picture (TRAIL).
 
#define SMOLRTSP_H266_NAL_UNIT_STSA_NUT   1
 Coded slice of a temporal sub-layer access (STSA) picture.
 
#define SMOLRTSP_H266_NAL_UNIT_RADL_NUT   2
 Coded slice of a random-access decodable leading (RADL) picture.
 
#define SMOLRTSP_H266_NAL_UNIT_RASL_NUT   3
 Coded slice of a random-access skipped leading (RASL) picture.
 
#define SMOLRTSP_H266_NAL_UNIT_IDR_W_RADL   7
 Coded slice of an IDR picture with associated RADL pictures.
 
#define SMOLRTSP_H266_NAL_UNIT_IDR_N_LP   8
 Coded slice of an IDR picture with no leading pictures.
 
#define SMOLRTSP_H266_NAL_UNIT_CRA_NUT   9
 Coded slice of a clean random-access (CRA) picture.
 
#define SMOLRTSP_H266_NAL_UNIT_GDR_NUT   10
 Coded slice of a gradual decoding refresh (GDR) picture.
 
#define SMOLRTSP_H266_NAL_UNIT_OPI_NUT   12
 Operating point information.
 
#define SMOLRTSP_H266_NAL_UNIT_DCI_NUT   13
 Decoding capability information.
 
#define SMOLRTSP_H266_NAL_UNIT_VPS_NUT   14
 Video parameter set.
 
#define SMOLRTSP_H266_NAL_UNIT_SPS_NUT   15
 Sequence parameter set.
 
#define SMOLRTSP_H266_NAL_UNIT_PPS_NUT   16
 Picture parameter set.
 
#define SMOLRTSP_H266_NAL_UNIT_PREFIX_APS_NUT   17
 Prefix adaptation parameter set.
 
#define SMOLRTSP_H266_NAL_UNIT_SUFFIX_APS_NUT   18
 Suffix adaptation parameter set.
 
#define SMOLRTSP_H266_NAL_UNIT_PH_NUT   19
 Picture header.
 
#define SMOLRTSP_H266_NAL_UNIT_AUD_NUT   20
 Access unit delimiter.
 
#define SMOLRTSP_H266_NAL_UNIT_EOS_NUT   21
 End of sequence.
 
#define SMOLRTSP_H266_NAL_UNIT_EOB_NUT   22
 End of bitstream.
 
#define SMOLRTSP_H266_NAL_UNIT_PREFIX_SEI_NUT   23
 Prefix supplemental enhancement information.
 
#define SMOLRTSP_H266_NAL_UNIT_SUFFIX_SEI_NUT   24
 Suffix supplemental enhancement information.
 
#define SMOLRTSP_H266_NAL_UNIT_FD_NUT   25
 Filler data.
 
#define SMOLRTSP_H266_NAL_UNIT_AP   28
 Aggregation Packet (RTP-only, RFC 9328 §4.3.2).
 
#define SMOLRTSP_H266_NAL_UNIT_FU   29
 Fragmentation Unit (RTP-only, RFC 9328 §4.3.3).
 

Functions

SmolRTSP_H266NalHeader SmolRTSP_H266NalHeader_parse (uint8_t bytes[restrict static 2]) SMOLRTSP_PRIV_MUST_USE
 Parses an H.266 NAL header from bytes.
 
uint16_t SmolRTSP_H266NalHeader_serialize (SmolRTSP_H266NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Converts self to a two-octet representation.
 
bool SmolRTSP_H266NalHeader_is_vps (SmolRTSP_H266NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is VPS.
 
bool SmolRTSP_H266NalHeader_is_sps (SmolRTSP_H266NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is SPS.
 
bool SmolRTSP_H266NalHeader_is_pps (SmolRTSP_H266NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is PPS.
 
bool SmolRTSP_H266NalHeader_is_coded_slice_idr (SmolRTSP_H266NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is a coded slice IDR (either IDR_W_RADL or IDR_N_LP).
 
bool SmolRTSP_H266NalHeader_is_coded_slice_non_idr (SmolRTSP_H266NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is a coded slice non-IDR (TRAIL_NUT, STSA_NUT, RADL_NUT, RASL_NUT, CRA_NUT, or GDR_NUT).
 
void SmolRTSP_H266NalHeader_write_fu_header (SmolRTSP_H266NalHeader self, uint8_t buffer[restrict], bool is_first_fragment, bool is_last_fragment)
 Writes an FU payload header and FU header for self into buffer.
 

Detailed Description

H.266 / VVC NAL representation.

See also
H.266 spec: https://www.itu.int/rec/T-REC-H.266.
RTP payload format: https://datatracker.ietf.org/doc/html/rfc9328.

Macro Definition Documentation

◆ SMOLRTSP_H266_FU_HEADER_SIZE

#define SMOLRTSP_H266_FU_HEADER_SIZE    (/* payload-hdr */ sizeof(uint16_t) + /* fu-header */ sizeof(uint8_t))

The size of an H.266 fragmentation unit (FU) header.

See also
https://datatracker.ietf.org/doc/html/rfc9328#section-4.3.3

◆ SMOLRTSP_H266_NAL_UNIT_AP

#define SMOLRTSP_H266_NAL_UNIT_AP   28

Aggregation Packet (RTP-only, RFC 9328 §4.3.2).

Carries two or more NAL units of one access unit in a single RTP packet.

◆ SMOLRTSP_H266_NAL_UNIT_FU

#define SMOLRTSP_H266_NAL_UNIT_FU   29

Fragmentation Unit (RTP-only, RFC 9328 §4.3.3).

Carries a fragment of a NAL unit that does not fit in one RTP packet.

Function Documentation

◆ SmolRTSP_H266NalHeader_write_fu_header()

void SmolRTSP_H266NalHeader_write_fu_header ( SmolRTSP_H266NalHeader  self,
uint8_t  buffer[restrict],
bool  is_first_fragment,
bool  is_last_fragment 
)

Writes an FU payload header and FU header for self into buffer.

Parameters
[in]selfThe header to write.
[out]bufferThe memory area capable of storing SMOLRTSP_H266_FU_HEADER_SIZE bytes.
[in]is_first_fragmentThe indication of a start of the FU.
[in]is_last_fragmentThe indication of an end of the FU.
See also
https://datatracker.ietf.org/doc/html/rfc9328#section-4.3.3