SmolRTSP  0.1.3
A small, portable, extensible RTSP 1.0 implementation in C99
h264.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include <stdbool.h>
12 #include <stdint.h>
13 
14 #include <slice99.h>
15 
16 #include <smolrtsp/priv/compiler_attrs.h>
17 
21 #define SMOLRTSP_H264_NAL_HEADER_SIZE sizeof(uint8_t)
22 
28 #define SMOLRTSP_H264_FU_HEADER_SIZE \
29  (/* fu-identifier */ sizeof(uint8_t) + /* fu-header */ sizeof(uint8_t))
30 
34 typedef struct {
39 
43  uint8_t ref_idc;
44 
48  uint8_t unit_type;
50 
54 typedef struct {
59 
63  U8Slice99 payload;
65 
70 SmolRTSP_H264NalHeader_parse(uint8_t byte_header) SMOLRTSP_PRIV_MUST_USE;
71 
76  SMOLRTSP_PRIV_MUST_USE;
77 
82  SMOLRTSP_PRIV_MUST_USE;
83 
88  SMOLRTSP_PRIV_MUST_USE;
89 
94  SMOLRTSP_PRIV_MUST_USE;
95 
100  SMOLRTSP_PRIV_MUST_USE;
101 
106  SMOLRTSP_PRIV_MUST_USE;
107 
120  SmolRTSP_H264NalHeader self, uint8_t buffer[restrict],
121  bool is_first_fragment, bool is_last_fragment);
122 
126 #define SMOLRTSP_H264_NAL_UNIT_UNSPECIFIED 0
127 
131 #define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_NON_IDR 1
132 
136 #define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_DATA_PARTITION_A 2
137 
141 #define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_DATA_PARTITION_B 3
142 
146 #define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_DATA_PARTITION_C 4
147 
151 #define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_IDR 5
152 
156 #define SMOLRTSP_H264_NAL_UNIT_SEI 6
157 
161 #define SMOLRTSP_H264_NAL_UNIT_SPS 7
162 
166 #define SMOLRTSP_H264_NAL_UNIT_PPS 8
167 
171 #define SMOLRTSP_H264_NAL_UNIT_AUD 9
172 
176 #define SMOLRTSP_H264_NAL_UNIT_END_OF_SEQUENCE 10
177 
181 #define SMOLRTSP_H264_NAL_UNIT_END_OF_STREAM 11
182 
186 #define SMOLRTSP_H264_NAL_UNIT_FILLER 12
187 
191 #define SMOLRTSP_H264_NAL_UNIT_SPS_EXT 13
192 
196 #define SMOLRTSP_H264_NAL_UNIT_PREFIX 14
197 
201 #define SMOLRTSP_H264_NAL_UNIT_SUBSET_SPS 15
202 
206 #define SMOLRTSP_H264_NAL_UNIT_DPS 16
207 
211 #define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_AUX 19
212 
216 #define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_EXT 20
217 
222 #define SMOLRTSP_H264_NAL_UNIT_CODED_SLICE_EXT_DEPTH_VIEW 21
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.
SmolRTSP_H264NalHeader SmolRTSP_H264NalHeader_parse(uint8_t byte_header) SMOLRTSP_PRIV_MUST_USE
Parses an H.264 NAL header from byte_header.
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.
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.
An H.264 NAL header.
Definition: h264.h:34
bool forbidden_zero_bit
forbidden_zero_bit f(1).
Definition: h264.h:38
uint8_t ref_idc
nal_ref_idc (u2).
Definition: h264.h:43
uint8_t unit_type
unit_type u(5).
Definition: h264.h:48
An H.264 NAL unit.
Definition: h264.h:54
U8Slice99 payload
The payload data of this NAL unit (not including the header).
Definition: h264.h:63
SmolRTSP_H264NalHeader header
The NAL header of this NAL unit.
Definition: h264.h:58