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_ATSC_SECTION_H 25 #define GST_ATSC_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 * GstMpegtsSectionATSCTableID: 35 * @GST_MTS_TABLE_ID_ATSC_MASTER_GUIDE: Master Guide Table (MGT) 36 * @GST_MTS_TABLE_ID_ATSC_TERRESTRIAL_VIRTUAL_CHANNEL: Terrestrial Virtual Channel Table (TVCT) 37 * @GST_MTS_TABLE_ID_ATSC_CABLE_VIRTUAL_CHANNEL: Cable Virtual Channel Table (CVCT) 38 * @GST_MTS_TABLE_ID_ATSC_RATING_REGION: Rating Region Table (RRT) 39 * @GST_MTS_TABLE_ID_ATSC_EVENT_INFORMATION: Event Information Table (EIT) 40 * @GST_MTS_TABLE_ID_ATSC_CHANNEL_OR_EVENT_EXTENDED_TEXT: Extended Text Table (ETT) 41 * @GST_MTS_TABLE_ID_ATSC_SYSTEM_TIME: System Time Table (STT) 42 * @GST_MTS_TABLE_ID_ATSC_DATA_EVENT: A/90: Data Event Table (DET) 43 * @GST_MTS_TABLE_ID_ATSC_DATA_SERVICE: A/90: Data Service Table (DST) 44 * @GST_MTS_TABLE_ID_ATSC_NETWORK_RESOURCE: A/90: Network Resources Table (NRT) 45 * @GST_MTS_TABLE_ID_ATSC_LONG_TERM_SERVICE: A/90: Long Term Service Table (LTST) 46 * @GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE: Directed Channel Change Table (DCCT) 47 * @GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE_SECTION_CODE: Directed Channel Change Selection Code Table (DCCSCT) 48 * @GST_MTS_TABLE_ID_ATSC_SATELLITE_VIRTUAL_CHANNEL: A/81: Satellite Virtual Channel Table 49 * 50 * Values for a #GstMpegtsSection table_id. 51 * 52 * These are the registered ATSC section `table_id` variants. Unless specified 53 * otherwise, they are defined in the "ATSC A/65" specification. 54 * 55 * see also: #GstMpegtsSectionTableID and other variants. 56 */ 57 typedef enum { 58 59 /* ATSC (A/65) */ 60 GST_MTS_TABLE_ID_ATSC_MASTER_GUIDE = 0xC7, 61 GST_MTS_TABLE_ID_ATSC_TERRESTRIAL_VIRTUAL_CHANNEL = 0xC8, 62 GST_MTS_TABLE_ID_ATSC_CABLE_VIRTUAL_CHANNEL = 0xC9, 63 GST_MTS_TABLE_ID_ATSC_RATING_REGION = 0xCA, 64 GST_MTS_TABLE_ID_ATSC_EVENT_INFORMATION = 0xCB, 65 GST_MTS_TABLE_ID_ATSC_CHANNEL_OR_EVENT_EXTENDED_TEXT = 0xCC, 66 GST_MTS_TABLE_ID_ATSC_SYSTEM_TIME = 0xCD, 67 /* ATSC (A/90) */ 68 GST_MTS_TABLE_ID_ATSC_DATA_EVENT = 0xCE, 69 GST_MTS_TABLE_ID_ATSC_DATA_SERVICE = 0xCF, 70 71 /* ATSC (A/57B) */ 72 /** 73 * GST_MTS_TABLE_ID_ATSC_PROGRAM_IDENTIFIER: 74 * 75 * A/57B: Program Identifier Table. 76 * 77 * Since: 1.20 78 */ 79 GST_MTS_TABLE_ID_ATSC_PROGRAM_IDENTIFIER = 0xD0, 80 /* ATSC (A/90) */ 81 GST_MTS_TABLE_ID_ATSC_NETWORK_RESOURCE = 0xD1, 82 GST_MTS_TABLE_ID_ATSC_LONG_TERM_SERVICE = 0xD2, 83 /* ATSC (A/65) */ 84 GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE = 0xD3, 85 GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE_SECTION_CODE = 0xD4, 86 /* 0xD5-0xD9 covered in CEA/SCTE */ 87 GST_MTS_TABLE_ID_ATSC_AGGREGATE_EVENT_INFORMATION = 0xD6, 88 GST_MTS_TABLE_ID_ATSC_AGGREGATE_EXTENDED_TEXT = 0xD7, 89 GST_MTS_TABLE_ID_ATSC_AGGREGATE_DATA_EVENT = 0xD9, 90 /* */ 91 GST_MTS_TABLE_ID_ATSC_SATELLITE_VIRTUAL_CHANNEL = 0xDA, 92 } GstMpegtsSectionATSCTableID; 93 94 /** 95 * GstMpegtsATSCStreamType: 96 * @GST_MPEGTS_STREAM_TYPE_ATSC_DCII_VIDEO: DigiCipher II video | Identical to ITU-T Rec. H.262 | ISO/IEC 13818-2 Video 97 * @GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_AC3: ATSC A/53 Audio | AC-3 98 * @GST_MPEGTS_STREAM_TYPE_ATSC_SUBTITLING: SCTE-27 Subtitling 99 * @GST_MPEGTS_STREAM_TYPE_ATSC_ISOCH_DATA: SCTE-19 Isochronous data | Reserved 100 * @GST_MPEGTS_STREAM_TYPE_ATSC_SIT: SCTE-35 Splice Information Table 101 * @GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_EAC3: E-AC-3 A/52:2018 102 * @GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_DTS_HD: E-AC-3 A/107 (ATSC 2.0) 103 * 104 * Type of mpeg-ts streams for ATSC, as defined by the ATSC Code Points 105 * Registry. For convenience, some stream types from %GstMpegtsScteStreamType 106 * are also included. 107 * 108 * Since: 1.20 109 */ 110 typedef enum { 111 GST_MPEGTS_STREAM_TYPE_ATSC_DCII_VIDEO = 0x80, 112 GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_AC3 = 0x81, 113 GST_MPEGTS_STREAM_TYPE_ATSC_SUBTITLING = 0x82, 114 GST_MPEGTS_STREAM_TYPE_ATSC_ISOCH_DATA = 0x83, 115 /* 0x84-0x85 : RESERVED */ 116 GST_MPEGTS_STREAM_TYPE_ATSC_SIT = 0x86, 117 GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_EAC3 = 0x87, 118 GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_DTS_HD = 0x88, 119 } GstMpegtsATSCStreamType; 120 121 /* TVCT/CVCT */ 122 #define GST_TYPE_MPEGTS_ATSC_VCT (gst_mpegts_atsc_vct_get_type ()) 123 #define GST_TYPE_MPEGTS_ATSC_VCT_SOURCE (gst_mpegts_atsc_vct_source_get_type ()) 124 125 typedef struct _GstMpegtsAtscVCTSource GstMpegtsAtscVCTSource; 126 typedef struct _GstMpegtsAtscVCT GstMpegtsAtscVCT; 127 128 /** 129 * GstMpegtsAtscVCTSource: 130 * @short_name: The short name of a source 131 * @major_channel_number: The major channel number 132 * @minor_channel_number: The minor channel number 133 * @modulation_mode: The modulation mode 134 * @carrier_frequency: The carrier frequency 135 * @channel_TSID: The transport stream ID 136 * @program_number: The program number (see #GstMpegtsPatProgram) 137 * @ETM_location: The ETM location 138 * @access_controlled: is access controlled 139 * @hidden: is hidden 140 * @path_select: is path select, CVCT only 141 * @out_of_band: is out of band, CVCT only 142 * @hide_guide: is hide guide 143 * @service_type: The service type 144 * @source_id: The source id 145 * @descriptors: (element-type GstMpegtsDescriptor): an array of #GstMpegtsDescriptor 146 * 147 * Source from a %GstMpegtsAtscVCT, can be used both for TVCT and CVCT tables 148 */ 149 struct _GstMpegtsAtscVCTSource 150 { 151 gchar *short_name; 152 guint16 major_channel_number; 153 guint16 minor_channel_number; 154 guint8 modulation_mode; 155 guint32 carrier_frequency; 156 guint16 channel_TSID; 157 guint16 program_number; 158 /* FIXME: */ 159 guint8 ETM_location; 160 gboolean access_controlled; 161 gboolean hidden; 162 gboolean path_select; /* CVCT only - reserved bit in TVCT */ 163 gboolean out_of_band; /* CVCT only - reserved bit in TVCT */ 164 gboolean hide_guide; 165 /* FIXME: */ 166 guint8 service_type; 167 guint16 source_id; 168 GPtrArray *descriptors; 169 }; 170 171 /** 172 * GstMpegtsAtscVCT: 173 * @transport_stream_id: The transport stream 174 * @protocol_version: The protocol version 175 * @sources: (element-type GstMpegtsAtscVCTSource): sources 176 * @descriptors: (element-type GstMpegtsDescriptor): descriptors 177 * 178 * Represents both: 179 * Terrestrial Virtual Channel Table (A65) 180 * Cable Virtual Channel Table (A65) 181 * 182 */ 183 struct _GstMpegtsAtscVCT 184 { 185 guint16 transport_stream_id; 186 guint8 protocol_version; 187 GPtrArray *sources; 188 GPtrArray *descriptors; 189 }; 190 191 GST_MPEGTS_API 192 GType gst_mpegts_atsc_vct_get_type (void); 193 194 GST_MPEGTS_API 195 GType gst_mpegts_atsc_vct_source_get_type (void); 196 197 GST_MPEGTS_API 198 const GstMpegtsAtscVCT * gst_mpegts_section_get_atsc_tvct (GstMpegtsSection * section); 199 200 GST_MPEGTS_API 201 const GstMpegtsAtscVCT * gst_mpegts_section_get_atsc_cvct (GstMpegtsSection * section); 202 203 /* MGT */ 204 #define GST_TYPE_MPEGTS_ATSC_MGT (gst_mpegts_atsc_mgt_get_type ()) 205 #define GST_TYPE_MPEGTS_ATSC_MGT_TABLE (gst_mpegts_atsc_mgt_table_get_type ()) 206 207 typedef struct _GstMpegtsAtscMGTTable GstMpegtsAtscMGTTable; 208 typedef struct _GstMpegtsAtscMGT GstMpegtsAtscMGT; 209 210 typedef enum { 211 GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT0 = 0x0100, 212 GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT127 = 0x017F, 213 GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT0 = 0x0200, 214 GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT127 = 0x027F 215 } GstMpegtsAtscMGTTableType; 216 217 /** 218 * GstMpegtsAtscMGTTable: 219 * @table_type: #GstMpegtsAtscMGTTableType 220 * @pid: The packet ID 221 * @version_number: The version number 222 * @number_bytes: 223 * @descriptors: (element-type GstMpegtsDescriptor): descriptors 224 * 225 * Source from a @GstMpegtsAtscMGT 226 */ 227 struct _GstMpegtsAtscMGTTable 228 { 229 guint16 table_type; 230 guint16 pid; 231 guint8 version_number; 232 guint32 number_bytes; 233 GPtrArray *descriptors; 234 }; 235 236 /** 237 * GstMpegtsAtscMGT: 238 * @protocol_version: The protocol version 239 * @tables_defined: The numbers of subtables 240 * @tables: (element-type GstMpegtsAtscMGTTable): the tables 241 * @descriptors: (element-type GstMpegtsDescriptor): descriptors 242 * 243 * Master Guide Table (A65) 244 * 245 */ 246 struct _GstMpegtsAtscMGT 247 { 248 guint8 protocol_version; 249 guint16 tables_defined; 250 GPtrArray *tables; 251 GPtrArray *descriptors; 252 }; 253 254 GST_MPEGTS_API 255 GType gst_mpegts_atsc_mgt_get_type (void); 256 257 GST_MPEGTS_API 258 GType gst_mpegts_atsc_mgt_table_get_type (void); 259 260 GST_MPEGTS_API 261 const GstMpegtsAtscMGT * gst_mpegts_section_get_atsc_mgt (GstMpegtsSection * section); 262 263 GST_MPEGTS_API 264 GstMpegtsSection * gst_mpegts_section_from_atsc_mgt (GstMpegtsAtscMGT * mgt); 265 266 GST_MPEGTS_API 267 GstMpegtsAtscMGT * gst_mpegts_atsc_mgt_new (void); 268 269 /* Multiple string structure (used in ETT and EIT) */ 270 271 #define GST_TYPE_MPEGTS_ATSC_STRING_SEGMENT (gst_mpegts_atsc_string_segment_get_type()) 272 #define GST_TYPE_MPEGTS_ATSC_MULT_STRING (gst_mpegts_atsc_mult_string_get_type()) 273 274 typedef struct _GstMpegtsAtscStringSegment GstMpegtsAtscStringSegment; 275 typedef struct _GstMpegtsAtscMultString GstMpegtsAtscMultString; 276 277 /** 278 * GstMpegtsAtscStringSegment: 279 * @compression_type: The compression type 280 * @mode: The mode 281 * @compressed_data_size: The size of compressed data 282 * @compressed_data: The compressed data 283 * @cached_string: 284 * 285 * A string segment 286 */ 287 struct _GstMpegtsAtscStringSegment { 288 guint8 compression_type; 289 guint8 mode; 290 guint8 compressed_data_size; 291 guint8 *compressed_data; 292 293 gchar *cached_string; 294 }; 295 296 GST_MPEGTS_API 297 const gchar * gst_mpegts_atsc_string_segment_get_string (GstMpegtsAtscStringSegment * seg); 298 299 GST_MPEGTS_API 300 gboolean 301 gst_mpegts_atsc_string_segment_set_string (GstMpegtsAtscStringSegment * seg, 302 gchar *string, 303 guint8 compression_type, 304 guint8 mode); 305 306 /** 307 * GstMpegtsAtscMultString: 308 * @iso_639_langcode: The ISO639 language code 309 * @segments: (element-type GstMpegtsAtscStringSegment) 310 * 311 */ 312 struct _GstMpegtsAtscMultString { 313 gchar iso_639_langcode[4]; 314 GPtrArray *segments; 315 }; 316 317 GST_MPEGTS_API 318 GType gst_mpegts_atsc_string_segment_get_type (void); 319 320 GST_MPEGTS_API 321 GType gst_mpegts_atsc_mult_string_get_type (void); 322 323 /* EIT */ 324 325 #define GST_TYPE_MPEGTS_ATSC_EIT_EVENT (gst_mpegts_atsc_eit_event_get_type()) 326 #define GST_TYPE_MPEGTS_ATSC_EIT (gst_mpegts_atsc_eit_get_type()) 327 328 typedef struct _GstMpegtsAtscEITEvent GstMpegtsAtscEITEvent; 329 typedef struct _GstMpegtsAtscEIT GstMpegtsAtscEIT; 330 331 /** 332 * GstMpegtsAtscEITEvent: 333 * @event_id: The event id 334 * @start_time: The start time 335 * @etm_location: The etm location 336 * @length_in_seconds: The length in seconds 337 * @titles: (element-type GstMpegtsAtscMultString): the titles 338 * @descriptors: (element-type GstMpegtsDescriptor): descriptors 339 * 340 * An ATSC EIT Event 341 */ 342 struct _GstMpegtsAtscEITEvent { 343 guint16 event_id; 344 guint32 start_time; 345 guint8 etm_location; 346 guint32 length_in_seconds; 347 GPtrArray *titles; 348 349 GPtrArray *descriptors; 350 }; 351 352 /** 353 * GstMpegtsAtscEIT: 354 * @source_id: The source id 355 * @protocol_version: The protocol version 356 * @events: (element-type GstMpegtsAtscEITEvent): Events 357 * 358 * Event Information Table (ATSC) 359 * 360 */ 361 struct _GstMpegtsAtscEIT 362 { 363 guint16 source_id; 364 guint8 protocol_version; 365 366 GPtrArray *events; 367 }; 368 369 GST_MPEGTS_API 370 GType gst_mpegts_atsc_eit_event_get_type (void); 371 372 GST_MPEGTS_API 373 GType gst_mpegts_atsc_eit_get_type (void); 374 375 GST_MPEGTS_API 376 const GstMpegtsAtscEIT *gst_mpegts_section_get_atsc_eit (GstMpegtsSection *section); 377 378 /* ETT */ 379 380 #define GST_TYPE_MPEGTS_ATSC_ETT (gst_mpegts_atsc_ett_get_type()) 381 382 typedef struct _GstMpegtsAtscETT GstMpegtsAtscETT; 383 384 /** 385 * GstMpegtsAtscETT: 386 * @ett_table_id_extension: 387 * @protocol_version: The protocol version 388 * @etm_id: The etm id 389 * @messages: (element-type GstMpegtsAtscMultString): List of texts 390 * 391 * Extended Text Table (ATSC) 392 * 393 */ 394 struct _GstMpegtsAtscETT 395 { 396 guint16 ett_table_id_extension; 397 guint16 protocol_version; 398 guint32 etm_id; 399 400 GPtrArray *messages; 401 }; 402 403 GST_MPEGTS_API 404 GType gst_mpegts_atsc_ett_get_type (void); 405 406 GST_MPEGTS_API 407 const GstMpegtsAtscETT *gst_mpegts_section_get_atsc_ett (GstMpegtsSection *section); 408 409 /* STT */ 410 #define GST_TYPE_MPEGTS_ATSC_STT (gst_mpegts_atsc_stt_get_type ()) 411 412 typedef struct _GstMpegtsAtscSTT GstMpegtsAtscSTT; 413 414 /** 415 * GstMpegtsAtscSTT: 416 * @protocol_version: The protocol version 417 * @system_time: The system time 418 * @gps_utc_offset: The GPS to UTC offset 419 * @ds_status: 420 * @ds_dayofmonth: The day of month 421 * @ds_hour: The hour 422 * @descriptors: (element-type GstMpegtsDescriptor): descriptors 423 * @utc_datetime: The UTC date and time 424 * 425 * System Time Table (A65) 426 * 427 */ 428 struct _GstMpegtsAtscSTT 429 { 430 guint8 protocol_version; 431 guint32 system_time; 432 guint8 gps_utc_offset; 433 gboolean ds_status; 434 guint8 ds_dayofmonth; 435 guint8 ds_hour; 436 GPtrArray *descriptors; 437 438 GstDateTime *utc_datetime; 439 }; 440 441 GST_MPEGTS_API 442 GType gst_mpegts_atsc_stt_get_type (void); 443 444 GST_MPEGTS_API 445 const GstMpegtsAtscSTT * gst_mpegts_section_get_atsc_stt (GstMpegtsSection * section); 446 /* FIXME receive a non-const parameter but we only provide a const getter */ 447 448 GST_MPEGTS_API 449 GstDateTime * gst_mpegts_atsc_stt_get_datetime_utc (GstMpegtsAtscSTT * stt); 450 451 GST_MPEGTS_API 452 GstMpegtsSection * gst_mpegts_section_from_atsc_stt (GstMpegtsAtscSTT * stt); 453 454 GST_MPEGTS_API 455 GstMpegtsAtscSTT * gst_mpegts_atsc_stt_new (void); 456 457 /* RRT */ 458 #define GST_TYPE_MPEGTS_ATSC_RRT (gst_mpegts_atsc_rrt_get_type ()) 459 #define GST_TYPE_MPEGTS_ATSC_RRT_DIMENSION (gst_mpegts_atsc_rrt_dimension_get_type ()) 460 #define GST_TYPE_MPEGTS_ATSC_RRT_DIMENSION_VALUE (gst_mpegts_atsc_rrt_dimension_value_get_type ()) 461 462 typedef struct _GstMpegtsAtscRRT GstMpegtsAtscRRT; 463 typedef struct _GstMpegtsAtscRRTDimension GstMpegtsAtscRRTDimension; 464 typedef struct _GstMpegtsAtscRRTDimensionValue GstMpegtsAtscRRTDimensionValue; 465 466 /** 467 * GstMpegtsAtscRRTDimensionValue: 468 * @abbrev_ratings: (element-type GstMpegtsAtscMultString): the abbreviated ratings 469 * @ratings: (element-type GstMpegtsAtscMultString): the ratings 470 * 471 * Since: 1.18 472 */ 473 struct _GstMpegtsAtscRRTDimensionValue 474 { 475 GPtrArray *abbrev_ratings; 476 GPtrArray *ratings; 477 }; 478 479 /** 480 * GstMpegtsAtscRRTDimension: 481 * @names: (element-type GstMpegtsAtscMultString): the names 482 * @graduated_scale: whether the ratings represent a graduated scale 483 * @values_defined: the number of values defined for this dimension 484 * @values: (element-type GstMpegtsAtscRRTDimensionValue): set of values 485 * 486 * Since: 1.18 487 */ 488 struct _GstMpegtsAtscRRTDimension 489 { 490 GPtrArray * names; 491 gboolean graduated_scale; 492 guint8 values_defined; 493 GPtrArray * values; 494 }; 495 496 /** 497 * GstMpegtsAtscRRT: 498 * @protocol_version: The protocol version 499 * @names: (element-type GstMpegtsAtscMultString): the names 500 * @dimensions_defined: the number of dimensions defined for this rating table 501 * @dimensions: (element-type GstMpegtsAtscRRTDimension): A set of dimensions 502 * @descriptors: descriptors 503 * 504 * Region Rating Table (A65) 505 * 506 * Since: 1.18 507 */ 508 struct _GstMpegtsAtscRRT 509 { 510 guint8 protocol_version; 511 GPtrArray * names; 512 guint8 dimensions_defined; 513 GPtrArray * dimensions; 514 GPtrArray * descriptors; 515 }; 516 517 GST_MPEGTS_API 518 GType gst_mpegts_atsc_rrt_get_type (void); 519 520 GST_MPEGTS_API 521 GType gst_mpegts_atsc_rrt_dimension_get_type (void); 522 523 GST_MPEGTS_API 524 GType gst_mpegts_atsc_rrt_dimension_value_get_type (void); 525 526 GST_MPEGTS_API 527 const GstMpegtsAtscRRT * gst_mpegts_section_get_atsc_rrt (GstMpegtsSection * section); 528 529 GST_MPEGTS_API 530 GstMpegtsSection * gst_mpegts_section_from_atsc_rrt (GstMpegtsAtscRRT * rrt); 531 532 GST_MPEGTS_API 533 GstMpegtsAtscRRT * gst_mpegts_atsc_rrt_new (void); 534 535 GST_MPEGTS_API 536 GstMpegtsAtscRRTDimension * gst_mpegts_atsc_rrt_dimension_new (void); 537 538 GST_MPEGTS_API 539 GstMpegtsAtscRRTDimensionValue * gst_mpegts_atsc_rrt_dimension_value_new (void); 540 541 G_END_DECLS 542 543 #endif /* GST_MPEGTS_SECTION_H */ 544