19#ifndef ANC_PAYLOADS_H__
20#define ANC_PAYLOADS_H__
92 return (0x6996 >> v) & 1;
104 uint16_t parity =
Parity8(value);
105 return (!parity << 9) + (parity << 8) + value;
118 uint16_t parity =
Parity8(raw_word);
119 if ((raw_word & 0x100) >> 8 != parity || (raw_word & 0x200) >> 9 == parity) {
120 (*parity_errors_ptr)++;
122 return 0xff & raw_word;
185 uint32_t* checksum_ptr);
static uint8_t CheckParityBits(uint16_t raw_word, int *parity_errors_ptr)
Definition anc_payloads.h:116
int ParseAncillaryDataPacket(const uint32_t *packet_net_data_ptr, struct AncillaryDataPacket *packet_ptr, struct AncillaryDataPayloadErrors *payload_errors_ptr)
Definition anc_payloads.c:489
void WriteAncillaryDataPayloadHeader(uint32_t *payload_net_data_ptr, uint16_t packet_count, CdiFieldKind field_kind)
Definition anc_payloads.c:523
void ParseAncillaryDataPacketHeader(const uint32_t *packet_net_data_ptr, struct AncillaryDataPacket *packet_ptr, struct AncillaryDataPayloadErrors *payload_errors)
Definition anc_payloads.c:452
int WriteAncillaryDataPacket(uint32_t *packet_net_data_ptr, const struct AncillaryDataPacket *packet_ptr)
Definition anc_payloads.c:574
static uint16_t WithParityBits(uint8_t value)
Definition anc_payloads.h:102
void WriteAncillaryDataPacketHeader(uint32_t *packet_net_data_ptr, const struct AncillaryDataPacket *packet_ptr, uint32_t *checksum_ptr)
Definition anc_payloads.c:535
int GetAncillaryDataPacketSize(int data_count)
Definition anc_payloads.c:514
static bool Parity8(uint8_t value)
Definition anc_payloads.h:86
void ParseAncillaryDataPayloadHeader(const uint32_t *payload_net_data_ptr, uint16_t *packet_count_ptr, CdiFieldKind *field_kind_ptr)
Definition anc_payloads.c:439
This file declares the public API data types, structures and functions that facilitate parsing and sy...
CdiFieldKind
Definition cdi_avm_payloads_api.h:34
The ANC data packet. See https://datatracker.ietf.org/doc/html/rfc8331#section-2.1 for details.
Definition anc_payloads.h:34
unsigned source_stream_number
Source stream number.
Definition anc_payloads.h:44
bool is_valid_source_stream_number
True when the source_stream_number value is set.
Definition anc_payloads.h:42
bool is_color_difference_channel
True when the ANC data corresponds to the color-difference data channel.
Definition anc_payloads.h:36
unsigned line_number
The digital interface line number.
Definition anc_payloads.h:38
uint16_t user_data[255+4]
The packet's user data words (up to 255). Must contain 10-bit values.
Definition anc_payloads.h:52
unsigned horizontal_offset
The horizontal offset in an SDI raster relative to the start of active video.
Definition anc_payloads.h:40
uint8_t did
Data identification number.
Definition anc_payloads.h:46
uint8_t data_count
Number of user data words in packet.
Definition anc_payloads.h:50
uint8_t sdid
Secondary data identification number.
Definition anc_payloads.h:48
Counters for keeping track of errors observed when parsing ANC payloads.
Definition anc_payloads.h:57
int checksum_errors
Count of the number of checkum errors observed (at most one per ANC packet).
Definition anc_payloads.h:61
uint32_t checksum
Running checksum, used by ParseAncillaryDataPacket.
Definition anc_payloads.h:59
int parity_errors
Count of the number of parity errors observed.
Definition anc_payloads.h:63