libklvanc
Loading...
Searching...
No Matches
smpte2038.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Kernel Labs Inc. All Rights Reserved
3 *
4 * Address: Kernel Labs Inc., PO Box 745, St James, NY. 11780
5 * Contact: sales@kernellabs.com
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
28
29#ifndef SMPTE2038_H
30#define SMPTE2038_H
31
33#include <stdint.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
43{
44 /* Based on data taken from the ADTEC EN-100 encodeer,
45 * DID, SDID, DATA_COUNT, WORDS and CHECKSUM are
46 * all marked with parity, don't forget to strip
47 * bits 9:8 before you trust these values, esp. data_count.
48 */
49 uint8_t reserved_000000;
50 uint8_t c_not_y_channel_flag;
51 uint16_t line_number;
52 uint16_t horizontal_offset;
53 uint16_t DID;
54 uint16_t SDID;
55 uint16_t data_count;
56 uint16_t *user_data_words;
57 uint16_t checksum_word;
58};
59
64{
65 uint32_t packet_start_code_prefix;
66 uint8_t stream_id;
67 uint16_t PES_packet_length;
68 uint8_t reserved_10;
69 uint8_t PES_scrambling_control;
70 uint8_t PES_priority;
71 uint8_t data_alignment_indicator;
72 uint8_t copyright;
73 uint8_t original_or_copy;
74 uint8_t PTS_DTS_flags;
75 uint8_t ESCR_flag;
76 uint8_t ES_rate_flag;
77 uint8_t DSM_trick_mode_flag;
78 uint8_t additional_copy_info_flag;
79 uint8_t PES_CRC_flag;
80 uint8_t PES_extension_flag;
81 uint8_t PES_header_data_length;
82 uint8_t reserved_0010;
83 uint64_t PTS;
84
85 int lineCount;
87};
88
101int klvanc_smpte2038_parse_pes_packet(uint8_t *section, unsigned int byteCount, struct klvanc_smpte2038_anc_data_packet_s **result);
102
116int klvanc_smpte2038_parse_pes_payload(uint8_t *payload, unsigned int byteCount, struct klvanc_smpte2038_anc_data_packet_s **result);
117
123
129
134{
135 uint8_t *buf;
136 uint32_t buflen;
137 uint32_t bufused;
138 uint32_t buffree;
139 struct klbs_context_s *bs;
140};
141
149
155
164
172 struct klvanc_packet_header_s *pkt);
173
184
196int klvanc_smpte2038_convert_line_to_words(struct klvanc_smpte2038_anc_data_line_s *l, uint16_t **words, uint16_t *wordCount);
197
198#ifdef __cplusplus
199};
200#endif
201
202#endif /* SMPTE2038_H */
int klvanc_smpte2038_convert_line_to_words(struct klvanc_smpte2038_anc_data_line_s *l, uint16_t **words, uint16_t *wordCount)
Convert type struct klvanc_smpte2038_anc_data_line_s into a more traditional line of vanc words,...
int klvanc_smpte2038_packetizer_append(struct klvanc_smpte2038_packetizer_s *ctx, struct klvanc_packet_header_s *pkt)
TODO - Brief description goes here.
int klvanc_smpte2038_parse_pes_payload(uint8_t *payload, unsigned int byteCount, struct klvanc_smpte2038_anc_data_packet_s **result)
Inspect a section payload. This function is identical to klvanc_smpte2038_parse_pes_packet(),...
int klvanc_smpte2038_packetizer_begin(struct klvanc_smpte2038_packetizer_s *ctx)
Initialize state, typically done at the beginning of each incoming SDI frame must be done before att...
int klvanc_smpte2038_packetizer_alloc(struct klvanc_smpte2038_packetizer_s **ctx)
Allocate a context so we can use this with the rest of the library.
void klvanc_smpte2038_anc_data_packet_free(struct klvanc_smpte2038_anc_data_packet_s *pkt)
Deallocate and release a previously allocated pkt, see klvanc_smpte2038_parse_section().
int klvanc_smpte2038_parse_pes_packet(uint8_t *section, unsigned int byteCount, struct klvanc_smpte2038_anc_data_packet_s **result)
Inspect a section, if its deemed valid, create a VANC packet and return it to the caller....
int klvanc_smpte2038_packetizer_end(struct klvanc_smpte2038_packetizer_s *ctx, uint64_t pts)
Finalize VANC collection state. Typically done when the last VANC line in a frame has been passed to...
void klvanc_smpte2038_packetizer_free(struct klvanc_smpte2038_packetizer_s **ctx)
Deallocate and release a previously allocated context, see klvanc_smpte2038_packetizer_alloc().
void klvanc_smpte2038_anc_data_packet_dump(struct klvanc_smpte2038_anc_data_packet_s *h)
Inspect structure and output textual information to console.
TODO - Brief description goes here.
Definition vanc-packets.h:59
TODO - Brief description goes here.
Definition smpte2038.h:43
TODO - Brief description goes here.
Definition smpte2038.h:64
TODO - Brief description goes here.
Definition smpte2038.h:134
VANC Headers and packet structure.