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_TYPE_MPEGTS_SCTE_SPLICE_COMPONENT (gst_mpegts_scte_splice_component_get_type())
107 typedef struct _GstMpegtsSCTESpliceComponent GstMpegtsSCTESpliceComponent;
109 struct _GstMpegtsSCTESpliceComponent {
112 gboolean splice_time_specified; /* Only valid for insert_event */
113 guint64 splice_time; /* Only valid for insert_event */
115 guint32 utc_splice_time; /* Only valid for !insert_event (schedule) */
118 /* Splice Information Table (SIT) */
119 #define GST_TYPE_MPEGTS_SCTE_SPLICE_EVENT (gst_mpegts_scte_splice_event_get_type())
120 typedef struct _GstMpegtsSCTESpliceEvent GstMpegtsSCTESpliceEvent;
122 struct _GstMpegtsSCTESpliceEvent {
123 /* TRUE if from/to an insert event (else belongs to a schedule event) */
124 gboolean insert_event;
126 guint32 splice_event_id;
127 gboolean splice_event_cancel_indicator;
129 /* If splice_event_cancel_indicator == 0 */
130 gboolean out_of_network_indicator;
131 gboolean program_splice_flag;
132 gboolean duration_flag;
134 gboolean splice_immediate_flag; /* Only valid for insert_event */
136 gboolean program_splice_time_specified; /* Only valid for insert_event && program_splice */
137 guint64 program_splice_time; /* Only valid for insert_event && program_splice */
139 guint32 utc_splice_time; /* Only valid for !insert_event (schedule) && program_splice */
141 GPtrArray *components; /* Only valid for !program_splice */
143 gboolean break_duration_auto_return;
144 guint64 break_duration;
146 guint16 unique_program_id;
148 guint8 avails_expected;
153 * Types of descriptors
155 * Note: These are only for the descriptors *WITHIN* a SIT */
157 GST_MTS_SCTE_DESC_AVAIL = 0x00,
158 GST_MTS_SCTE_DESC_DTMF = 0x01,
159 GST_MTS_SCTE_DESC_SEGMENTATION = 0x02,
160 GST_MTS_SCTE_DESC_TIME = 0x03,
161 GST_MTS_SCTE_DESC_AUDIO = 0x04
162 } GstMpegtsSCTESpliceDescriptor;
165 GST_MTS_SCTE_SPLICE_COMMAND_NULL = 0x00,
166 GST_MTS_SCTE_SPLICE_COMMAND_SCHEDULE = 0x04,
167 GST_MTS_SCTE_SPLICE_COMMAND_INSERT = 0x05,
168 GST_MTS_SCTE_SPLICE_COMMAND_TIME = 0x06,
169 GST_MTS_SCTE_SPLICE_COMMAND_BANDWIDTH = 0x07,
170 GST_MTS_SCTE_SPLICE_COMMAND_PRIVATE = 0xff
171 } GstMpegtsSCTESpliceCommandType;
173 #define GST_TYPE_MPEGTS_SCTE_SIT (gst_mpegts_scte_sit_get_type())
175 typedef struct _GstMpegtsSCTESIT GstMpegtsSCTESIT;
177 struct _GstMpegtsSCTESIT
179 gboolean encrypted_packet;
180 guint8 encryption_algorithm;
182 guint64 pts_adjustment;
186 guint16 splice_command_length;
188 /* When encrypted, or when encountering an unknown command type,
189 * we may still want to pass the sit through */
190 gboolean fully_parsed;
192 GstMpegtsSCTESpliceCommandType splice_command_type;
194 /* For time_signal commands */
195 gboolean splice_time_specified;
200 GPtrArray *descriptors;
204 GType gst_mpegts_scte_sit_get_type (void);
207 GstMpegtsSCTESIT *gst_mpegts_scte_sit_new (void);
210 GstMpegtsSCTESIT *gst_mpegts_scte_null_new (void);
213 GstMpegtsSCTESIT *gst_mpegts_scte_cancel_new (guint32 event_id);
216 GstMpegtsSCTESIT *gst_mpegts_scte_splice_in_new (guint32 event_id,
217 GstClockTime splice_time);
220 GstMpegtsSCTESIT *gst_mpegts_scte_splice_out_new (guint32 event_id,
221 GstClockTime splice_time,
222 GstClockTime duration);
226 GType gst_mpegts_scte_splice_event_get_type (void);
229 GstMpegtsSCTESpliceEvent *gst_mpegts_scte_splice_event_new (void);
232 const GstMpegtsSCTESIT *gst_mpegts_section_get_scte_sit (GstMpegtsSection *section);
235 GstMpegtsSection *gst_mpegts_section_from_scte_sit (GstMpegtsSCTESIT * sit, guint16 pid);
238 GType gst_mpegts_scte_splice_component_get_type (void);
241 GstMpegtsSCTESpliceComponent *gst_mpegts_scte_splice_component_new (guint8 tag);
246 #endif /* GST_SCTE_SECTION_H */