SmolRTSP 0.2.0
A small, portable, extensible RTSP 1.0 implementation in C99
Loading...
Searching...
No Matches
av1.h
Go to the documentation of this file.
1
9#pragma once
10
11#include <stdbool.h>
12#include <stddef.h>
13#include <stdint.h>
14
15#include <smolrtsp/priv/compiler_attrs.h>
16
22#define SMOLRTSP_AV1_AGGREGATION_HEADER_SIZE 1
23
29#define SMOLRTSP_AV1_LEB128_MAX_SIZE 10
30
34#define SMOLRTSP_AV1_OBU_RESERVED_0 0
35#define SMOLRTSP_AV1_OBU_SEQUENCE_HEADER 1
36#define SMOLRTSP_AV1_OBU_TEMPORAL_DELIMITER 2
37#define SMOLRTSP_AV1_OBU_FRAME_HEADER 3
38#define SMOLRTSP_AV1_OBU_TILE_GROUP 4
39#define SMOLRTSP_AV1_OBU_METADATA 5
40#define SMOLRTSP_AV1_OBU_FRAME 6
41#define SMOLRTSP_AV1_OBU_REDUNDANT_FRAME_HEADER 7
42#define SMOLRTSP_AV1_OBU_TILE_LIST 8
43#define SMOLRTSP_AV1_OBU_PADDING 15
44
55typedef struct {
58 bool z;
61 bool y;
66 uint8_t w;
69 bool n;
71
76 SmolRTSP_Av1AggregationHeader self, uint8_t buffer[restrict]);
77
87size_t smolrtsp_av1_leb128_encode(uint64_t value, uint8_t buffer[restrict])
88 SMOLRTSP_PRIV_MUST_USE;
89
102 const uint8_t *buffer, size_t buffer_len,
103 uint64_t *value) SMOLRTSP_PRIV_MUST_USE;
104
109size_t smolrtsp_av1_leb128_size(uint64_t value) SMOLRTSP_PRIV_MUST_USE;
110
115static inline uint8_t smolrtsp_av1_obu_type(uint8_t header_byte) {
116 return (header_byte >> 3) & 0x0Fu;
117}
118
123static inline bool smolrtsp_av1_obu_has_extension(uint8_t header_byte) {
124 return ((header_byte >> 2) & 0x01u) != 0;
125}
126
131static inline bool smolrtsp_av1_obu_has_size_field(uint8_t header_byte) {
132 return ((header_byte >> 1) & 0x01u) != 0;
133}
134
141static inline uint8_t smolrtsp_av1_obu_clear_size_field(uint8_t header_byte) {
142 return (uint8_t)(header_byte & ~0x02u);
143}
void SmolRTSP_Av1AggregationHeader_serialize(SmolRTSP_Av1AggregationHeader self, uint8_t buffer[restrict])
Serializes self into the single byte at buffer (network order).
size_t smolrtsp_av1_leb128_encode(uint64_t value, uint8_t buffer[restrict]) SMOLRTSP_PRIV_MUST_USE
Encodes value as a LEB128 unsigned varint into buffer.
size_t smolrtsp_av1_leb128_decode(const uint8_t *buffer, size_t buffer_len, uint64_t *value) SMOLRTSP_PRIV_MUST_USE
Decodes one LEB128 unsigned varint from buffer.
size_t smolrtsp_av1_leb128_size(uint64_t value) SMOLRTSP_PRIV_MUST_USE
Returns the number of bytes that smolrtsp_av1_leb128_encode would write for value.
The AV1 RTP aggregation header byte (AOMedia AV1 RTP §4.4).
Definition av1.h:55
bool y
Y – the last OBU element of this packet is an OBU fragment that will continue in the next packet.
Definition av1.h:61
bool z
Z – the first OBU element of this packet is the continuation of an OBU fragment that started in the p...
Definition av1.h:58
bool n
N – this packet is the first packet of a new coded video sequence.
Definition av1.h:69
uint8_t w
W (2 bits) – count of OBU elements in this packet.
Definition av1.h:66