• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * mpegtspacketizer.h -
3  * Copyright (C) 2013 Edward Hervey
4  *
5  * Authors:
6  *   Edward Hervey <edward@collabora.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef GST_DVB_SECTION_H
25 #define GST_DVB_SECTION_H
26 
27 #include <gst/gst.h>
28 #include <gst/mpegts/gstmpegtssection.h>
29 #include <gst/mpegts/gstmpegtsdescriptor.h>
30 
31 G_BEGIN_DECLS
32 
33 /**
34  * GstMpegtsSectionDVBTableID:
35  * @GST_MTS_TABLE_ID_NETWORK_INFORMATION_ACTUAL_NETWORK: Network Information Table (NIT), Actual Network
36  * @GST_MTS_TABLE_ID_NETWORK_INFORMATION_OTHER_NETWORK: Network Information Table (NIT), Other Network
37  * @GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_ACTUAL_TS: Service Description Table (SDT), Actual Transport Stream
38  * @GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_OTHER_TS: Service Description Table (SDT), Other Transport Stream
39  * @GST_MTS_TABLE_ID_BOUQUET_ASSOCIATION: Bouquet Association Table (BAT)
40  * @GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_PRESENT: Event Information Table (EIT), Actual Transport Stream, present/following
41  * @GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_PRESENT: Event Information Table (EIT), Other Transport Stream, present/following
42  * @GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_1: Event Information Table (EIT), Actual Transport Stream, Schedule (first)
43  * @GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_N: Event Information Table (EIT), Actual Transport Stream, Schedule (last)
44  * @GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_1: Event Information Table (EIT), Other Transport Stream, Schedule (first)
45  * @GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_N: Event Information Table (EIT), Other Transport Stream, Schedule (last)
46  * @GST_MTS_TABLE_ID_TIME_DATE: Time Date Table (TDT)
47  * @GST_MTS_TABLE_ID_RUNNING_STATUS: Running Status Table (RST)
48  * @GST_MTS_TABLE_ID_STUFFING: Stuffing Table (ST)
49  * @GST_MTS_TABLE_ID_TIME_OFFSET: Time Offset Table (TOT)
50  * @GST_MTS_TABLE_ID_APPLICATION_INFORMATION_TABLE: ETSI TS 102 323: Application Information Table (AIT)
51  * @GST_MTS_TABLE_ID_CONTAINER: ETSI TS 102 323: Container Section
52  * @GST_MTS_TABLE_ID_RELATED_CONTENT: ETSI TS 102 323: Related Content Table (RCT)
53  * @GST_MTS_TABLE_ID_CONTENT_IDENTIFIER: ETSI TS 102 323: Content Identifier Table (CIT)
54  * @GST_MTS_TABLE_ID_MPE_FEC: ETSI TS 301 192: MPE-FEC Section
55  * @GST_MTS_TABLE_ID_RESOLUTION_NOTIFICATION: ETSI 103 323: Resolution Provider Notification Table (RNT)
56  * @GST_MTS_TABLE_ID_MPE_IFEC: ETSI TS 102 772: MPE-IFEC Section
57  * @GST_MTS_TABLE_ID_DISCONTINUITY_INFORMATION: Discontinuity Information Table (DIT)
58  * @GST_MTS_TABLE_ID_SELECTION_INFORMATION: Selection Information Table (SIT)
59  * @GST_MTS_TABLE_ID_CA_MESSAGE_ECM_0: ETSI TR 289: CA Message Table (CMT): ECM 0
60  * @GST_MTS_TABLE_ID_CA_MESSAGE_ECM_1: ETSI TR 289: CA Message Table (CMT): ECM 1
61  * @GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_1: ETSI TR 289: CA Message Table (CMT): CA System Private (First)
62  * @GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_N: ETSI TR 289: CA Message Table (CMT): CA System Private (Last)
63  *
64  * Values for a #GstMpegtsSection table_id.
65  *
66  * These are the registered DVB table_id variants. Unless specified otherwise,
67  * they come from the DVB Specification for SI (ETSI EN 300 468).
68  *
69  * see also: #GstMpegtsSectionTableID
70  */
71 typedef enum {
72   /* EN 300 468 (DVB) v 1.12.1 */
73   GST_MTS_TABLE_ID_NETWORK_INFORMATION_ACTUAL_NETWORK	= 0x40,
74   GST_MTS_TABLE_ID_NETWORK_INFORMATION_OTHER_NETWORK	= 0x41,
75   GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_ACTUAL_TS	= 0x42,
76   GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_OTHER_TS		= 0x46,
77   GST_MTS_TABLE_ID_BOUQUET_ASSOCIATION			= 0x4A,
78 
79   /* ETSI TS 102 006 */
80   /**
81    * GST_MTS_TABLE_ID_UPDATE_NOTIFICATION:
82    *
83    * ETSI TS 102 006: Update Notification Table (UNT)
84    *
85    * Since: 1.20
86    */
87   GST_MTS_TABLE_ID_UPDATE_NOTIFICATION			= 0x4B,
88 
89   /* ETSI EN 303 560 */
90   /**
91    * GST_MTS_TABLE_ID_DOWNLOADABLE_FONT_INFO:
92    *
93    * ETSI EN 303 560: Downloadable Font Info
94    *
95    * Since: 1.20
96    */
97   GST_MTS_TABLE_ID_DOWNLOADABLE_FONT_INFO		= 0x4C,
98 
99   /* EN 300 468 */
100   GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_PRESENT	= 0x4E,
101   GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_PRESENT	= 0x4F,
102   GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_1	= 0x50,
103   GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_N	= 0x5F,
104   GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_1	= 0x60,
105   GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_N	= 0x6F,
106   GST_MTS_TABLE_ID_TIME_DATE				= 0x70,
107   GST_MTS_TABLE_ID_RUNNING_STATUS			= 0x71,
108   GST_MTS_TABLE_ID_STUFFING				= 0x72,
109   GST_MTS_TABLE_ID_TIME_OFFSET				= 0x73,
110 
111   /* TS 102 812 (MHP v1.1.3) */
112   GST_MTS_TABLE_ID_APPLICATION_INFORMATION_TABLE	= 0x74,
113 
114   /* TS 102 323 (DVB TV Anytime v1.5.1) */
115   GST_MTS_TABLE_ID_CONTAINER				= 0x75,
116   GST_MTS_TABLE_ID_RELATED_CONTENT			= 0x76,
117   GST_MTS_TABLE_ID_CONTENT_IDENTIFIER			= 0x77,
118 
119   /* EN 301 192 (DVB specification for data broadcasting) */
120   GST_MTS_TABLE_ID_MPE_FEC				= 0x78,
121 
122   /* TS 102 323 (DVB TV Anytime v1.5.1) */
123   GST_MTS_TABLE_ID_RESOLUTION_NOTIFICATION		= 0x79,
124 
125   /* TS 102 772 (DVB-SH Multi-Protocol Encapsulation) */
126   GST_MTS_TABLE_ID_MPE_IFEC				= 0x7A,
127 
128   /* TS 102 809 (DVB Hybrid Broadcast/Broadband) */
129   /**
130    * GST_MTS_TABLE_ID_PROTECTION_MESSAGE:
131    *
132    * ETSI TS 102 809: Protection Message Section
133    *
134    * Since: 1.20
135    */
136   GST_MTS_TABLE_ID_PROTECTION_MESSAGE			= 0x7B,
137 
138   /* EN 300 468 (DVB) v 1.12.1 */
139   GST_MTS_TABLE_ID_DISCONTINUITY_INFORMATION		= 0x7E,
140   GST_MTS_TABLE_ID_SELECTION_INFORMATION		= 0x7F,
141 
142   /* ETR 289 (DVB Support for use of scrambling and CA) */
143   GST_MTS_TABLE_ID_CA_MESSAGE_ECM_0			= 0x80,
144   GST_MTS_TABLE_ID_CA_MESSAGE_ECM_1			= 0x81,
145   GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_1		= 0x82,
146   GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_N		= 0x8F,
147 
148   /* ... */
149 
150   /* EN 301 790 (DVB interaction channel for satellite distribution channels) */
151   /* Note: Not 100% sure we want those exposed here ... */
152   GST_MTS_TABLE_ID_SCT					= 0xA0,
153   GST_MTS_TABLE_ID_FCT					= 0xA1,
154   GST_MTS_TABLE_ID_TCT					= 0xA2,
155   GST_MTS_TABLE_ID_SPT					= 0xA3,
156   GST_MTS_TABLE_ID_CMT					= 0xA4,
157   GST_MTS_TABLE_ID_TBTP					= 0xA5,
158   GST_MTS_TABLE_ID_PCR_PACKET_PAYLOAD			= 0xA6,
159   GST_MTS_TABLE_ID_TRANSMISSION_MODE_SUPPORT_PAYLOAD	= 0xAA,
160   GST_MTS_TABLE_ID_TIM					= 0xB0,
161   GST_MTS_TABLE_ID_LL_FEC_PARITY_DATA_TABLE		= 0xB1
162 
163 } GstMpegtsSectionDVBTableID;
164 
165 /**
166  * GstMpegtsRunningStatus:
167  *
168  * Running status of a service.
169  *
170  * Corresponds to table 6 of ETSI EN 300 468 (v1.13.0)
171  */
172 typedef enum
173 {
174   GST_MPEGTS_RUNNING_STATUS_UNDEFINED = 0,
175   GST_MPEGTS_RUNNING_STATUS_NOT_RUNNING,
176   GST_MPEGTS_RUNNING_STATUS_STARTS_IN_FEW_SECONDS,
177   GST_MPEGTS_RUNNING_STATUS_PAUSING,
178   GST_MPEGTS_RUNNING_STATUS_RUNNING,
179   GST_MPEGTS_RUNNING_STATUS_OFF_AIR
180 } GstMpegtsRunningStatus;
181 
182 
183 
184 /* NIT */
185 
186 typedef struct _GstMpegtsNITStream GstMpegtsNITStream;
187 typedef struct _GstMpegtsNIT GstMpegtsNIT;
188 
189 #define GST_TYPE_MPEGTS_NIT (gst_mpegts_nit_get_type())
190 #define GST_TYPE_MPEGTS_NIT_STREAM (gst_mpegts_nit_stream_get_type())
191 
192 /**
193  * GstMpegtsNITStream:
194  * @transport_stream_id:
195  * @original_network_id:
196  * @descriptors: (element-type GstMpegtsDescriptor):
197  *
198  */
199 struct _GstMpegtsNITStream
200 {
201   guint16  transport_stream_id;
202   guint16  original_network_id;
203 
204   GPtrArray  *descriptors;
205 };
206 
207 /**
208  * GstMpegtsNIT:
209  * @actual_network: Whether this NIT corresponds to the actual stream
210  * @network_id: ID of the network that this NIT describes
211  * @descriptors: (element-type GstMpegtsDescriptor): the global descriptors
212  * @streams: (element-type GstMpegtsNITStream): the streams
213  *
214  * Network Information Table (ISO/IEC 13818-1 / EN 300 468)
215  *
216  */
217 struct _GstMpegtsNIT
218 {
219   gboolean   actual_network;
220   guint16    network_id;
221 
222   GPtrArray  *descriptors;
223 
224   GPtrArray *streams;
225 };
226 
227 GST_MPEGTS_API
228 GType gst_mpegts_nit_get_type (void);
229 
230 GST_MPEGTS_API
231 GType gst_mpegts_nit_stream_get_type (void);
232 
233 GST_MPEGTS_API
234 const GstMpegtsNIT *gst_mpegts_section_get_nit (GstMpegtsSection *section);
235 
236 GST_MPEGTS_API
237 GstMpegtsSection *gst_mpegts_section_from_nit (GstMpegtsNIT *nit);
238 
239 GST_MPEGTS_API
240 GstMpegtsNIT *gst_mpegts_nit_new (void);
241 
242 GST_MPEGTS_API
243 GstMpegtsNITStream *gst_mpegts_nit_stream_new (void);
244 
245 
246 /* BAT */
247 
248 typedef struct _GstMpegtsBATStream GstMpegtsBATStream;
249 typedef struct _GstMpegtsBAT GstMpegtsBAT;
250 
251 #define GST_TYPE_MPEGTS_BAT (gst_mpegts_bat_get_type())
252 #define GST_TYPE_MPEGTS_BAT_STREAM (gst_mpegts_bat_get_type())
253 
254 struct _GstMpegtsBATStream
255 {
256   guint16   transport_stream_id;
257   guint16   original_network_id;
258 
259   GPtrArray   *descriptors;
260 };
261 
262 /**
263  * GstMpegtsBAT:
264  * @descriptors: (element-type GstMpegtsDescriptor):
265  * @streams: (element-type GstMpegtsBATStream):
266  *
267  * DVB Bouquet Association Table (EN 300 468)
268  */
269 struct _GstMpegtsBAT
270 {
271   GPtrArray  *descriptors;
272 
273   GPtrArray  *streams;
274 };
275 
276 GST_MPEGTS_API
277 GType gst_mpegts_bat_get_type (void);
278 
279 GST_MPEGTS_API
280 GType gst_mpegts_bat_stream_get_type (void);
281 
282 GST_MPEGTS_API
283 const GstMpegtsBAT *gst_mpegts_section_get_bat (GstMpegtsSection *section);
284 
285 /* SDT */
286 #define GST_TYPE_MPEGTS_SDT (gst_mpegts_sdt_get_type())
287 #define GST_TYPE_MPEGTS_SDT_SERVICE (gst_mpegts_sdt_service_get_type())
288 
289 typedef struct _GstMpegtsSDTService GstMpegtsSDTService;
290 typedef struct _GstMpegtsSDT GstMpegtsSDT;
291 
292 /**
293  * GstMpegtsSDTService:
294  * @service_id: The program number this table belongs to
295  * @EIT_schedule_flag: EIT schedule information is present in this transport stream
296  * @EIT_present_following_flag: EIT present/following information is present in this transport stream
297  * @running_status: Status of this service
298  * @free_CA_mode: True if one or more streams is controlled by a CA system
299  * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
300  *
301  */
302 struct _GstMpegtsSDTService
303 {
304   guint16    service_id;
305 
306   gboolean   EIT_schedule_flag;
307   gboolean   EIT_present_following_flag;
308   GstMpegtsRunningStatus running_status;
309   gboolean   free_CA_mode;
310 
311   GPtrArray    *descriptors;
312 };
313 
314 /**
315  * GstMpegtsSDT:
316  * @original_network_id: Network ID of the originating delivery system
317  * @actual_ts: True if the table describes this transport stream
318  * @transport_stream_id: ID of this transport stream
319  * @services: (element-type GstMpegtsSDTService): List of services
320  *
321  * Service Description Table (EN 300 468)
322  *
323  */
324 struct _GstMpegtsSDT
325 {
326   guint16    original_network_id;
327   gboolean   actual_ts;
328   guint16    transport_stream_id;
329 
330   GPtrArray *services;
331 };
332 
333 GST_MPEGTS_API
334 GType gst_mpegts_sdt_get_type (void);
335 
336 GST_MPEGTS_API
337 GType gst_mpegts_sdt_service_get_type (void);
338 
339 GST_MPEGTS_API
340 const GstMpegtsSDT *gst_mpegts_section_get_sdt (GstMpegtsSection *section);
341 
342 GST_MPEGTS_API
343 GstMpegtsSection *gst_mpegts_section_from_sdt (GstMpegtsSDT * sdt);
344 
345 GST_MPEGTS_API
346 GstMpegtsSDT *gst_mpegts_sdt_new (void);
347 
348 GST_MPEGTS_API
349 GstMpegtsSDTService *gst_mpegts_sdt_service_new (void);
350 
351 /* EIT */
352 
353 #define GST_TYPE_MPEGTS_EIT (gst_mpegts_eit_get_type())
354 #define GST_TYPE_MPEGTS_EIT_EVENT (gst_mpegts_eit_event_get_type())
355 
356 typedef struct _GstMpegtsEITEvent GstMpegtsEITEvent;
357 typedef struct _GstMpegtsEIT GstMpegtsEIT;
358 
359 /**
360  * GstMpegtsEITEvent:
361  * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
362  *
363  * Event from a @GstMpegtsEIT
364  */
365 struct _GstMpegtsEITEvent
366 {
367   guint16      event_id;
368 
369   GstDateTime *start_time;
370   guint32      duration;
371 
372   GstMpegtsRunningStatus running_status;
373   gboolean     free_CA_mode;
374 
375   GPtrArray   *descriptors;
376 };
377 
378 /**
379  * GstMpegtsEIT:
380  * @events: (element-type GstMpegtsEITEvent): List of events
381  *
382  * Event Information Table (EN 300 468)
383  *
384  */
385 struct _GstMpegtsEIT
386 {
387   guint16        transport_stream_id;
388   guint16        original_network_id;
389   guint8         segment_last_section_number;
390   guint8         last_table_id;
391 
392   gboolean       actual_stream;
393   gboolean       present_following;
394 
395   GPtrArray     *events;
396 };
397 
398 GST_MPEGTS_API
399 GType gst_mpegts_eit_get_type (void);
400 
401 GST_MPEGTS_API
402 GType gst_mpegts_eit_event_get_type (void);
403 
404 GST_MPEGTS_API
405 const GstMpegtsEIT *gst_mpegts_section_get_eit (GstMpegtsSection *section);
406 
407 /* TDT */
408 
409 GST_MPEGTS_API
410 GstDateTime *gst_mpegts_section_get_tdt (GstMpegtsSection *section);
411 
412 /* TOT */
413 
414 typedef struct _GstMpegtsTOT GstMpegtsTOT;
415 #define GST_TYPE_MPEGTS_TOT (gst_mpegts_tot_get_type())
416 /**
417  * GstMpegtsTOT:
418  * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
419  *
420  * Time Offset Table (EN 300 468)
421  *
422  */
423 struct _GstMpegtsTOT
424 {
425   GstDateTime   *utc_time;
426 
427   GPtrArray     *descriptors;
428 };
429 
430 GST_MPEGTS_API
431 GType gst_mpegts_tot_get_type (void);
432 
433 GST_MPEGTS_API
434 const GstMpegtsTOT *gst_mpegts_section_get_tot (GstMpegtsSection *section);
435 
436 /* SIT */
437 
438 typedef struct _GstMpegtsSITService GstMpegtsSITService;
439 /**
440  * GST_TYPE_MPEGTS_SIT_SERVICE:
441  *
442  * Since: 1.20
443  */
444 #define GST_TYPE_MPEGTS_SIT_SERVICE (gst_mpegts_sit_service_get_type())
445 
446 typedef struct _GstMpegtsSIT GstMpegtsSIT;
447 /**
448  * GST_TYPE_MPEGTS_SIT:
449  *
450  * Since: 1.20
451  */
452 #define GST_TYPE_MPEGTS_SIT (gst_mpegts_sit_get_type())
453 
454 /**
455  * GstMpegtsSITService:
456  * @service_id: The Program number this table belongs to
457  * @running_status: Status of this service
458  * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
459  *
460  * SIT Service entry
461  *
462  * Since: 1.20
463  */
464 struct _GstMpegtsSITService
465 {
466   guint16        service_id;
467   GstMpegtsRunningStatus running_status;
468 
469   GPtrArray     *descriptors;
470 };
471 
472 /**
473  * GstMpegtsSIT:
474  * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
475  * @services: (element-type GstMpegtsSITService): List of services
476  *
477  * Selection Information Table (EN 300 468)
478  *
479  * Since: 1.20
480  */
481 struct _GstMpegtsSIT
482 {
483   GPtrArray     *descriptors;
484   GPtrArray     *services;
485 };
486 
487 
488 GST_MPEGTS_API
489 GType gst_mpegts_sit_get_type (void);
490 
491 GST_MPEGTS_API
492 GType gst_mpegts_sit_service_get_type (void);
493 
494 GST_MPEGTS_API
495 const GstMpegtsSIT *gst_mpegts_section_get_sit (GstMpegtsSection *section);
496 
497 
498 G_END_DECLS
499 
500 #endif				/* GST_MPEGTS_SECTION_H */
501