libklvanc
 All Classes Files Functions Variables Enumerations Macros
vanc-scte_104.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 
29 #ifndef _VANC_SCTE_104_H
30 #define _VANC_SCTE_104_H
31 
32 #include <libklvanc/vanc-packets.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
41 #define SO_INIT_REQUEST_DATA 0x001
42 
46 #define MO_SPLICE_REQUEST_DATA 0x101
47 
51 #define MO_SPLICE_NULL_REQUEST_DATA 0x102
52 
56 #define MO_TIME_SIGNAL_REQUEST_DATA 0x104
57 #define MO_INSERT_DESCRIPTOR_REQUEST_DATA 0x108
58 #define MO_INSERT_DTMF_REQUEST_DATA 0x109
59 #define MO_INSERT_AVAIL_DESCRIPTOR_REQUEST_DATA 0x10a
60 #define MO_INSERT_SEGMENTATION_REQUEST_DATA 0x10b
61 #define MO_PROPRIETARY_COMMAND_REQUEST_DATA 0x10c
62 #define MO_INSERT_TIER_DATA 0x10f
63 #define MO_INSERT_TIME_DESCRIPTOR 0x110
64 
68 #define SPLICESTART_NORMAL 0x01
69 
73 #define SPLICESTART_IMMEDIATE 0x02
74 
78 #define SPLICEEND_NORMAL 0x03
79 
83 #define SPLICEEND_IMMEDIATE 0x04
84 
88 #define SPLICE_CANCEL 0x05
89 
94 {
95  /* single_operation_message */
96  /* SCTE Spec table 7.1 */
97  unsigned short opID;
98  unsigned short messageSize;
99  unsigned short result;
100  unsigned short result_extension;
101  unsigned char protocol_version;
102  unsigned char AS_index;
103  unsigned char message_number;
104  unsigned short DPI_PID_index;
105 };
106 
111 {
112  /* SCTE Spec table 11.2 */
113  unsigned char time_type;
114  union {
115  struct {
116  unsigned int UTC_seconds;
117  unsigned short UTC_microseconds;
118  } time_type_1;
119  struct {
120  unsigned char hours;
121  unsigned char minutes;
122  unsigned char seconds;
123  unsigned char frames;
124  } time_type_2;
125  struct {
126  unsigned char GPI_number;
127  unsigned char GPI_edge;
128  } time_type_3;
129  };
130 };
131 
136 {
137  /* SCTE 104 Table 8-5 */
138  unsigned int splice_insert_type;
139  unsigned int splice_event_id;
140  unsigned short unique_program_id;
141  unsigned short pre_roll_time; /* In 1/10's of a second */
142  unsigned short brk_duration; /* In 1/10's of a second */
143  unsigned char avail_num;
144  unsigned char avails_expected;
145  unsigned char auto_return_flag;
146 };
147 
152 {
153  /* SCTE 104 Table 8-23 */
154  unsigned short pre_roll_time; /* In milliseconds */
155 };
156 
161 {
162  /* SCTE 104 Table 8-26 */
163  unsigned int num_provider_avails;
164  uint32_t provider_avail_id[255];
165 };
166 
171 {
172  /* SCTE 104 Table 8-27 */
173  unsigned int descriptor_count;
174  unsigned int total_length;
175  unsigned char descriptor_bytes[255];
176 };
177 
182 {
183  /* SCTE 104 Table 8-28 */
184  unsigned char pre_roll_time; /* In 1/10's of a second */
185  unsigned int dtmf_length;
186  char dtmf_char[7];
187 };
188 
193 {
194  /* SCTE 104 Table 8-29 */
195  unsigned int event_id;
196  unsigned int event_cancel_indicator;
197  unsigned int duration; /* In seconds */
198  unsigned int upid_type;
199  unsigned int upid_length;
200  unsigned char upid[255];
201  unsigned int type_id;
202  unsigned int segment_num;
203  unsigned int segments_expected;
204  unsigned int duration_extension_frames;
205  unsigned int delivery_not_restricted_flag;
206  unsigned int web_delivery_allowed_flag;
207  unsigned int no_regional_blackout_flag;
208  unsigned int archive_allowed_flag;
209  unsigned int device_restrictions;
210 };
211 
216 {
217  /* SCTE 104 2015 Table 9-32 */
218  uint64_t TAI_seconds;
219  unsigned int TAI_ns;
220  unsigned int UTC_offset;
221 };
222 
227 {
228  /* SCTE 104 Table 9-30 */
229  unsigned int proprietary_id;
230  unsigned int proprietary_command;
231  unsigned int data_length;
232  unsigned char proprietary_data[255];
233 };
234 
239 {
240  /* SCTE 104 Table 9-31 */
241  unsigned short tier_data;
242 };
243 
245  unsigned short opID;
246  unsigned short data_length;
247  unsigned char *data;
248  union {
249  struct klvanc_splice_request_data sr_data;
250  struct klvanc_time_signal_request_data timesignal_data;
251  struct klvanc_dtmf_descriptor_request_data dtmf_data;
252  struct klvanc_segmentation_descriptor_request_data segmentation_data;
253  struct klvanc_avail_descriptor_request_data avail_descriptor_data;
254  struct klvanc_insert_descriptor_request_data descriptor_data;
255  struct klvanc_proprietary_command_request_data proprietary_data;
256  struct klvanc_tier_data tier_data;
257  struct klvanc_time_descriptor_data time_data;
258  };
259 };
260 
265 {
266  /* multiple_operation_message */
267  /* SCTE Spec table 7.2 */
268  unsigned short rsvd;
269  unsigned short messageSize;
270  unsigned char protocol_version;
271  unsigned char AS_index;
272  unsigned char message_number;
273  unsigned short DPI_PID_index;
274  unsigned char SCTE35_protocol_version;
276  unsigned char num_ops;
278 };
279 
284 {
285  struct klvanc_packet_header_s hdr;
286 
287  /* See SMPTE 2010:2008 page 5 */
288  unsigned char payloadDescriptorByte;
289  int version;
290  int continued_pkt;
291  int following_pkt;
292  int duplicate_msg;
293 
294  unsigned char payload[256];
295  unsigned int payloadLengthBytes;
296 
297  struct klvanc_single_operation_message so_msg;
298  struct klvanc_multiple_operation_message mo_msg;
299 };
300 
301 
310 int klvanc_alloc_SCTE_104(uint16_t opId, struct klvanc_packet_scte_104_s **pkt);
311 
319 int klvanc_dump_SCTE_104(struct klvanc_context_s *ctx, void *p);
320 
325 void klvanc_free_SCTE_104(void *p);
326 
343  uint8_t *inBytes, uint16_t inCount,
344  uint8_t **bytes, uint16_t *byteCount);
345 
359  struct klvanc_packet_scte_104_s *pkt,
360  uint16_t **words, uint16_t *wordCount);
361 
375  const struct klvanc_packet_scte_104_s *pkt,
376  uint8_t **bytes, uint16_t *byteCount);
377 
378 int klvanc_SCTE_104_Add_MOM_Op(struct klvanc_packet_scte_104_s *pkt, uint16_t opId,
380 
381 #ifdef __cplusplus
382 };
383 #endif
384 
385 #endif /* _VANC_SCTE_104_H */
void klvanc_free_SCTE_104(void *p)
TODO - Brief description goes here.
TODO - Brief description goes here.
Definition: vanc-packets.h:57
TODO - Brief description goes here.
Definition: vanc-scte_104.h:170
int klvanc_dump_SCTE_104(struct klvanc_context_s *ctx, void *p)
Print out the properties of a SCTE-104 structure.
TODO - Brief description goes here.
Definition: vanc-scte_104.h:226
int klvanc_convert_SCTE_104_to_words(struct klvanc_context_s *ctx, struct klvanc_packet_scte_104_s *pkt, uint16_t **words, uint16_t *wordCount)
Convert type struct packet_scte_104_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.
TODO - Brief description goes here.
Definition: vanc-scte_104.h:151
TODO - Brief description goes here.
Definition: vanc-scte_104.h:110
TODO - Brief description goes here.
Definition: vanc-scte_104.h:93
Application specific context, the library allocates and stores user specific instance information...
Definition: vanc.h:118
TODO - Brief description goes here.
Definition: vanc-scte_104.h:160
int klvanc_alloc_SCTE_104(uint16_t opId, struct klvanc_packet_scte_104_s **pkt)
Create a SCTE-104 structure.
TODO - Brief description goes here.
Definition: vanc-scte_104.h:238
TODO - Brief description goes here.
Definition: vanc-scte_104.h:215
TODO - Brief description goes here.
Definition: vanc-scte_104.h:181
TODO - Brief description goes here.
Definition: vanc-scte_104.h:264
int klvanc_convert_SCTE_104_to_packetBytes(struct klvanc_context_s *ctx, const struct klvanc_packet_scte_104_s *pkt, uint8_t **bytes, uint16_t *byteCount)
Convert type struct packet_scte_104_s into a block of bytes which can be serialized over TCP or embed...
Definition: vanc-scte_104.h:244
TODO - Brief description goes here.
Definition: vanc-scte_104.h:192
int klvanc_convert_SCTE_104_packetbytes_to_SMPTE_2010(struct klvanc_context_s *ctx, uint8_t *inBytes, uint16_t inCount, uint8_t **bytes, uint16_t *byteCount)
Encapsulate a SCTE-104 packet into a SMPTE 2010 packet (suitable for embedding in a VANC packet)...
TODO - Brief description goes here.
Definition: vanc-scte_104.h:283
VANC Headers and packet structure.
TODO - Brief description goes here.
Definition: vanc-scte_104.h:135