mirror of
https://gitlab.com/d3tn/ud3tn.git
synced 2026-08-16 13:01:06 +02:00
ud3tn is available under multiple licenses and we want to reflect this in our source code. But which license information should appear first and how can we manage this efficiently in the future? The Linux Kernel uses SPDX expressions instead of boilerplate sections. This seems to be a great approach, so we do the same here. Signed-off-by: Georg Alexander Murzik <georg.murzik@d3tn.com>
52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
// SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0
|
|
#ifndef SPP_INTERNAL_H
|
|
#define SPP_INTERNAL_H
|
|
|
|
#include "spp/spp.h"
|
|
#include "spp/spp_timecodes.h"
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
#define SPP_PRIMARY_HEADER_SIZE (6)
|
|
#define SPP_PH_P1_VERSION_MASK (0xe000)
|
|
#define SPP_PH_EARLY_VERSION_MASK (SPP_PH_P1_VERSION_MASK >> 8)
|
|
#define SPP_PH_P1_TYPE_MASK (0x1000)
|
|
#define SPP_PH_P1_SECONDARY_HEADER_FLAG_MASK (0x0800)
|
|
#define SPP_PH_P1_APID_MASK (0x07ff)
|
|
#define SPP_PH_P2_SEQUENCE_FLAGS_MASK (0xc000)
|
|
#define SPP_PH_P2_SEQUENCE_FLAGS_SHIFT (14)
|
|
#define SPP_PH_P2_SEQUENCE_CNT_MASK (0x3fff)
|
|
|
|
|
|
struct spp_primary_header_t {
|
|
bool is_request;
|
|
bool has_secondary_header;
|
|
uint16_t apid;
|
|
enum spp_segment_status_t segment_status;
|
|
uint16_t segment_number;
|
|
size_t data_length;
|
|
};
|
|
|
|
|
|
struct spp_context_t {
|
|
struct spp_tc_context_t *timecode;
|
|
size_t ancillary_data_len;
|
|
};
|
|
|
|
|
|
bool spp_check_first_byte(uint8_t byte);
|
|
void spp_parse_ph_p1(const uint16_t word,
|
|
struct spp_primary_header_t *header);
|
|
void spp_parse_ph_p2(const uint16_t word,
|
|
struct spp_primary_header_t *header);
|
|
void spp_parse_ph_len(const uint16_t word,
|
|
struct spp_primary_header_t *header);
|
|
int spp_parse_primary_header(
|
|
const uint8_t *buf,
|
|
const size_t length,
|
|
struct spp_primary_header_t *header,
|
|
const uint8_t **next);
|
|
|
|
#endif // SPP_INTERNAL_H
|