1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gst.mpegts.Section; 26 27 private import glib.Bytes; 28 private import glib.ConstructionException; 29 private import glib.PtrArray; 30 private import gobject.ObjectG; 31 private import gst.mpegts.AtscEIT; 32 private import gst.mpegts.AtscETT; 33 private import gst.mpegts.AtscMGT; 34 private import gst.mpegts.AtscSTT; 35 private import gst.mpegts.AtscVCT; 36 private import gst.mpegts.BAT; 37 private import gst.mpegts.EIT; 38 private import gst.mpegts.NIT; 39 private import gst.mpegts.PMT; 40 private import gst.mpegts.PatProgram; 41 private import gst.mpegts.SDT; 42 private import gst.mpegts.TOT; 43 private import gst.mpegts.c.functions; 44 public import gst.mpegts.c.types; 45 private import gstreamer.DateTime; 46 private import gstreamer.Element; 47 private import gstreamer.Event; 48 private import gstreamer.Message; 49 private import gstreamer.ObjectGst; 50 51 52 /** 53 * For more details, refer to the ITU H.222.0 or ISO/IEC 13818-1 specifications 54 * and other specifications mentioned in the documentation. 55 */ 56 public class Section 57 { 58 /** the main Gtk struct */ 59 protected GstMpegtsSection* gstMpegtsSection; 60 protected bool ownedRef; 61 62 /** Get the main Gtk struct */ 63 public GstMpegtsSection* getSectionStruct(bool transferOwnership = false) 64 { 65 if (transferOwnership) 66 ownedRef = false; 67 return gstMpegtsSection; 68 } 69 70 /** the main Gtk struct as a void* */ 71 protected void* getStruct() 72 { 73 return cast(void*)gstMpegtsSection; 74 } 75 76 /** 77 * Sets our main struct and passes it to the parent class. 78 */ 79 public this (GstMpegtsSection* gstMpegtsSection, bool ownedRef = false) 80 { 81 this.gstMpegtsSection = gstMpegtsSection; 82 this.ownedRef = ownedRef; 83 } 84 85 86 /** */ 87 public static GType getType() 88 { 89 return gst_mpegts_section_get_type(); 90 } 91 92 /** 93 * Creates a new #GstMpegtsSection from the provided @data. 94 * 95 * Note: Ensuring @data is big enough to contain the full section is the 96 * responsibility of the caller. If it is not big enough, %NULL will be 97 * returned. 98 * 99 * Note: it is the responsibility of the caller to ensure @data does point 100 * to the beginning of the section. 101 * 102 * Params: 103 * pid = the PID to which this section belongs 104 * data = a pointer to the beginning of the section (i.e. the first byte 105 * should contain the table_id field). 106 * 107 * Returns: A new #GstMpegtsSection if the data was valid, 108 * else %NULL 109 * 110 * Throws: ConstructionException GTK+ fails to create the object. 111 */ 112 public this(ushort pid, ubyte[] data) 113 { 114 auto p = gst_mpegts_section_new(pid, data.ptr, cast(size_t)data.length); 115 116 if(p is null) 117 { 118 throw new ConstructionException("null returned by new"); 119 } 120 121 this(cast(GstMpegtsSection*) p); 122 } 123 124 /** 125 * Returns the #GstMpegtsAtscVCT contained in the @section 126 * 127 * Returns: The #GstMpegtsAtscVCT contained in the section, or %NULL if an error 128 * happened. 129 */ 130 public AtscVCT getAtscCvct() 131 { 132 auto p = gst_mpegts_section_get_atsc_cvct(gstMpegtsSection); 133 134 if(p is null) 135 { 136 return null; 137 } 138 139 return ObjectG.getDObject!(AtscVCT)(cast(GstMpegtsAtscVCT*) p); 140 } 141 142 /** 143 * Returns the #GstMpegtsAtscEIT contained in the @section. 144 * 145 * Returns: The #GstMpegtsAtscEIT contained in the section, or %NULL if an error 146 * happened. 147 */ 148 public AtscEIT getAtscEit() 149 { 150 auto p = gst_mpegts_section_get_atsc_eit(gstMpegtsSection); 151 152 if(p is null) 153 { 154 return null; 155 } 156 157 return ObjectG.getDObject!(AtscEIT)(cast(GstMpegtsAtscEIT*) p); 158 } 159 160 /** 161 * Returns the #GstMpegtsAtscETT contained in the @section. 162 * 163 * Returns: The #GstMpegtsAtscETT contained in the section, or %NULL if an error 164 * happened. 165 */ 166 public AtscETT getAtscEtt() 167 { 168 auto p = gst_mpegts_section_get_atsc_ett(gstMpegtsSection); 169 170 if(p is null) 171 { 172 return null; 173 } 174 175 return ObjectG.getDObject!(AtscETT)(cast(GstMpegtsAtscETT*) p); 176 } 177 178 /** 179 * Returns the #GstMpegtsAtscMGT contained in the @section. 180 * 181 * Returns: The #GstMpegtsAtscMGT contained in the section, or %NULL if an error 182 * happened. 183 */ 184 public AtscMGT getAtscMgt() 185 { 186 auto p = gst_mpegts_section_get_atsc_mgt(gstMpegtsSection); 187 188 if(p is null) 189 { 190 return null; 191 } 192 193 return ObjectG.getDObject!(AtscMGT)(cast(GstMpegtsAtscMGT*) p); 194 } 195 196 /** 197 * Returns the #GstMpegtsAtscSTT contained in the @section. 198 * 199 * Returns: The #GstMpegtsAtscSTT contained in the section, or %NULL if an error 200 * happened. 201 */ 202 public AtscSTT getAtscStt() 203 { 204 auto p = gst_mpegts_section_get_atsc_stt(gstMpegtsSection); 205 206 if(p is null) 207 { 208 return null; 209 } 210 211 return ObjectG.getDObject!(AtscSTT)(cast(GstMpegtsAtscSTT*) p); 212 } 213 214 /** 215 * Returns the #GstMpegtsAtscVCT contained in the @section 216 * 217 * Returns: The #GstMpegtsAtscVCT contained in the section, or %NULL if an error 218 * happened. 219 */ 220 public AtscVCT getAtscTvct() 221 { 222 auto p = gst_mpegts_section_get_atsc_tvct(gstMpegtsSection); 223 224 if(p is null) 225 { 226 return null; 227 } 228 229 return ObjectG.getDObject!(AtscVCT)(cast(GstMpegtsAtscVCT*) p); 230 } 231 232 /** 233 * Returns the #GstMpegtsBAT contained in the @section. 234 * 235 * Returns: The #GstMpegtsBAT contained in the section, or %NULL if an error 236 * happened. 237 */ 238 public BAT getBat() 239 { 240 auto p = gst_mpegts_section_get_bat(gstMpegtsSection); 241 242 if(p is null) 243 { 244 return null; 245 } 246 247 return ObjectG.getDObject!(BAT)(cast(GstMpegtsBAT*) p); 248 } 249 250 /** 251 * Returns the array of #GstMpegtsDescriptor contained in the Conditional 252 * Access Table. 253 * 254 * Returns: The 255 * #GstMpegtsDescriptor contained in the section, or %NULL if an error 256 * happened. Release with #g_array_unref when done. 257 */ 258 public PtrArray getCat() 259 { 260 auto p = gst_mpegts_section_get_cat(gstMpegtsSection); 261 262 if(p is null) 263 { 264 return null; 265 } 266 267 return new PtrArray(cast(GPtrArray*) p); 268 } 269 270 /** 271 * Gets the original unparsed section data. 272 * 273 * Returns: The original unparsed section data. 274 */ 275 public Bytes getData() 276 { 277 auto p = gst_mpegts_section_get_data(gstMpegtsSection); 278 279 if(p is null) 280 { 281 return null; 282 } 283 284 return new Bytes(cast(GBytes*) p, true); 285 } 286 287 /** 288 * Returns the #GstMpegtsEIT contained in the @section. 289 * 290 * Returns: The #GstMpegtsEIT contained in the section, or %NULL if an error 291 * happened. 292 */ 293 public EIT getEit() 294 { 295 auto p = gst_mpegts_section_get_eit(gstMpegtsSection); 296 297 if(p is null) 298 { 299 return null; 300 } 301 302 return ObjectG.getDObject!(EIT)(cast(GstMpegtsEIT*) p); 303 } 304 305 /** 306 * Returns the #GstMpegtsNIT contained in the @section. 307 * 308 * Returns: The #GstMpegtsNIT contained in the section, or %NULL if an error 309 * happened. 310 */ 311 public NIT getNit() 312 { 313 auto p = gst_mpegts_section_get_nit(gstMpegtsSection); 314 315 if(p is null) 316 { 317 return null; 318 } 319 320 return ObjectG.getDObject!(NIT)(cast(GstMpegtsNIT*) p); 321 } 322 323 /** 324 * Parses a Program Association Table (ITU H.222.0, ISO/IEC 13818-1). 325 * 326 * Returns the array of #GstMpegtsPatProgram contained in the section. 327 * 328 * Note: The PAT "transport_id" field corresponds to the "subtable_extension" 329 * field of the provided @section. 330 * 331 * Returns: The 332 * #GstMpegtsPatProgram contained in the section, or %NULL if an error 333 * happened. Release with #g_ptr_array_unref when done. 334 */ 335 public PtrArray getPat() 336 { 337 auto p = gst_mpegts_section_get_pat(gstMpegtsSection); 338 339 if(p is null) 340 { 341 return null; 342 } 343 344 return new PtrArray(cast(GPtrArray*) p); 345 } 346 347 /** 348 * Returns the #GstMpegtsPMT contained in the @section. 349 * 350 * Returns: The #GstMpegtsPMT contained in the section, or %NULL if an error 351 * happened. 352 */ 353 public PMT getPmt() 354 { 355 auto p = gst_mpegts_section_get_pmt(gstMpegtsSection); 356 357 if(p is null) 358 { 359 return null; 360 } 361 362 return ObjectG.getDObject!(PMT)(cast(GstMpegtsPMT*) p); 363 } 364 365 /** 366 * Returns the #GstMpegtsSDT contained in the @section. 367 * 368 * Returns: The #GstMpegtsSDT contained in the section, or %NULL if an error 369 * happened. 370 */ 371 public SDT getSdt() 372 { 373 auto p = gst_mpegts_section_get_sdt(gstMpegtsSection); 374 375 if(p is null) 376 { 377 return null; 378 } 379 380 return ObjectG.getDObject!(SDT)(cast(GstMpegtsSDT*) p); 381 } 382 383 /** 384 * Returns the #GstDateTime of the TDT 385 * 386 * Returns: The #GstDateTime contained in the section, or %NULL 387 * if an error happened. Release with #gst_date_time_unref when done. 388 */ 389 public DateTime getTdt() 390 { 391 auto p = gst_mpegts_section_get_tdt(gstMpegtsSection); 392 393 if(p is null) 394 { 395 return null; 396 } 397 398 return ObjectG.getDObject!(DateTime)(cast(GstDateTime*) p, true); 399 } 400 401 /** 402 * Returns the #GstMpegtsTOT contained in the @section. 403 * 404 * Returns: The #GstMpegtsTOT contained in the section, or %NULL if an error 405 * happened. 406 */ 407 public TOT getTot() 408 { 409 auto p = gst_mpegts_section_get_tot(gstMpegtsSection); 410 411 if(p is null) 412 { 413 return null; 414 } 415 416 return ObjectG.getDObject!(TOT)(cast(GstMpegtsTOT*) p); 417 } 418 419 /** 420 * Returns the array of #GstMpegtsDescriptor contained in the section 421 * 422 * Returns: The 423 * #GstMpegtsDescriptor contained in the section, or %NULL if an error 424 * happened. Release with #g_array_unref when done. 425 */ 426 public PtrArray getTsdt() 427 { 428 auto p = gst_mpegts_section_get_tsdt(gstMpegtsSection); 429 430 if(p is null) 431 { 432 return null; 433 } 434 435 return new PtrArray(cast(GPtrArray*) p); 436 } 437 438 /** 439 * If the data in @section has already been packetized, the data pointer is returned 440 * immediately. Otherwise, the data field is allocated and populated. 441 * 442 * Returns: pointer to section data, or %NULL on fail 443 */ 444 public ubyte[] packetize() 445 { 446 size_t outputSize; 447 448 auto p = gst_mpegts_section_packetize(gstMpegtsSection, &outputSize); 449 450 return p[0 .. outputSize]; 451 } 452 453 /** 454 * Creates a custom #GstEvent with a @GstMpegtsSection. 455 * The #GstEvent is sent to the @element #GstElement. 456 * 457 * Params: 458 * element = The #GstElement to send to section event to 459 * 460 * Returns: %TRUE if the event is sent 461 */ 462 public bool sendEvent(Element element) 463 { 464 return gst_mpegts_section_send_event(gstMpegtsSection, (element is null) ? null : element.getElementStruct()) != 0; 465 } 466 467 /** 468 * Ownership of @nit is taken. The data in @nit is managed by the #GstMpegtsSection 469 * 470 * Params: 471 * nit = a #GstMpegtsNIT to create the #GstMpegtsSection from 472 * 473 * Returns: the #GstMpegtsSection 474 */ 475 public static Section fromNit(NIT nit) 476 { 477 auto p = gst_mpegts_section_from_nit((nit is null) ? null : nit.getNITStruct()); 478 479 if(p is null) 480 { 481 return null; 482 } 483 484 return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true); 485 } 486 487 /** 488 * Creates a PAT #GstMpegtsSection from the @programs array of #GstMpegtsPatPrograms 489 * 490 * Params: 491 * programs = an array of #GstMpegtsPatProgram 492 * tsId = Transport stream ID of the PAT 493 * 494 * Returns: a #GstMpegtsSection 495 */ 496 public static Section fromPat(PtrArray programs, ushort tsId) 497 { 498 auto p = gst_mpegts_section_from_pat((programs is null) ? null : programs.getPtrArrayStruct(), tsId); 499 500 if(p is null) 501 { 502 return null; 503 } 504 505 return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true); 506 } 507 508 /** 509 * Creates a #GstMpegtsSection from @pmt that is bound to @pid 510 * 511 * Params: 512 * pmt = a #GstMpegtsPMT to create a #GstMpegtsSection from 513 * pid = The PID that the #GstMpegtsPMT belongs to 514 * 515 * Returns: #GstMpegtsSection 516 */ 517 public static Section fromPmt(PMT pmt, ushort pid) 518 { 519 auto p = gst_mpegts_section_from_pmt((pmt is null) ? null : pmt.getPMTStruct(), pid); 520 521 if(p is null) 522 { 523 return null; 524 } 525 526 return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true); 527 } 528 529 /** 530 * Ownership of @sdt is taken. The data in @sdt is managed by the #GstMpegtsSection 531 * 532 * Params: 533 * sdt = a #GstMpegtsSDT to create the #GstMpegtsSection from 534 * 535 * Returns: the #GstMpegtsSection 536 */ 537 public static Section fromSdt(SDT sdt) 538 { 539 auto p = gst_mpegts_section_from_sdt((sdt is null) ? null : sdt.getSDTStruct()); 540 541 if(p is null) 542 { 543 return null; 544 } 545 546 return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true); 547 } 548 549 /** 550 * Extracts the #GstMpegtsSection contained in the @event #GstEvent 551 * 552 * Params: 553 * event = #GstEvent containing a #GstMpegtsSection 554 * 555 * Returns: The extracted #GstMpegtsSection 556 */ 557 public static Section eventParseMpegtsSection(Event event) 558 { 559 auto p = gst_event_parse_mpegts_section((event is null) ? null : event.getEventStruct()); 560 561 if(p is null) 562 { 563 return null; 564 } 565 566 return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true); 567 } 568 569 /** 570 * Creates a new #GstMessage for a @GstMpegtsSection. 571 * 572 * Params: 573 * parent = The creator of the message 574 * section = The #GstMpegtsSection to put in a message 575 * 576 * Returns: The new #GstMessage to be posted, or %NULL if the 577 * section is not valid. 578 */ 579 public static Message messageNewMpegtsSection(ObjectGst parent, Section section) 580 { 581 auto p = gst_message_new_mpegts_section((parent is null) ? null : parent.getObjectGstStruct(), (section is null) ? null : section.getSectionStruct()); 582 583 if(p is null) 584 { 585 return null; 586 } 587 588 return ObjectG.getDObject!(Message)(cast(GstMessage*) p, true); 589 } 590 591 /** 592 * Returns the #GstMpegtsSection contained in a message. 593 * 594 * Params: 595 * message = a #GstMessage 596 * 597 * Returns: the contained #GstMpegtsSection, or %NULL. 598 */ 599 public static Section messageParseMpegtsSection(Message message) 600 { 601 auto p = gst_message_parse_mpegts_section((message is null) ? null : message.getMessageStruct()); 602 603 if(p is null) 604 { 605 return null; 606 } 607 608 return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true); 609 } 610 }