Declarations of utilities for creating and parsing payloads formatted according to the CDI Ancillary Data Format Specification (https://cdi.elemental.com/specs/baseline-ancillary-data).
More...
#include "cdi_avm_payloads_api.h"
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
|
static bool | Parity8 (uint8_t value) |
|
static uint16_t | WithParityBits (uint8_t value) |
|
static uint8_t | CheckParityBits (uint16_t raw_word, int *parity_errors_ptr) |
|
void | ParseAncillaryDataPayloadHeader (const uint32_t *payload_net_data_ptr, uint16_t *packet_count_ptr, CdiFieldKind *field_kind_ptr) |
|
void | ParseAncillaryDataPacketHeader (const uint32_t *packet_net_data_ptr, struct AncillaryDataPacket *packet_ptr, struct AncillaryDataPayloadErrors *payload_errors) |
|
int | ParseAncillaryDataPacket (const uint32_t *packet_net_data_ptr, struct AncillaryDataPacket *packet_ptr, struct AncillaryDataPayloadErrors *payload_errors_ptr) |
|
int | GetAncillaryDataPacketSize (int data_count) |
|
void | WriteAncillaryDataPayloadHeader (uint32_t *payload_net_data_ptr, uint16_t packet_count, CdiFieldKind field_kind) |
|
void | WriteAncillaryDataPacketHeader (uint32_t *packet_net_data_ptr, const struct AncillaryDataPacket *packet_ptr, uint32_t *checksum_ptr) |
|
int | WriteAncillaryDataPacket (uint32_t *packet_net_data_ptr, const struct AncillaryDataPacket *packet_ptr) |
|
Declarations of utilities for creating and parsing payloads formatted according to the CDI Ancillary Data Format Specification (https://cdi.elemental.com/specs/baseline-ancillary-data).
Ancillary data payloads contain one or more ancillarry data packets (ANC packets). Each ANC packet compactly contains user data in 10-bit words. An ANC packet may contain up to 255 user data words. The meaning of these words is determined by the DID and SDID fields in an ANC packet header. See https://smpte-ra.org/smpte-ancillary-data-smpte-st-291 for current assignments.
◆ CheckParityBits()
static uint8_t CheckParityBits |
( |
uint16_t | raw_word, |
|
|
int * | parity_errors_ptr ) |
|
inlinestatic |
Check the parity bits of an 8-bit value in the 10-bit input data.
- Parameters
-
raw_word | 10-bit raw word |
parity_errors_ptr | Pointer to payload error counts. |
- Returns
- 8-bit value (bits b7-b0 of raw_word).
◆ GetAncillaryDataPacketSize()
int GetAncillaryDataPacketSize |
( |
int | data_count | ) |
|
Calculate number of 32-bit words needed to write an ancillary data packet.
- Parameters
-
data_count | The number of user data words in the ANC packet. |
- Returns
- The number of 32-bit words required to store an ANC packet with data_count user data words.
◆ Parity8()
static bool Parity8 |
( |
uint8_t | value | ) |
|
|
inlinestatic |
Return parity bit of a byte.
- Parameters
-
value | The value for which to calculate the parity bit. |
- Returns
- The parity bit of value.
◆ ParseAncillaryDataPacket()
Parse and ancillary data packet.
- Parameters
-
packet_net_data_ptr | Pointer to a received ANC packet contained in an ANC payload. In network byte order. Input. |
packet_ptr | Pointer to an ANC packet. Output. |
payload_errors_ptr | Pointer to error counters. |
- Returns
- Offset from packet_net_data_ptr to the beginning of the next ANC packet.
◆ ParseAncillaryDataPacketHeader()
Parse the header of an ancillary data packet.
- Parameters
-
packet_net_data_ptr | Pointer to a received ANC packet contained in an ANC payload. In network byte order. Input. |
packet_ptr | Pointer to an ANC packet structure. Output. |
payload_errors | Pointer to error counters. |
- Returns
- Part of the packet's first user data word or zero when the packet is empty.
◆ ParseAncillaryDataPayloadHeader()
void ParseAncillaryDataPayloadHeader |
( |
const uint32_t * | payload_net_data_ptr, |
|
|
uint16_t * | packet_count_ptr, |
|
|
CdiFieldKind * | field_kind_ptr ) |
Parse the header of a received ancillary data payload.
- Parameters
-
payload_net_data_ptr | Pointer to received ancillary data. In network byte order. Input. |
packet_count_ptr | Pointer to number of ancillary data packets in payload. Output. |
field_kind_ptr | Pointer to field kind associated with payload. Output. |
◆ WithParityBits()
static uint16_t WithParityBits |
( |
uint8_t | value | ) |
|
|
inlinestatic |
Return 8-bit value with two parity bits.
- Parameters
-
value | The value to augment with parity bits. |
- Returns
- 10-bit word: 8-bit value and two parity bits.
◆ WriteAncillaryDataPacket()
int WriteAncillaryDataPacket |
( |
uint32_t * | packet_net_data_ptr, |
|
|
const struct AncillaryDataPacket * | packet_ptr ) |
Write an ancillary data packet for transmission in network byte order.
- Parameters
-
packet_net_data_ptr | Pointer into transmit buffer to start of an ANC packet. In network byte order. Output. |
packet_ptr | Pointer to ANC packet. Input. |
- Returns
- Offset from packet_net_data_ptr to the start of the next ancillary data packet to write.
◆ WriteAncillaryDataPacketHeader()
void WriteAncillaryDataPacketHeader |
( |
uint32_t * | packet_net_data_ptr, |
|
|
const struct AncillaryDataPacket * | packet_ptr, |
|
|
uint32_t * | checksum_ptr ) |
Write an ancillary data packet header for transmission in network byte order.
- Parameters
-
packet_net_data_ptr | Pointer into transmit buffer to start of an ANC packet. In network byte order. Output. |
packet_ptr | Pointer to an ANC packet. Input. |
checksum_ptr | Pointer to running checksum. Output. |
◆ WriteAncillaryDataPayloadHeader()
void WriteAncillaryDataPayloadHeader |
( |
uint32_t * | payload_net_data_ptr, |
|
|
uint16_t | packet_count, |
|
|
CdiFieldKind | field_kind ) |
Write an ancillary data payload header for transmission in network byte order.
- Parameters
-
payload_net_data_ptr | Pointer to transmit buffer for an ANC payload. In network byte order. Output. |
packet_count | Number of ancillary data packets in payload. Input. |
field_kind | Field kind associated with payload. Input. |