SmolRTSP  0.1.3
A small, portable, extensible RTSP 1.0 implementation in C99
h264.h File Reference

H.264 NAL representation. More...

#include <stdbool.h>
#include <stdint.h>
#include <slice99.h>
#include <smolrtsp/priv/compiler_attrs.h>
Include dependency graph for h264.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SmolRTSP_H264NalHeader
 An H.264 NAL header. More...
 
struct  SmolRTSP_H264NalUnit
 An H.264 NAL unit. More...
 

Macros

#define SMOLRTSP_H264_NAL_HEADER_SIZE   sizeof(uint8_t)
 The size of an H.264 NAL header.
 
#define SMOLRTSP_H264_FU_HEADER_SIZE    (/* fu-identifier */ sizeof(uint8_t) + /* fu-header */ sizeof(uint8_t))
 The size of an H.264 fragmentation unit (FU) header. More...
 
#define SMOLRTSP_H264_NAL_UNIT_UNSPECIFIED   0
 Unspecified.
 
#define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_NON_IDR   1
 Coded slice of a non-IDR picture.
 
#define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_DATA_PARTITION_A   2
 Coded slice data partition A.
 
#define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_DATA_PARTITION_B   3
 Coded slice data partition B.
 
#define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_DATA_PARTITION_C   4
 Coded slice data partition C.
 
#define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_IDR   5
 Coded slice of an IDR picture.
 
#define SMOLRTSP_H264_NAL_UNIT_SEI   6
 Supplemental enhancement information (SEI).
 
#define SMOLRTSP_H264_NAL_UNIT_SPS   7
 Sequence parameter set.
 
#define SMOLRTSP_H264_NAL_UNIT_PPS   8
 Picture parameter set.
 
#define SMOLRTSP_H264_NAL_UNIT_AUD   9
 Access unit delimiter.
 
#define SMOLRTSP_H264_NAL_UNIT_END_OF_SEQUENCE   10
 End of sequence.
 
#define SMOLRTSP_H264_NAL_UNIT_END_OF_STREAM   11
 End of stream.
 
#define SMOLRTSP_H264_NAL_UNIT_FILLER   12
 Filler data.
 
#define SMOLRTSP_H264_NAL_UNIT_SPS_EXT   13
 Sequence parameter set extension.
 
#define SMOLRTSP_H264_NAL_UNIT_PREFIX   14
 Prefix NAL unit.
 
#define SMOLRTSP_H264_NAL_UNIT_SUBSET_SPS   15
 Subset sequence parameter set.
 
#define SMOLRTSP_H264_NAL_UNIT_DPS   16
 Depth parameter set.
 
#define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_AUX   19
 Coded slice of an auxiliary coded picture without partitioning.
 
#define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_EXT   20
 Coded slice extension.
 
#define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_EXT_DEPTH_VIEW   21
 Coded slice extension for a depth view component or a 3D-AVC texture view component.
 

Functions

SmolRTSP_H264NalHeader SmolRTSP_H264NalHeader_parse (uint8_t byte_header) SMOLRTSP_PRIV_MUST_USE
 Parses an H.264 NAL header from byte_header.
 
uint8_t SmolRTSP_H264NalHeader_serialize (SmolRTSP_H264NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Converts self to a single octet representation.
 
bool SmolRTSP_H264NalHeader_is_vps (SmolRTSP_H264NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is VPS.
 
bool SmolRTSP_H264NalHeader_is_sps (SmolRTSP_H264NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is SPS.
 
bool SmolRTSP_H264NalHeader_is_pps (SmolRTSP_H264NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is PPS.
 
bool SmolRTSP_H264NalHeader_is_coded_slice_idr (SmolRTSP_H264NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is a coded slice IDR.
 
bool SmolRTSP_H264NalHeader_is_coded_slice_non_idr (SmolRTSP_H264NalHeader self) SMOLRTSP_PRIV_MUST_USE
 Checks whether self is a coded slice non-IDR.
 
void SmolRTSP_H264NalHeader_write_fu_header (SmolRTSP_H264NalHeader self, uint8_t buffer[restrict], bool is_first_fragment, bool is_last_fragment)
 Writes a FU header of self to buffer. More...
 

Detailed Description

H.264 NAL representation.

See also
H.264 spec: https://www.itu.int/rec/T-REC-H.264.

Macro Definition Documentation

◆ SMOLRTSP_H264_FU_HEADER_SIZE

#define SMOLRTSP_H264_FU_HEADER_SIZE    (/* fu-identifier */ sizeof(uint8_t) + /* fu-header */ sizeof(uint8_t))

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

See also
https://datatracker.ietf.org/doc/html/rfc6184#section-5.8

Function Documentation

◆ SmolRTSP_H264NalHeader_write_fu_header()

void SmolRTSP_H264NalHeader_write_fu_header ( SmolRTSP_H264NalHeader  self,
uint8_t  buffer[restrict],
bool  is_first_fragment,
bool  is_last_fragment 
)

Writes a FU header of self to buffer.

Parameters
[in]selfThe header to write.
[out]bufferThe memory area capable of storing SMOLRTSP_H264_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/rfc6184#section-5.8