Compy 0.2.0
A lightweight RTSP 1.0 server library for embedded systems
Loading...
Searching...
No Matches
nal.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <compy/nal/h264.h>
11#include <compy/nal/h265.h>
12
13#include <stdbool.h>
14#include <stdint.h>
15
16#include <datatype99.h>
17#include <slice99.h>
18
19#include <compy/priv/compiler_attrs.h>
20
27// clang-format off
29 Compy_NalHeader,
30 (Compy_NalHeader_H264, Compy_H264NalHeader),
31 (Compy_NalHeader_H265, Compy_H265NalHeader)
32);
33// clang-format on
34
38uint8_t Compy_NalHeader_unit_type(Compy_NalHeader self) COMPY_PRIV_MUST_USE;
39
43size_t Compy_NalHeader_size(Compy_NalHeader self) COMPY_PRIV_MUST_USE;
44
53size_t Compy_NalHeader_fu_size(Compy_NalHeader self) COMPY_PRIV_MUST_USE;
54
58bool Compy_NalHeader_is_vps(Compy_NalHeader self) COMPY_PRIV_MUST_USE;
59
63bool Compy_NalHeader_is_sps(Compy_NalHeader self) COMPY_PRIV_MUST_USE;
64
68bool Compy_NalHeader_is_pps(Compy_NalHeader self) COMPY_PRIV_MUST_USE;
69
73bool Compy_NalHeader_is_coded_slice_idr(Compy_NalHeader self)
74 COMPY_PRIV_MUST_USE;
75
80 COMPY_PRIV_MUST_USE;
81
89void Compy_NalHeader_serialize(Compy_NalHeader self, uint8_t buffer[restrict]);
90
106 Compy_NalHeader self, uint8_t buffer[restrict], bool is_first_fragment,
107 bool is_last_fragment);
108
112typedef struct {
116 Compy_NalHeader header;
117
121 U8Slice99 payload;
123
127uint8_t compy_nal_fu_header(
128 bool is_first_fragment, bool is_last_fragment,
129 uint8_t unit_type) COMPY_PRIV_MUST_USE;
130
140typedef size_t (*Compy_NalStartCodeTester)(U8Slice99 data);
141
154compy_determine_start_code(U8Slice99 data) COMPY_PRIV_MUST_USE;
155
159size_t compy_test_start_code_3b(U8Slice99 data);
160
164size_t compy_test_start_code_4b(U8Slice99 data);
H.264 NAL representation.
H.265 NAL representation.
void Compy_NalHeader_write_fu_header(Compy_NalHeader self, uint8_t buffer[restrict], bool is_first_fragment, bool is_last_fragment)
Writes a FU header of self to buffer.
Definition nal.c:60
bool Compy_NalHeader_is_coded_slice_non_idr(Compy_NalHeader self) COMPY_PRIV_MUST_USE
Checks whether self is a coded slice non-IDR.
size_t Compy_NalHeader_fu_size(Compy_NalHeader self) COMPY_PRIV_MUST_USE
Computes the size of a fragmentation unit (FU) header self.
size_t compy_test_start_code_4b(U8Slice99 data)
The 3-byte start code tester (0x00000001).
Definition nal.c:131
bool Compy_NalHeader_is_coded_slice_idr(Compy_NalHeader self) COMPY_PRIV_MUST_USE
Checks whether self is a coded slice IDR.
void Compy_NalHeader_serialize(Compy_NalHeader self, uint8_t buffer[restrict])
Writes the binary representation of self into buffer.
size_t compy_test_start_code_3b(U8Slice99 data)
The 3-byte start code tester (0x000001).
Definition nal.c:120
bool Compy_NalHeader_is_sps(Compy_NalHeader self) COMPY_PRIV_MUST_USE
Checks whether self is SPS.
size_t Compy_NalHeader_size(Compy_NalHeader self) COMPY_PRIV_MUST_USE
Computes the size of self in bytes.
size_t(* Compy_NalStartCodeTester)(U8Slice99 data)
A function that tests whether data starts with some start code.
Definition nal.h:140
bool Compy_NalHeader_is_pps(Compy_NalHeader self) COMPY_PRIV_MUST_USE
Checks whether self is PPS.
uint8_t compy_nal_fu_header(bool is_first_fragment, bool is_last_fragment, uint8_t unit_type) COMPY_PRIV_MUST_USE
Creates a generic NAL FU header.
Definition nal.c:73
bool Compy_NalHeader_is_vps(Compy_NalHeader self) COMPY_PRIV_MUST_USE
Checks whether self is VPS.
Compy_NalStartCodeTester compy_determine_start_code(U8Slice99 data) COMPY_PRIV_MUST_USE
Returns a start code tester for data.
Definition nal.c:108
uint8_t Compy_NalHeader_unit_type(Compy_NalHeader self) COMPY_PRIV_MUST_USE
Returns the NAL unit type of self.
datatype99(Compy_NalHeader,(Compy_NalHeader_H264, Compy_H264NalHeader),(Compy_NalHeader_H265, Compy_H265NalHeader))
A generic NAL header (either H.264 or H.265).
An H.264 NAL header.
Definition h264.h:34
An H.265 NAL header.
Definition h265.h:33
A generic NAL unit (either H.264 or H.265).
Definition nal.h:112
Compy_NalHeader header
The header of this NAL unit.
Definition nal.h:116
U8Slice99 payload
The payload data of this NAL unit (not including the header).
Definition nal.h:121