3 * Copyright (C) 2013, CableLabs, Louisville, CO 80027
4 * (c) 2019, Centricular ltd
7 * RUIH Team <ruih@cablelabs.com>
8 * Edward Hervey <edward@centricular.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details.
20 * You should have received a copy of the GNU Library General Public
21 * License along with this library; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
26 #ifndef GST_SCTE_SECTION_H
27 #define GST_SCTE_SECTION_H
30 #include <gst/mpegts/gstmpegtssection.h>
31 #include <gst/mpegts/gstmpegtsdescriptor.h>
36 * GstMpegtsScteStreamType:
37 * @GST_MPEGTS_STREAM_TYPE_SCTE_SUBTITLING: SCTE-27 Subtitling
38 * @GST_MPEGTS_STREAM_TYPE_SCTE_ISOCH_DATA: SCTE-19 Isochronous data
39 * @GST_MPEGTS_STREAM_TYPE_SCTE_SIT: SCTE-35 Splice Information Table
40 * @GST_MPEGTS_STREAM_TYPE_SCTE_DST_NRT: SCTE-07 Data Service or
41 * Network Resource Table
42 * @GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB: Type B - DSM-CC Data Carousel
44 * @GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING: Enhanced Television Application
45 * Signaling (OC-SP-ETV-AM1.0.1-120614)
46 * @GST_MPEGTS_STREAM_TYPE_SCTE_SYNC_DATA: SCTE-07 Synchronous data
47 * @GST_MPEGTS_STREAM_TYPE_SCTE_ASYNC_DATA: SCTE-53 Asynchronous data
49 * Type of mpeg-ts streams for SCTE. Most users would want to use the
50 * #GstMpegtsATSCStreamType instead since it also covers these stream types
55 /* 0x01 - 0x7f : defined in other specs */
56 GST_MPEGTS_STREAM_TYPE_SCTE_SUBTITLING = 0x82, /* Subtitling data */
57 GST_MPEGTS_STREAM_TYPE_SCTE_ISOCH_DATA = 0x83, /* Isochronous data */
58 /* 0x84 - 0x85 : defined in other specs */
59 GST_MPEGTS_STREAM_TYPE_SCTE_SIT = 0x86, /* Splice Information Table */
60 /* 0x87 - 0x94 : defined in other specs */
61 GST_MPEGTS_STREAM_TYPE_SCTE_DST_NRT = 0x95, /* DST / NRT data */
62 /* 0x96 - 0xaf : defined in other specs */
63 GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB = 0xb0, /* Data Carousel Type B */
64 /* 0xb1 - 0xbf : User Private (or defined in other specs) */
65 GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING = 0xc0, /* EBIF Signaling */
66 GST_MPEGTS_STREAM_TYPE_SCTE_SYNC_DATA = 0xc2, /* Synchronous data */
67 GST_MPEGTS_STREAM_TYPE_SCTE_ASYNC_DATA = 0xc3, /* Asynchronous data */
68 /* 0xc4 - 0xff : User Private (or defined in other specs) */
70 } GstMpegtsScteStreamType;
74 * GstMpegtsSectionSCTETableID:
75 * @GST_MTS_TABLE_ID_SCTE_EAS: SCTE-18 Emergency Alert System
76 * @GST_MTS_TABLE_ID_SCTE_EBIF: CL-SP-ETV-AM 1.0.1 EBIF message
77 * @GST_MTS_TABLE_ID_SCTE_EISS: CL-SP-ETV-AM 1.0.1 EBIF Int. Signaling Sect.
78 * @GST_MTS_TABLE_ID_SCTE_DII: CL-SP-ETV-AM 1.0.1 DSMCC DII message
79 * @GST_MTS_TABLE_ID_SCTE_DDB: CL-SP-ETV-AM 1.0.1 DSMCC Data Download Block
80 * @GST_MTS_TABLE_ID_SCTE_SPLICE: SCTE-35 splice information is carried in a
81 * section stream on a separate PID in the program’s Map Table (PMT) allowing
82 * Splice Event notifications to remain associated with the program and pass
83 * through multiplexers.
85 * Values for a #GstMpegtsSection table_id.
87 * These are the registered SCTE table_id variants.
89 * see also: #GstMpegtsSectionTableID
93 /* 0x01 - 0xd7 : defined in other specs */
94 GST_MTS_TABLE_ID_SCTE_EAS = 0xd8, /* emergency alert information */
95 /* 0xd8 - 0xdf : defined in other specs */
96 GST_MTS_TABLE_ID_SCTE_EBIF = 0xE0, /* EBIF message */
97 GST_MTS_TABLE_ID_SCTE_RESERVED = 0xE1,
98 GST_MTS_TABLE_ID_SCTE_EISS = 0xE2, /* EBIF Int. Signaling Sect. */
99 GST_MTS_TABLE_ID_SCTE_DII = 0xE3, /* DSMCC DII message */
100 GST_MTS_TABLE_ID_SCTE_DDB = 0xE4, /* DSMCC Data Download Block */
101 /* 0xe5 - 0xfb : defined in other specs */
102 GST_MTS_TABLE_ID_SCTE_SPLICE = 0xfc, /* splice information table */
104 } GstMpegtsSectionSCTETableID;
106 #define GST_MPEGTS_TYPE_SCTE_SPLICE_COMPONENT (gst_mpegts_scte_splice_component_get_type())
107 typedef struct _GstMpegtsSCTESpliceComponent GstMpegtsSCTESpliceComponent;
110 * GstMpegtsSCTESpliceComponent:
111 * @tag: the elementary PID stream containing the Splice Point
112 * @splice_time_specified: Whether @splice_time was specified
113 * @splice_time: the presentation time of the signaled splice event
114 * @utc_splice_time: The UTC time of the signaled splice event
116 * Per-PID splice information.
120 struct _GstMpegtsSCTESpliceComponent {
123 gboolean splice_time_specified; /* Only valid for insert_event */
124 guint64 splice_time; /* Only valid for insert_event */
126 guint32 utc_splice_time; /* Only valid for !insert_event (schedule) */
129 /* Splice Information Table (SIT) */
130 #define GST_TYPE_MPEGTS_SCTE_SPLICE_EVENT (gst_mpegts_scte_splice_event_get_type())
131 typedef struct _GstMpegtsSCTESpliceEvent GstMpegtsSCTESpliceEvent;
133 struct _GstMpegtsSCTESpliceEvent {
134 /* TRUE if from/to an insert event (else belongs to a schedule event) */
135 gboolean insert_event;
137 guint32 splice_event_id;
138 gboolean splice_event_cancel_indicator;
140 /* If splice_event_cancel_indicator == 0 */
141 gboolean out_of_network_indicator;
142 gboolean program_splice_flag;
143 gboolean duration_flag;
145 gboolean splice_immediate_flag; /* Only valid for insert_event */
147 gboolean program_splice_time_specified; /* Only valid for insert_event && program_splice */
148 guint64 program_splice_time; /* Only valid for insert_event && program_splice */
151 * GstMpegtsSCTESpliceEvent.utc_splice_time:
153 * The UTC time of the signaled splice event
157 guint32 utc_splice_time; /* Only valid for !insert_event (schedule) && program_splice */
160 * GstMpegtsSCTESpliceEvent.components:
162 * Per-PID splice time information
166 GPtrArray *components; /* Only valid for !program_splice */
168 gboolean break_duration_auto_return;
169 guint64 break_duration;
171 guint16 unique_program_id;
173 guint8 avails_expected;
178 * Types of descriptors
180 * Note: These are only for the descriptors *WITHIN* a SIT */
182 GST_MTS_SCTE_DESC_AVAIL = 0x00,
183 GST_MTS_SCTE_DESC_DTMF = 0x01,
184 GST_MTS_SCTE_DESC_SEGMENTATION = 0x02,
185 GST_MTS_SCTE_DESC_TIME = 0x03,
186 GST_MTS_SCTE_DESC_AUDIO = 0x04
187 } GstMpegtsSCTESpliceDescriptor;
190 GST_MTS_SCTE_SPLICE_COMMAND_NULL = 0x00,
191 GST_MTS_SCTE_SPLICE_COMMAND_SCHEDULE = 0x04,
192 GST_MTS_SCTE_SPLICE_COMMAND_INSERT = 0x05,
193 GST_MTS_SCTE_SPLICE_COMMAND_TIME = 0x06,
194 GST_MTS_SCTE_SPLICE_COMMAND_BANDWIDTH = 0x07,
195 GST_MTS_SCTE_SPLICE_COMMAND_PRIVATE = 0xff
196 } GstMpegtsSCTESpliceCommandType;
198 #define GST_TYPE_MPEGTS_SCTE_SIT (gst_mpegts_scte_sit_get_type())
200 typedef struct _GstMpegtsSCTESIT GstMpegtsSCTESIT;
202 struct _GstMpegtsSCTESIT
204 gboolean encrypted_packet;
205 guint8 encryption_algorithm;
207 guint64 pts_adjustment;
211 guint16 splice_command_length;
213 GstMpegtsSCTESpliceCommandType splice_command_type;
215 /* For time_signal commands */
216 gboolean splice_time_specified;
221 GPtrArray *descriptors;
224 * GstMpegtsSCTESIT.fully_parsed:
226 * When encrypted, or when encountering an unknown command type,
227 * we may still want to pass the sit through.
231 gboolean fully_parsed;
234 * GstMpegtsSCTESIT.is_running_time:
236 * When the SIT was constructed by the application, splice times
237 * are in running_time and must be translated before packetizing.
241 gboolean is_running_time;
245 GType gst_mpegts_scte_sit_get_type (void);
248 GstMpegtsSCTESIT *gst_mpegts_scte_sit_new (void);
251 GstMpegtsSCTESIT *gst_mpegts_scte_null_new (void);
254 GstMpegtsSCTESIT *gst_mpegts_scte_cancel_new (guint32 event_id);
257 GstMpegtsSCTESIT *gst_mpegts_scte_splice_in_new (guint32 event_id,
258 GstClockTime splice_time);
261 GstMpegtsSCTESIT *gst_mpegts_scte_splice_out_new (guint32 event_id,
262 GstClockTime splice_time,
263 GstClockTime duration);
267 GType gst_mpegts_scte_splice_event_get_type (void);
270 GstMpegtsSCTESpliceEvent *gst_mpegts_scte_splice_event_new (void);
273 const GstMpegtsSCTESIT *gst_mpegts_section_get_scte_sit (GstMpegtsSection *section);
276 GstMpegtsSection *gst_mpegts_section_from_scte_sit (GstMpegtsSCTESIT * sit, guint16 pid);
279 GType gst_mpegts_scte_splice_component_get_type (void);
282 GstMpegtsSCTESpliceComponent *gst_mpegts_scte_splice_component_new (guint8 tag);
287 #endif /* GST_SCTE_SECTION_H */