libklvanc
 All Classes Files Functions Variables Enumerations Macros
vanc-smpte_12_2.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 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 
29 #ifndef _VANC_SMPTE_12_2_H
30 #define _VANC_SMPTE_12_2_H
31 
32 #include <libklvanc/vanc-packets.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /* DBB1 payload types (See Sec 6.2.1 Table 2) */
39 #define KLVANC_ATC_LTC 0x00
40 #define KLVANC_ATC_VITC1 0x01
41 #define KLVANC_ATC_VITC2 0x02
42 /* Codes 3-5 are user defined */
43 #define KLVANC_FILM_DATA_BLOCK 0x06
44 #define KLVANC_PROD_DATA_BLOCK 0x07
45 /* Codes 0x08 to 0x7c are "locally generated time address and user data (user defined) */
46 #define KLVANC_VID_TAPE_DATA_BLOCK_LOCAL 0x7d
47 #define KLVANC_FILM_DATA_BLOCK_LOCAL 0x7e
48 #define KLVANC_PROD_DATA_BLOCK_LOCAL 0x7f
49 /* Codes 0x80 to 0xff are Reserved */
50 
55 {
56  struct klvanc_packet_header_s hdr;
57 
58  unsigned char payload[256];
59  unsigned int payloadLengthBytes;
60 
61  uint8_t dbb1;
62  uint8_t dbb2;
63 
64  uint8_t vitc_line_select;
65  uint8_t line_duplication_flag;
66  uint8_t tc_validity_flag;
67  uint8_t user_bits_process_flag;
68 
69  /* Timecode data */
70  uint8_t frames;
71  uint8_t seconds;
72  uint8_t minutes;
73  uint8_t hours;
74 
75  /* See ST 12-1:2014 Table 11 for the meanings of these
76  flags, which may vary depending on the framerate */
77 
78  /* Drop frame flag in 30/60. Always zero in 25/50/24/48 */
79  uint8_t flag14;
80  /* Color frame flag in 30/60/25/50. Always zero in 24/48 */
81  uint8_t flag15;
82  /* Field Bit/LTC Polarity in 30/60/24/48. BGF0 in 25/50 */
83  uint8_t flag35;
84  /* BGF0 in 30/60/24/48. BGF2 in 25/50 */
85  uint8_t flag55;
86  /* BGF1 in all framerates */
87  uint8_t flag74;
88  /* BGF2 in 30/60/24/48. Field Bit/LTC Polarity in 25/50 */
89  uint8_t flag75;
90 };
91 
99 
109 int klvanc_create_SMPTE_12_2_from_ST370(uint32_t st370_tc,
110  int frate_num, int frate_den,
111  struct klvanc_packet_smpte_12_2_s **pkt);
112 
113 
120 int klvanc_dump_SMPTE_12_2(struct klvanc_context_s *ctx, void *p);
121 
126 void klvanc_free_SMPTE_12_2(void *p);
127 
140  struct klvanc_packet_smpte_12_2_s *pkt,
141  uint16_t **words, uint16_t *wordCount);
142 
155  const struct klvanc_packet_smpte_12_2_s *pkt,
156  uint8_t **bytes, uint16_t *byteCount);
157 
169 int klvanc_SMPTE_12_2_preferred_line(int dbb1, int lineCount, int interlaced);
170 
171 #ifdef __cplusplus
172 };
173 #endif
174 
175 #endif /* _VANC_SMPTE_12_2_H */
TODO - Brief description goes here.
Definition: vanc-packets.h:57
int klvanc_SMPTE_12_2_preferred_line(int dbb1, int lineCount, int interlaced)
Determine the appropriate line to insert this S-12 packet onto. This takes into consideration interop...
int klvanc_convert_SMPTE_12_2_to_words(struct klvanc_context_s *ctx, struct klvanc_packet_smpte_12_2_s *pkt, uint16_t **words, uint16_t *wordCount)
Convert type struct packet_smpte_12_2_s into a more traditional line of vanc words, so that we may push out as VANC data. On success, caller MUST free the resulting *words array.
int klvanc_alloc_SMPTE_12_2(struct klvanc_packet_smpte_12_2_s **pkt)
Create SMPTE ST 12-2 timecode.
int klvanc_create_SMPTE_12_2_from_ST370(uint32_t st370_tc, int frate_num, int frate_den, struct klvanc_packet_smpte_12_2_s **pkt)
Create SMPTE ST 12-2 timecode from SMPTE 370 / 314 timecode.
Application specific context, the library allocates and stores user specific instance information...
Definition: vanc.h:118
int klvanc_dump_SMPTE_12_2(struct klvanc_context_s *ctx, void *p)
TODO - Brief description goes here.
TODO - Brief description goes here.
Definition: vanc-smpte_12_2.h:54
void klvanc_free_SMPTE_12_2(void *p)
TODO - Brief description goes here.
int klvanc_convert_SMPTE_12_2_to_packetBytes(struct klvanc_context_s *ctx, const struct klvanc_packet_smpte_12_2_s *pkt, uint8_t **bytes, uint16_t *byteCount)
Convert type struct packet_smpte_12_2_s into a block of bytes which can be embedded into a VANC line...
VANC Headers and packet structure.